Commits

Brodie Rao committed a1f1037

Refreshing queue

Comments (0)

Files changed (3)

+# HG changeset patch
+# Parent dd24f3e7ca9e68a49fd7f38803e4d98469cad6e4
+diff --git a/mercurial/lock.py b/mercurial/lock.py
+--- a/mercurial/lock.py
++++ b/mercurial/lock.py
+@@ -49,6 +49,11 @@ class lock(object):
+ 
+         self.release()
+ 
++    def _lockname(self):
++        if lock._host is None:
++            lock._host = socket.gethostname()
++        return '%s:%s' % (lock._host, os.getpid())
++
+     def lock(self):
+         timeout = self.timeout
+         while 1:
+@@ -68,9 +73,7 @@ class lock(object):
+         if self.held:
+             self.held += 1
+             return
+-        if lock._host is None:
+-            lock._host = socket.gethostname()
+-        lockname = '%s:%s' % (lock._host, os.getpid())
++        lockname = self._lockname()
+         while not self.held:
+             try:
+                 util.makelock(lockname, self.f)
+@@ -113,7 +116,7 @@ class lock(object):
+         # held, or can race and break valid lock.
+         try:
+             l = lock(self.f + '.break', timeout=0)
+-            os.unlink(self.f)
++            util.rmlock(self._lockname(), self.f)
+             l.release()
+         except error.LockError:
+             return locker
+@@ -126,7 +129,7 @@ class lock(object):
+             if self.releasefn:
+                 self.releasefn()
+             try:
+-                os.unlink(self.f)
++                util.rmlock(self._lockname(), self.f)
+             except OSError:
+                 pass
+ 
+diff --git a/mercurial/util.py b/mercurial/util.py
+--- a/mercurial/util.py
++++ b/mercurial/util.py
+@@ -600,6 +600,10 @@ def readlock(pathname):
+         pass
+     return posixfile(pathname).read()
+ 
++def rmlock(info, pathname):
++    os.rename(pathname, info)
++    os.unlink(info)
++
+ def fstat(fp):
+     '''stat file object that may not have fileno method.'''
+     try:
+atomic-unlock #+atomic-unlock
 hgplain-i18n
 mq-opt-fuckery #+mq-opt-fuckery
 localdate-config #+localdate-config
 # HG changeset patch
-# Parent 9dec22427f10dcfb6e42972cb2425af5fee671c7
+# Parent 50558e89f3d62e2616b1d2f4b5c6114655b58501
 url: provide URL object
 
 This patch adds a URL object that re-implements urlsplit() and
 diff --git a/mercurial/url.py b/mercurial/url.py
 --- a/mercurial/url.py
 +++ b/mercurial/url.py
-@@ -23,6 +23,191 @@ def _urlunparse(scheme, netloc, path, pa
+@@ -23,6 +23,194 @@ def _urlunparse(scheme, netloc, path, pa
          result = scheme + '://' + result[len(scheme + ':'):]
      return result
  
 +        'path'
 +        """
 +        if self._localpath:
-+            return self.path or ''
++            s = self.path or ''
++            if self.fragment:
++                s += '#' + self.fragment
++            return s
 +
 +        s = self.scheme + ':'
 +        if (self.user or self.passwd or self.host or
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.