Merge with stable stable
authorWagner Bruna <wbruna@yahoo.com>
Sat, 26 Jun 2010 21:29:39 -0300
branchstable
changeset 11477 9374e3c214f9
parent 11476 597586bd93e1 (current diff)
parent 11444 b9a46acdfe1f (diff)
child 11478 13d02d6677f2
Merge with stable
--- a/hgext/bookmarks.py	Wed Jun 23 17:54:59 2010 -0300
+++ b/hgext/bookmarks.py	Sat Jun 26 21:29:39 2010 -0300
@@ -53,6 +53,13 @@
         for refspec, node in refs.iteritems():
             file.write("%s %s\n" % (hex(node), refspec))
         file.rename()
+
+        # touch 00changelog.i so hgweb reloads bookmarks (no lock needed)
+        try:
+            os.utime(repo.sjoin('00changelog.i'), None)
+        except OSError:
+            pass
+
     finally:
         wlock.release()
 
@@ -327,16 +334,15 @@
                             if r:
                                 self.ui.status(_("updating bookmark %s\n") % k)
                             else:
-                                self.ui.warn(_("failed to update bookmark"
-                                                  " %s!\n") % k)
+                                self.ui.warn(_('updating bookmark %s'
+                                               ' failed!\n') % k)
 
             return result
 
-        def addchangegroup(self, source, srctype, url, emptyok=False):
+        def addchangegroup(self, *args, **kwargs):
             parents = self.dirstate.parents()
 
-            result = super(bookmark_repo, self).addchangegroup(
-                source, srctype, url, emptyok)
+            result = super(bookmark_repo, self).addchangegroup(*args, **kwargs)
             if result > 1:
                 # We have more heads than before
                 return result
@@ -457,24 +463,27 @@
 
     if len(diff) <= 0:
         ui.status(_("no changes found\n"))
+        return 1
+    return 0
 
 def incoming(oldincoming, ui, repo, source="default", **opts):
     if opts.get('bookmarks'):
         source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
         other = hg.repository(hg.remoteui(repo, opts), source)
         ui.status(_('comparing with %s\n') % url.hidepassword(source))
-        diffbookmarks(ui, repo, other)
+        return diffbookmarks(ui, repo, other)
     else:
-        oldincoming(ui, repo, source, **opts)
+        return oldincoming(ui, repo, source, **opts)
 
-def outgoing(oldoutgoing, ui, repo, source="default", **opts):
+def outgoing(oldoutgoing, ui, repo, dest=None, **opts):
     if opts.get('bookmarks'):
-        source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
-        other = hg.repository(hg.remoteui(repo, opts), source)
-        ui.status(_('comparing with %s\n') % url.hidepassword(source))
-        diffbookmarks(ui, other, repo)
+        dest = ui.expandpath(dest or 'default-push', dest or 'default')
+        dest, branches = hg.parseurl(dest, opts.get('branch'))
+        other = hg.repository(hg.remoteui(repo, opts), dest)
+        ui.status(_('comparing with %s\n') % url.hidepassword(dest))
+        return diffbookmarks(ui, other, repo)
     else:
-        oldoutgoing(ui, repo, source, **opts)
+        return oldoutgoing(ui, repo, dest, **opts)
 
 def uisetup(ui):
     extensions.wrapfunction(repair, "strip", strip)
--- a/hgext/mq.py	Wed Jun 23 17:54:59 2010 -0300
+++ b/hgext/mq.py	Sat Jun 26 21:29:39 2010 -0300
@@ -1017,7 +1017,7 @@
                             _("cannot push to a previous patch: %s") % patch)
                     self.ui.warn(
                         _('qpush: %s is already at the top\n') % patch)
-                    return
+                    return 0
                 pushable, reason = self.pushable(patch)
                 if not pushable:
                     if reason:
@@ -1046,10 +1046,12 @@
 
             if move:
                 try:
-                    del self.full_series[self.full_series.index(patch, start)]
+                    index = self.series.index(patch, start)
+                    fullpatch = self.full_series[index]
+                    del self.full_series[index]
                 except ValueError:
                     raise util.Abort(_("patch '%s' not found") % patch)
-                self.full_series.insert(start, patch)
+                self.full_series.insert(start, fullpatch)
                 self.parse_series()
                 self.series_dirty = 1
 
--- a/hgext/zeroconf/Zeroconf.py	Wed Jun 23 17:54:59 2010 -0300
+++ b/hgext/zeroconf/Zeroconf.py	Sat Jun 26 21:29:39 2010 -0300
@@ -204,6 +204,13 @@
 class BadTypeInNameException(Exception):
 	pass
 
+class BadDomainName(Exception):
+	def __init__(self, pos):
+		Exception.__init__(self, "at position %s" % pos)
+
+class BadDomainNameCircular(BadDomainName):
+	pass
+
 # implementation classes
 
 class DNSEntry(object):
@@ -598,10 +605,10 @@
 					next = off + 1
 				off = ((len & 0x3F) << 8) | ord(self.data[off])
 				if off >= first:
-					raise "Bad domain name (circular) at " + str(off)
+					raise BadDomainNameCircular(off)
 				first = off
 			else:
-				raise "Bad domain name at " + str(off)
+				raise BadDomainName(off)
 
 		if next >= 0:
 			self.offset = next
--- a/mercurial/cmdutil.py	Wed Jun 23 17:54:59 2010 -0300
+++ b/mercurial/cmdutil.py	Sat Jun 26 21:29:39 2010 -0300
@@ -687,6 +687,7 @@
         self.patch = patch
         self.diffopts = diffopts
         self.header = {}
+        self.doneheader = False
         self.hunk = {}
         self.lastheader = None
         self.footer = None
@@ -905,7 +906,9 @@
                 if self.buffered:
                     self.header[ctx.rev()] = h
                 else:
-                    self.ui.write(h)
+                    if not self.doneheader:
+                        self.ui.write(h)
+                        self.doneheader = True
 
             # write changeset metadata, then patch if requested
             key = types['changeset']
--- a/mercurial/commands.py	Wed Jun 23 17:54:59 2010 -0300
+++ b/mercurial/commands.py	Sat Jun 26 21:29:39 2010 -0300
@@ -3745,7 +3745,8 @@
         for fname in fnames:
             f = url.open(ui, fname)
             gen = changegroup.readbundle(f, fname)
-            modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
+            modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname,
+                                           lock=lock)
     finally:
         lock.release()
 
--- a/mercurial/help/glossary.txt	Wed Jun 23 17:54:59 2010 -0300
+++ b/mercurial/help/glossary.txt	Sat Jun 26 21:29:39 2010 -0300
@@ -8,7 +8,7 @@
 Branch
     (Noun) A child changeset that has been created from a parent that
     is not a head. These are known as topological branches, see
-    'Branch, topological'.If a topological branch is named, it becomes
+    'Branch, topological'. If a topological branch is named, it becomes
     a named branch. If a topological branch is not named, it becomes
     an anonymous branch. See 'Branch, anonymous' and 'Branch, named'.
 
@@ -55,8 +55,8 @@
     collection of disjoint subsets. A named branch is not necessarily
     a topological branch. If a new named branch is created from the
     head of another named branch, or the default branch, but no
-    further changesets are added to that previous branch, then the new
-    named branch will be a branch in name only.
+    further changesets are added to that previous branch, then that
+    previous branch will be a branch in name only.
 
 Branch tip
     See 'Tip, branch'.
@@ -151,7 +151,7 @@
     consisting of nodes and edges, where nodes correspond to
     changesets and edges imply a parent -> child relation. This graph
     can be visualized by graphical tools such as :hg:`glog`
-    (graphlog). In mercurial, the DAG is limited by the requirement
+    (graphlog). In Mercurial, the DAG is limited by the requirement
     for children to have at most two parents.
 
 Default branch
@@ -322,7 +322,7 @@
     pointing to the data.
 
 Rewriting history
-    See  'History, rewriting'.
+    See 'History, rewriting'.
 
 Root
     A changeset that has only the null changeset as its parent. Most
@@ -342,7 +342,7 @@
 Update
     (Noun) Another synonym of changeset.
 
-    Example:  "I've pushed an update".
+    Example: "I've pushed an update".
 
     (Verb) This term is usually used to describe updating the state of
     the working directory to that of a specific changeset. See
@@ -354,4 +354,4 @@
     See 'Directory, working'.
 
 Working directory parent
-    See  'Parent, working directory'.
+    See 'Parent, working directory'.
--- a/mercurial/hgweb/protocol.py	Wed Jun 23 17:54:59 2010 -0300
+++ b/mercurial/hgweb/protocol.py	Sat Jun 26 21:29:39 2010 -0300
@@ -164,7 +164,7 @@
                           urllib.quote(req.env.get('REMOTE_HOST', '')),
                           urllib.quote(req.env.get('REMOTE_USER', '')))
                     try:
-                        ret = repo.addchangegroup(gen, 'serve', url)
+                        ret = repo.addchangegroup(gen, 'serve', url, lock=lock)
                     except util.Abort, inst:
                         sys.stdout.write("abort: %s\n" % inst)
                         ret = 0
--- a/mercurial/localrepo.py	Wed Jun 23 17:54:59 2010 -0300
+++ b/mercurial/localrepo.py	Sat Jun 26 21:29:39 2010 -0300
@@ -1199,7 +1199,7 @@
                                        "other repository doesn't support "
                                        "changegroupsubset."))
                 cg = remote.changegroupsubset(fetch, heads, 'pull')
-            return self.addchangegroup(cg, 'pull', remote.url())
+            return self.addchangegroup(cg, 'pull', remote.url(), lock=lock)
         finally:
             lock.release()
 
@@ -1233,8 +1233,8 @@
             ret = discovery.prepush(self, remote, force, revs, newbranch)
             if ret[0] is not None:
                 cg, remote_heads = ret
-                # here, we return an integer indicating remote head count change
-                return remote.addchangegroup(cg, 'push', self.url())
+                # we return an integer indicating remote head count change
+                return remote.addchangegroup(cg, 'push', self.url(), lock=lock)
             # and here we return 0 for "nothing to push" or 1 for
             # "something to push but I refuse"
             return ret[1]
@@ -1620,7 +1620,7 @@
 
         return util.chunkbuffer(gengroup())
 
-    def addchangegroup(self, source, srctype, url, emptyok=False):
+    def addchangegroup(self, source, srctype, url, emptyok=False, lock=None):
         """Add the changegroup returned by source.read() to this repo.
         srctype is a string like 'push', 'pull', or 'unbundle'.  url is
         the URL of the repo where this changegroup is coming from.
@@ -1760,6 +1760,8 @@
             tr.close()
         finally:
             tr.release()
+            if lock:
+                lock.release()
 
         if changesets > 0:
             # forcefully update the on-disk branch cache
--- a/mercurial/sshserver.py	Wed Jun 23 17:54:59 2010 -0300
+++ b/mercurial/sshserver.py	Sat Jun 26 21:29:39 2010 -0300
@@ -161,7 +161,8 @@
             return
 
         self.respond("")
-        r = self.repo.addchangegroup(self.fin, 'serve', self.client_url())
+        r = self.repo.addchangegroup(self.fin, 'serve', self.client_url(),
+                                     lock=self.lock)
         self.respond(str(r))
 
     def client_url(self):
@@ -205,7 +206,8 @@
                 # push can proceed
 
                 fp.seek(0)
-                r = self.repo.addchangegroup(fp, 'serve', self.client_url())
+                r = self.repo.addchangegroup(fp, 'serve', self.client_url(),
+                                             lock=self.lock)
                 self.respond(str(r))
             finally:
                 if not was_locked: