changeset 14183:333def42e785

merge with crew
author Matt Mackall <mpm@selenic.com>
date Wed, 04 May 2011 08:21:50 -0500
parents bf951d58b917 (diff) ec5886db9dc6 (current diff)
children 4ab6e2d597cc
files
diffstat 72 files changed, 1787 insertions(+), 819 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Wed May 04 13:37:41 2011 +0200
+++ b/Makefile	Wed May 04 08:21:50 2011 -0500
@@ -78,6 +78,8 @@
 dist-notests:	doc MANIFEST
 	TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py -q sdist
 
+check: tests
+
 tests:
 	cd tests && $(PYTHON) run-tests.py $(TESTFLAGS)
 
--- a/contrib/check-code.py	Wed May 04 13:37:41 2011 +0200
+++ b/contrib/check-code.py	Wed May 04 08:21:50 2011 -0500
@@ -161,6 +161,18 @@
     (r' is\s+(not\s+)?["\'0-9-]', "object comparison with literal"),
     (r' [=!]=\s+(True|False|None)',
      "comparison with singleton, use 'is' or 'is not' instead"),
+    (r'opener\([^)]*\).read\(',
+     "use opener.read() instead"),
+    (r'opener\([^)]*\).write\(',
+     "use opener.write() instead"),
+    (r'[\s\(](open|file)\([^)]*\)\.read\(',
+     "use util.readfile() instead"),
+    (r'[\s\(](open|file)\([^)]*\)\.write\(',
+     "use util.readfile() instead"),
+    (r'^[\s\(]*(open(er)?|file)\([^)]*\)',
+     "always assign an opened file to a variable, and close it afterwards"),
+    (r'[\s\(](open|file)\([^)]*\)\.',
+     "always assign an opened file to a variable, and close it afterwards"),
   ],
   # warnings
   [
--- a/contrib/win32/mercurial.ini	Wed May 04 13:37:41 2011 +0200
+++ b/contrib/win32/mercurial.ini	Wed May 04 08:21:50 2011 -0500
@@ -37,7 +37,6 @@
 [extensions]
 ;acl =
 ;alias =
-;bookmarks =
 ;bugzilla =
 ;children =
 ;churn =
@@ -56,7 +55,6 @@
 ;mq =
 ;notify =
 ;pager =
-;parentrevspec =
 ;patchbomb =
 ;progress =
 ;purge =
--- a/doc/hgrc.5.txt	Wed May 04 13:37:41 2011 +0200
+++ b/doc/hgrc.5.txt	Wed May 04 08:21:50 2011 -0500
@@ -935,7 +935,8 @@
     If set to ``warn`` (or ``true``), a warning message is printed on POSIX
     platforms, if a file with a non-portable filename is added (e.g. a file
     with a name that can't be created on Windows because it contains reserved
-    parts like ``AUX`` or reserved characters like ``:``).
+    parts like ``AUX``, reserved characters like ``:``, or would cause a case
+    collision with an existing file).
     If set to ``ignore`` (or ``false``), no warning is printed.
     If set to ``abort``, the command is aborted.
     On Windows, this configuration option is ignored and the command aborted.
--- a/hgext/convert/darcs.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/convert/darcs.py	Wed May 04 08:21:50 2011 -0500
@@ -191,7 +191,7 @@
         if rev != self.lastrev:
             raise util.Abort(_('internal calling inconsistency'))
         path = os.path.join(self.tmppath, name)
-        data = open(path, 'rb').read()
+        data = util.readfile(path)
         mode = os.lstat(path).st_mode
         mode = (mode & 0111) and 'x' or ''
         return data, mode
--- a/hgext/convert/git.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/convert/git.py	Wed May 04 08:21:50 2011 -0500
@@ -35,7 +35,7 @@
         def gitopen(self, s, noerr=False):
             if noerr:
                 (sin, so, se) = util.popen3('GIT_DIR=%s %s' % (self.path, s))
-                return stdout
+                return so
             else:
                 util.popen('GIT_DIR=%s %s' % (self.path, s), 'rb')
 
--- a/hgext/convert/monotone.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/convert/monotone.py	Wed May 04 08:21:50 2011 -0500
@@ -27,7 +27,9 @@
         if not os.path.exists(os.path.join(path, '_MTN')):
             # Could be a monotone repository (SQLite db file)
             try:
-                header = file(path, 'rb').read(16)
+                f = file(path, 'rb')
+                header = f.read(16)
+                f.close()
             except:
                 header = ''
             if header != 'SQLite format 3\x00':
--- a/hgext/convert/subversion.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/convert/subversion.py	Wed May 04 08:21:50 2011 -0500
@@ -1028,7 +1028,7 @@
                     os.unlink(filename)
             except OSError:
                 pass
-            self.wopener(filename, 'w').write(data)
+            self.wopener.write(filename, data)
 
             if self.is_exec:
                 was_exec = self.is_exec(self.wjoin(filename))
--- a/hgext/extdiff.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/extdiff.py	Wed May 04 08:21:50 2011 -0500
@@ -97,7 +97,7 @@
         if 'l' in fctx.flags():
             wopener.symlink(data, wfn)
         else:
-            wopener(wfn, 'w').write(data)
+            wopener.write(wfn, data)
             if 'x' in fctx.flags():
                 util.set_flags(dest, False, True)
         if node is None:
--- a/hgext/gpg.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/gpg.py	Wed May 04 08:21:50 2011 -0500
@@ -234,7 +234,7 @@
 
     # write it
     if opts['local']:
-        repo.opener("localsigs", "ab").write(sigmessage)
+        repo.opener.append("localsigs", sigmessage)
         return
 
     msigs = match.exact(repo.root, '', ['.hgsigs'])
--- a/hgext/inotify/linuxserver.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/inotify/linuxserver.py	Wed May 04 08:21:50 2011 -0500
@@ -44,7 +44,7 @@
 def _explain_watch_limit(ui, dirstate, rootabs):
     path = '/proc/sys/fs/inotify/max_user_watches'
     try:
-        limit = int(file(path).read())
+        limit = int(util.readfile(path))
     except IOError, err:
         if err.errno != errno.ENOENT:
             raise
--- a/hgext/keyword.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/keyword.py	Wed May 04 08:21:50 2011 -0500
@@ -413,7 +413,7 @@
     demoitems('keywordset', ui.configitems('keywordset'))
     demoitems('keywordmaps', kwmaps.iteritems())
     keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n'
-    repo.wopener(fn, 'w').write(keywords)
+    repo.wopener.write(fn, keywords)
     repo[None].add([fn])
     ui.note(_('\nkeywords written to %s:\n') % fn)
     ui.note(keywords)
--- a/hgext/mq.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/mq.py	Wed May 04 08:21:50 2011 -0500
@@ -107,7 +107,7 @@
                 elif line.startswith("# Date "):
                     date = line[7:]
                 elif line.startswith("# Parent "):
-                    parent = line[9:]
+                    parent = line[9:].lstrip()
                 elif line.startswith("# Branch "):
                     branch = line[9:]
                 elif line.startswith("# Node ID "):
@@ -291,14 +291,14 @@
                     elif l.strip():
                         self.ui.warn(_('malformated mq status line: %s\n') % entry)
                     # else we ignore empty lines
-            lines = self.opener(self.status_path).read().splitlines()
+            lines = self.opener.read(self.status_path).splitlines()
             return list(parselines(lines))
         return []
 
     @util.propertycache
     def full_series(self):
         if os.path.exists(self.join(self.series_path)):
-            return self.opener(self.series_path).read().splitlines()
+            return self.opener.read(self.series_path).splitlines()
         return []
 
     @util.propertycache
@@ -412,7 +412,7 @@
         if self.active_guards is None:
             self.active_guards = []
             try:
-                guards = self.opener(self.guards_path).read().split()
+                guards = self.opener.read(self.guards_path).split()
             except IOError, err:
                 if err.errno != errno.ENOENT:
                     raise
@@ -2987,7 +2987,7 @@
             mqtags = [(patch.node, patch.name) for patch in q.applied]
 
             try:
-                r = self.changelog.rev(mqtags[-1][0])
+                self.changelog.rev(mqtags[-1][0])
             except error.RepoLookupError:
                 self.ui.warn(_('mq status file refers to unknown node %s\n')
                              % short(mqtags[-1][0]))
--- a/hgext/progress.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/progress.py	Wed May 04 08:21:50 2011 -0500
@@ -238,7 +238,7 @@
             self.topicstates[topic] = pos, item, unit, total
             if now - self.lastprint >= self.refresh and self.topics:
                 self.lastprint = now
-                current = self.topics[-1]
+                self.topics[-1]
                 self.show(now, topic, *self.topicstates[topic])
 
 def uisetup(ui):
--- a/hgext/transplant.py	Wed May 04 13:37:41 2011 +0200
+++ b/hgext/transplant.py	Wed May 04 08:21:50 2011 -0500
@@ -39,7 +39,7 @@
     def read(self):
         abspath = os.path.join(self.path, self.transplantfile)
         if self.transplantfile and os.path.exists(abspath):
-            for line in self.opener(self.transplantfile).read().splitlines():
+            for line in self.opener.read(self.transplantfile).splitlines():
                 lnode, rnode = map(revlog.bin, line.split(':'))
                 list = self.transplants.setdefault(rnode, [])
                 list.append(transplantentry(lnode, rnode))
@@ -318,7 +318,7 @@
         nodes = []
         merges = []
         cur = nodes
-        for line in self.opener('series').read().splitlines():
+        for line in self.opener.read('series').splitlines():
             if line.startswith('# Merges'):
                 cur = merges
                 continue
@@ -494,10 +494,8 @@
     and then resume where you left off by calling :hg:`transplant
     --continue/-c`.
     '''
-    def incwalk(repo, commmon, branches, match=util.always):
-        if not branches:
-            branches = None
-        for node in repo.changelog.findmissing(common, branches):
+    def incwalk(repo, csets, match=util.always):
+        for node in csets:
             if match(node):
                 yield node
 
@@ -547,15 +545,16 @@
         if m or a or r or d:
             raise util.Abort(_('outstanding local changes'))
 
-    bundle = None
-    source = opts.get('source')
-    if source:
-        sourcerepo = ui.expandpath(source)
-        source = hg.repository(ui, sourcerepo)
-        source, common, anyinc, bundle = bundlerepo.getremotechanges(ui, repo,
-                                          source, force=True)
+    sourcerepo = opts.get('source')
+    if sourcerepo:
+        source = hg.repository(ui, ui.expandpath(sourcerepo))
+        branches = map(source.lookup, opts.get('branch', ()))
+        source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, source,
+                                    onlyheads=branches, force=True)
     else:
         source = repo
+        branches = map(source.lookup, opts.get('branch', ()))
+        cleanupfn = None
 
     try:
         if opts.get('continue'):
@@ -569,7 +568,6 @@
             matchfn = lambda x: tf(x) and x not in prune
         else:
             matchfn = tf
-        branches = map(source.lookup, opts.get('branch', ()))
         merges = map(source.lookup, opts.get('merge', ()))
         revmap = {}
         if revs:
@@ -577,8 +575,7 @@
                 revmap[int(r)] = source.lookup(r)
         elif opts.get('all') or not merges:
             if source != repo:
-                alltransplants = incwalk(source, common, branches,
-                                         match=matchfn)
+                alltransplants = incwalk(source, csets, match=matchfn)
             else:
                 alltransplants = transplantwalk(source, p1, branches,
                                                 match=matchfn)
@@ -594,9 +591,8 @@
 
         tp.apply(repo, source, revmap, merges, opts)
     finally:
-        if bundle:
-            source.close()
-            os.unlink(bundle)
+        if cleanupfn:
+            cleanupfn()
 
 def revsettransplanted(repo, subset, x):
     """``transplanted(set)``
--- a/mercurial/bookmarks.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/bookmarks.py	Wed May 04 08:21:50 2011 -0500
@@ -72,12 +72,12 @@
     refs = repo._bookmarks
 
     try:
-        bms = repo.opener('bookmarks').read()
+        bms = repo.opener.read('bookmarks')
     except IOError, inst:
         if inst.errno != errno.ENOENT:
             raise
         bms = ''
-    repo.opener('undo.bookmarks', 'w').write(bms)
+    repo.opener.write('undo.bookmarks', bms)
 
     if repo._bookmarkcurrent not in refs:
         setcurrent(repo, None)
--- a/mercurial/bundlerepo.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/bundlerepo.py	Wed May 04 08:21:50 2011 -0500
@@ -288,30 +288,48 @@
         repopath, bundlename = parentpath, path
     return bundlerepository(ui, repopath, bundlename)
 
-def getremotechanges(ui, repo, other, revs=None, bundlename=None,
+def getremotechanges(ui, repo, other, onlyheads=None, bundlename=None,
                      force=False):
-    tmp = discovery.findcommonincoming(repo, other, heads=revs, force=force)
+    '''obtains a bundle of changes incoming from other
+
+    "onlyheads" restricts the returned changes to those reachable from the
+      specified heads.
+    "bundlename", if given, stores the bundle to this file path permanently;
+      the returned "bundle" will be None.
+    "force" indicates whether to proceed on unrelated repos.
+
+    Returns a tuple (local, csets, cleanupfn):
+
+    "local" is a local repo from which to obtain the actual incoming changesets; it
+      is a bundlerepo for the obtained bundle when the original "other" is remote.
+    "csets" lists the incoming changeset node ids.
+    "cleanupfn" must be called without arguments when you're done processing the
+      changes; it closes both the original "other" and the one returned here.
+    '''
+    tmp = discovery.findcommonincoming(repo, other, heads=onlyheads, force=force)
     common, incoming, rheads = tmp
     if not incoming:
         try:
             os.unlink(bundlename)
         except OSError:
             pass
-        return other, None, None, None
+        return other, [], other.close
 
     bundle = None
+    bundlerepo = None
+    localrepo = other
     if bundlename or not other.local():
         # create a bundle (uncompressed if other repo is not local)
 
-        if revs is None and other.capable('changegroupsubset'):
-            revs = rheads
+        if onlyheads is None and other.capable('changegroupsubset'):
+            onlyheads = rheads
 
         if other.capable('getbundle'):
-            cg = other.getbundle('incoming', common=common, heads=revs)
-        elif revs is None:
+            cg = other.getbundle('incoming', common=common, heads=onlyheads)
+        elif onlyheads is None:
             cg = other.changegroup(incoming, "incoming")
         else:
-            cg = other.changegroupsubset(incoming, revs, 'incoming')
+            cg = other.changegroupsubset(incoming, onlyheads, 'incoming')
         bundletype = other.local() and "HG10BZ" or "HG10UN"
         fname = bundle = changegroup.writebundle(cg, bundlename, bundletype)
         # keep written bundle?
@@ -319,6 +337,18 @@
             bundle = None
         if not other.local():
             # use the created uncompressed bundlerepo
-            other = bundlerepository(ui, repo.root, fname)
-    return (other, common, incoming, bundle)
+            localrepo = bundlerepo = bundlerepository(ui, repo.root, fname)
+            # this repo contains local and other now, so filter out local again
+            common = repo.heads()
+
+    csets = localrepo.changelog.findmissing(common, onlyheads)
 
+    def cleanup():
+        if bundlerepo:
+            bundlerepo.close()
+        if bundle:
+            os.unlink(bundle)
+        localrepo.close()
+
+    return (localrepo, csets, cleanup)
+
--- a/mercurial/cmdutil.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/cmdutil.py	Wed May 04 08:21:50 2011 -0500
@@ -91,7 +91,7 @@
             if logfile == '-':
                 message = sys.stdin.read()
             else:
-                message = open(logfile).read()
+                message = util.readfile(logfile)
         except IOError, inst:
             raise util.Abort(_("can't read commit message '%s': %s") %
                              (logfile, inst.strerror))
--- a/mercurial/commands.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/commands.py	Wed May 04 08:21:50 2011 -0500
@@ -14,7 +14,8 @@
 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
 import merge as mergemod
 import minirst, revset, templatefilters
-import dagparser
+import dagparser, context, simplemerge
+import random, setdiscovery, treediscovery, dagutil
 
 # Commands start here, listed alphabetically
 
@@ -962,7 +963,6 @@
 
 def debugbuilddag(ui, repo, text,
                   mergeable_file=False,
-                  appended_file=False,
                   overwritten_file=False,
                   new_file=False):
     """builds a repo with a given dag from scratch in the current empty repo
@@ -979,8 +979,6 @@
      - "/p2" is a merge of the preceding node and p2
      - ":tag" defines a local tag for the preceding node
      - "@branch" sets the named branch for subsequent nodes
-     - "!command" runs the command using your shell
-     - "!!my command\\n" is like "!", but to the end of the line
      - "#...\\n" is a comment up to the end of the line
 
     Whitespace between the above elements is ignored.
@@ -994,28 +992,12 @@
 
     All string valued-elements are either strictly alphanumeric, or must
     be enclosed in double quotes ("..."), with "\\" as escape character.
-
-    Note that the --overwritten-file and --appended-file options imply the
-    use of "HGMERGE=internal:local" during DAG buildup.
     """
 
-    if not (mergeable_file or appended_file or overwritten_file or new_file):
-        raise util.Abort(_('need at least one of -m, -a, -o, -n'))
-
-    if len(repo.changelog) > 0:
+    cl = repo.changelog
+    if len(cl) > 0:
         raise util.Abort(_('repository is not empty'))
 
-    if overwritten_file or appended_file:
-        # we don't want to fail in merges during buildup
-        os.environ['HGMERGE'] = 'internal:local'
-
-    def writefile(fname, text, fmode="wb"):
-        f = open(fname, fmode)
-        try:
-            f.write(text)
-        finally:
-            f.close()
-
     if mergeable_file:
         linesperrev = 2
         # determine number of revs in DAG
@@ -1024,58 +1006,95 @@
             if type == 'n':
                 n += 1
         # make a file with k lines per rev
-        writefile("mf", "\n".join(str(i) for i in xrange(0, n * linesperrev))
-                  + "\n")
-
-    at = -1
-    atbranch = 'default'
-    for type, data in dagparser.parsedag(text):
-        if type == 'n':
-            ui.status('node %s\n' % str(data))
-            id, ps = data
-            p1 = ps[0]
-            if p1 != at:
-                update(ui, repo, node=str(p1), clean=True)
-                at = p1
-            if repo.dirstate.branch() != atbranch:
-                branch(ui, repo, atbranch, force=True)
-            if len(ps) > 1:
-                p2 = ps[1]
-                merge(ui, repo, node=p2)
-
-            if mergeable_file:
-                f = open("mf", "rb+")
-                try:
-                    lines = f.read().split("\n")
-                    lines[id * linesperrev] += " r%i" % id
-                    f.seek(0)
-                    f.write("\n".join(lines))
-                finally:
-                    f.close()
-
-            if appended_file:
-                writefile("af", "r%i\n" % id, "ab")
-
-            if overwritten_file:
-                writefile("of", "r%i\n" % id)
-
-            if new_file:
-                writefile("nf%i" % id, "r%i\n" % id)
-
-            commit(ui, repo, addremove=True, message="r%i" % id, date=(id, 0))
-            at = id
-        elif type == 'l':
-            id, name = data
-            ui.status('tag %s\n' % name)
-            tag(ui, repo, name, local=True)
-        elif type == 'a':
-            ui.status('branch %s\n' % data)
-            atbranch = data
-        elif type in 'cC':
-            r = util.system(data, cwd=repo.root)
-            if r:
-                desc, r = util.explain_exit(r)
-                raise util.Abort(_('%s command %s') % (data, desc))
+        initialmergedlines = [str(i) for i in xrange(0, n * linesperrev)]
+        initialmergedlines.append("")
+
+    tags = []
+
+    tr = repo.transaction("builddag")
+    try:
+
+        at = -1
+        atbranch = 'default'
+        nodeids = []
+        for type, data in dagparser.parsedag(text):
+            if type == 'n':
+                ui.note('node %s\n' % str(data))
+                id, ps = data
+
+                files = []
+                fctxs = {}
+
+                p2 = None
+                if mergeable_file:
+                    fn = "mf"
+                    p1 = repo[ps[0]]
+                    if len(ps) > 1:
+                        p2 = repo[ps[1]]
+                        pa = p1.ancestor(p2)
+                        base, local, other = [x[fn].data() for x in pa, p1, p2]
+                        m3 = simplemerge.Merge3Text(base, local, other)
+                        ml = [l.strip() for l in m3.merge_lines()]
+                        ml.append("")
+                    elif at > 0:
+                        ml = p1[fn].data().split("\n")
+                    else:
+                        ml = initialmergedlines
+                    ml[id * linesperrev] += " r%i" % id
+                    mergedtext = "\n".join(ml)
+                    files.append(fn)
+                    fctxs[fn] = context.memfilectx(fn, mergedtext)
+
+                if overwritten_file:
+                    fn = "of"
+                    files.append(fn)
+                    fctxs[fn] = context.memfilectx(fn, "r%i\n" % id)
+
+                if new_file:
+                    fn = "nf%i" % id
+                    files.append(fn)
+                    fctxs[fn] = context.memfilectx(fn, "r%i\n" % id)
+                    if len(ps) > 1:
+                        if not p2:
+                            p2 = repo[ps[1]]
+                        for fn in p2:
+                            if fn.startswith("nf"):
+                                files.append(fn)
+                                fctxs[fn] = p2[fn]
+
+                def fctxfn(repo, cx, path):
+                    return fctxs.get(path)
+
+                if len(ps) == 0 or ps[0] < 0:
+                    pars = [None, None]
+                elif len(ps) == 1:
+                    pars = [nodeids[ps[0]], None]
+                else:
+                    pars = [nodeids[p] for p in ps]
+                cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn,
+                                    date=(id, 0),
+                                    user="debugbuilddag",
+                                    extra={'branch': atbranch})
+                nodeid = repo.commitctx(cx)
+                nodeids.append(nodeid)
+                at = id
+            elif type == 'l':
+                id, name = data
+                ui.note('tag %s\n' % name)
+                tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name))
+            elif type == 'a':
+                ui.note('branch %s\n' % data)
+                atbranch = data
+        tr.close()
+    finally:
+        tr.release()
+
+    if tags:
+        tagsf = repo.opener("localtags", "w")
+        try:
+            tagsf.write("".join(tags))
+        finally:
+            tagsf.close()
 
 def debugcommands(ui, cmd='', *args):
     """list all available commands and options"""
@@ -1110,7 +1129,7 @@
 
 def debugfsinfo(ui, path = "."):
     """show information detected about current filesystem"""
-    open('.debugfsinfo', 'w').write('')
+    util.writefile('.debugfsinfo', '')
     ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
     ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
     ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
@@ -1453,6 +1472,65 @@
     else:
         raise util.Abort(_("no ignore patterns found"))
 
+def debugdiscovery(ui, repo, remoteurl="default", **opts):
+    """runs the changeset discovery protocol in isolation"""
+    remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
+    remote = hg.repository(hg.remoteui(repo, opts), remoteurl)
+    ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl))
+
+    # make sure tests are repeatable
+    random.seed(12323)
+
+    def doit(localheads, remoteheads):
+        if opts.get('old'):
+            if localheads:
+                raise util.Abort('cannot use localheads with old style discovery')
+            common, _in, hds = treediscovery.findcommonincoming(repo, remote,
+                                                                force=True)
+            common = set(common)
+            if not opts.get('nonheads'):
+                ui.write("unpruned common: %s\n" % " ".join([short(n)
+                                                            for n in common]))
+                dag = dagutil.revlogdag(repo.changelog)
+                all = dag.ancestorset(dag.internalizeall(common))
+                common = dag.externalizeall(dag.headsetofconnecteds(all))
+        else:
+            common, any, hds = setdiscovery.findcommonheads(ui, repo, remote)
+        common = set(common)
+        rheads = set(hds)
+        lheads = set(repo.heads())
+        ui.write("common heads: %s\n" % " ".join([short(n) for n in common]))
+        if lheads <= common:
+            ui.write("local is subset\n")
+        elif rheads <= common:
+            ui.write("remote is subset\n")
+
+    serverlogs = opts.get('serverlog')
+    if serverlogs:
+        for filename in serverlogs:
+            logfile = open(filename, 'r')
+            try:
+                line = logfile.readline()
+                while line:
+                    parts = line.strip().split(';')
+                    op = parts[1]
+                    if op == 'cg':
+                        pass
+                    elif op == 'cgss':
+                        doit(parts[2].split(' '), parts[3].split(' '))
+                    elif op == 'unb':
+                        doit(parts[3].split(' '), parts[2].split(' '))
+                    line = logfile.readline()
+            finally:
+                logfile.close()
+
+    else:
+        remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
+                                                 opts.get('remote_head'))
+        localrevs = opts.get('local_head')
+        doit(localrevs, remoterevs)
+
+
 def debugindex(ui, repo, file_, **opts):
     """dump the contents of an index file"""
     r = None
@@ -2591,7 +2669,7 @@
                 raise util.Abort(_('no diffs found'))
 
         if msgs:
-            repo.opener('last-message.txt', 'wb').write('\n* * *\n'.join(msgs))
+            repo.opener.write('last-message.txt', '\n* * *\n'.join(msgs))
     finally:
         release(lock, wlock)
 
@@ -4467,7 +4545,6 @@
     "debugbuilddag":
         (debugbuilddag,
          [('m', 'mergeable-file', None, _('add single file mergeable changes')),
-          ('a', 'appended-file', None, _('add single file all revs append to')),
           ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
           ('n', 'new-file', None, _('add new file at each rev')),
          ],
@@ -4496,6 +4573,14 @@
          [('e', 'extended', None, _('try extended date formats'))],
          _('[-e] DATE [RANGE]')),
     "debugdata": (debugdata, [], _('FILE REV')),
+    "debugdiscovery": (debugdiscovery,
+         [('', 'old', None,
+           _('use old-style discovery')),
+          ('', 'nonheads', None,
+           _('use old-style discovery with non-heads included')),
+         ] + remoteopts,
+         _('[-l REV] [-r REV] [-b BRANCH]...'
+           ' [OTHER]')),
     "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
     "debuggetbundle":
         (debuggetbundle,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/dagutil.py	Wed May 04 08:21:50 2011 -0500
@@ -0,0 +1,242 @@
+# dagutil.py - dag utilities for mercurial
+#
+# Copyright 2010 Benoit Boissinot <bboissin@gmail.com>
+# and Peter Arrenbrecht <peter@arrenbrecht.ch>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from node import nullrev
+
+
+class basedag(object):
+    '''generic interface for DAGs
+
+    terms:
+    "ix" (short for index) identifies a nodes internally,
+    "id" identifies one externally.
+
+    All params are ixs unless explicitly suffixed otherwise.
+    Pluralized params are lists or sets.
+    '''
+
+    def __init__(self):
+        self._inverse = None
+
+    def nodeset(self):
+        '''set of all node idxs'''
+        raise NotImplementedError()
+
+    def heads(self):
+        '''list of head ixs'''
+        raise NotImplementedError()
+
+    def parents(self, ix):
+        '''list of parents ixs of ix'''
+        raise NotImplementedError()
+
+    def inverse(self):
+        '''inverse DAG, where parents becomes children, etc.'''
+        raise NotImplementedError()
+
+    def ancestorset(self, starts, stops=None):
+        '''set of all ancestors of starts (incl), but stop walk at stops (excl)'''
+        raise NotImplementedError()
+
+    def descendantset(self, starts, stops=None):
+        '''set of all descendants of starts (incl), but stop walk at stops (excl)'''
+        return self.inverse().ancestorset(starts, stops)
+
+    def headsetofconnecteds(self, ixs):
+        '''subset of connected list of ixs so that no node has a descendant in it
+
+        By "connected list" we mean that if an ancestor and a descendant are in
+        the list, then so is at least one path connecting them.'''
+        raise NotImplementedError()
+
+    def externalize(self, ix):
+        '''return a list of (or set if given a set) of node ids'''
+        return self._externalize(ix)
+
+    def externalizeall(self, ixs):
+        '''return a list of (or set if given a set) of node ids'''
+        ids = self._externalizeall(ixs)
+        if isinstance(ixs, set):
+            return set(ids)
+        return list(ids)
+
+    def internalize(self, id):
+        '''return a list of (or set if given a set) of node ixs'''
+        return self._internalize(id)
+
+    def internalizeall(self, ids, filterunknown=False):
+        '''return a list of (or set if given a set) of node ids'''
+        ixs = self._internalizeall(ids, filterunknown)
+        if isinstance(ids, set):
+            return set(ixs)
+        return list(ixs)
+
+
+class genericdag(basedag):
+    '''generic implementations for DAGs'''
+
+    def ancestorset(self, starts, stops=None):
+        stops = stops and set(stops) or set()
+        seen = set()
+        pending = list(starts)
+        while pending:
+            n = pending.pop()
+            if n not in seen and n not in stops:
+                seen.add(n)
+                pending.extend(self.parents(n))
+        return seen
+
+    def headsetofconnecteds(self, ixs):
+        hds = set(ixs)
+        if not hds:
+            return hds
+        for n in ixs:
+            for p in self.parents(n):
+                hds.discard(p)
+        assert hds
+        return hds
+
+
+class revlogbaseddag(basedag):
+    '''generic dag interface to a revlog'''
+
+    def __init__(self, revlog, nodeset):
+        basedag.__init__(self)
+        self._revlog = revlog
+        self._heads = None
+        self._nodeset = nodeset
+
+    def nodeset(self):
+        return self._nodeset
+
+    def heads(self):
+        if self._heads is None:
+            self._heads = self._getheads()
+        return self._heads
+
+    def _externalize(self, ix):
+        return self._revlog.index[ix][7]
+    def _externalizeall(self, ixs):
+        idx = self._revlog.index
+        return [idx[i][7] for i in ixs]
+
+    def _internalize(self, id):
+        ix = self._revlog.rev(id)
+        if ix == nullrev:
+            raise LookupError(id, self._revlog.indexfile, _('nullid'))
+        return ix
+    def _internalizeall(self, ids, filterunknown):
+        rl = self._revlog
+        if filterunknown:
+            return [r for r in map(rl.nodemap.get, ids)
+                    if r is not None and r != nullrev]
+        return map(self._internalize, ids)
+
+
+class revlogdag(revlogbaseddag):
+    '''dag interface to a revlog'''
+
+    def __init__(self, revlog):
+        revlogbaseddag.__init__(self, revlog, set(xrange(len(revlog))))
+
+    def _getheads(self):
+        return [r for r in self._revlog.headrevs() if r != nullrev]
+
+    def parents(self, ix):
+        rlog = self._revlog
+        idx = rlog.index
+        revdata = idx[ix]
+        prev = revdata[5]
+        if prev != nullrev:
+            prev2 = revdata[6]
+            if prev2 == nullrev:
+                return [prev]
+            return [prev, prev2]
+        prev2 = revdata[6]
+        if prev2 != nullrev:
+            return [prev2]
+        return []
+
+    def inverse(self):
+        if self._inverse is None:
+            self._inverse = inverserevlogdag(self)
+        return self._inverse
+
+    def ancestorset(self, starts, stops=None):
+        rlog = self._revlog
+        idx = rlog.index
+        stops = stops and set(stops) or set()
+        seen = set()
+        pending = list(starts)
+        while pending:
+            rev = pending.pop()
+            if rev not in seen and rev not in stops:
+                seen.add(rev)
+                revdata = idx[rev]
+                for i in [5, 6]:
+                    prev = revdata[i]
+                    if prev != nullrev:
+                        pending.append(prev)
+        return seen
+
+    def headsetofconnecteds(self, ixs):
+        if not ixs:
+            return set()
+        rlog = self._revlog
+        idx = rlog.index
+        headrevs = set(ixs)
+        for rev in ixs:
+            revdata = idx[rev]
+            for i in [5, 6]:
+                prev = revdata[i]
+                if prev != nullrev:
+                    headrevs.discard(prev)
+        assert headrevs
+        return headrevs
+
+
+class inverserevlogdag(revlogbaseddag, genericdag):
+    '''inverse of an existing revlog dag; see revlogdag.inverse()'''
+
+    def __init__(self, orig):
+        revlogbaseddag.__init__(self, orig._revlog, orig._nodeset)
+        self._orig = orig
+        self._children = {}
+        self._roots = []
+        self._walkfrom = len(self._revlog) - 1
+
+    def _walkto(self, walkto):
+        rev = self._walkfrom
+        cs = self._children
+        roots = self._roots
+        idx = self._revlog.index
+        while rev >= walkto:
+            data = idx[rev]
+            isroot = True
+            for prev in [data[5], data[6]]: # parent revs
+                if prev != nullrev:
+                    cs.setdefault(prev, []).append(rev)
+                    isroot = False
+            if isroot:
+                roots.append(rev)
+            rev -= 1
+        self._walkfrom = rev - 1
+
+    def _getheads(self):
+        self._walkto(nullrev)
+        return self._roots
+
+    def parents(self, ix):
+        if ix is None:
+            return []
+        if ix <= self._walkfrom:
+            self._walkto(ix)
+        return self._children.get(ix, [])
+
+    def inverse(self):
+        return self._orig
--- a/mercurial/dirstate.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/dirstate.py	Wed May 04 08:21:50 2011 -0500
@@ -74,7 +74,7 @@
     @propertycache
     def _branch(self):
         try:
-            return self._opener("branch").read().strip() or "default"
+            return self._opener.read("branch").strip() or "default"
         except IOError:
             return "default"
 
@@ -220,13 +220,13 @@
         if branch in ['tip', '.', 'null']:
             raise util.Abort(_('the name \'%s\' is reserved') % branch)
         self._branch = encoding.fromlocal(branch)
-        self._opener("branch", "w").write(self._branch + '\n')
+        self._opener.write("branch", self._branch + '\n')
 
     def _read(self):
         self._map = {}
         self._copymap = {}
         try:
-            st = self._opener("dirstate").read()
+            st = self._opener.read("dirstate")
         except IOError, err:
             if err.errno != errno.ENOENT:
                 raise
--- a/mercurial/discovery.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/discovery.py	Wed May 04 08:21:50 2011 -0500
@@ -7,7 +7,7 @@
 
 from node import nullid, short
 from i18n import _
-import util, error
+import util, error, setdiscovery, treediscovery
 
 def findcommonincoming(repo, remote, heads=None, force=False):
     """Return a tuple (common, anyincoming, heads) used to identify the common
@@ -20,145 +20,28 @@
       changegroupsubset. No code except for pull should be relying on this fact
       any longer.
     "heads" is either the supplied heads, or else the remote's heads.
+
+    If you pass heads and they are all known locally, the reponse lists justs
+    these heads in "common" and in "heads".
     """
 
-    m = repo.changelog.nodemap
-    search = []
-    fetch = set()
-    seen = set()
-    seenbranch = set()
-    base = set()
-
-    if not heads:
-        heads = remote.heads()
-
-    if repo.changelog.tip() == nullid:
-        base.add(nullid)
-        if heads != [nullid]:
-            return [nullid], [nullid], list(heads)
-        return [nullid], [], []
-
-    # assume we're closer to the tip than the root
-    # and start by examining the heads
-    repo.ui.status(_("searching for changes\n"))
-
-    if remote.capable('getbundle'):
-        myheads = repo.heads()
-        known = remote.known(myheads)
-        if util.all(known):
-            hasincoming = set(heads).difference(set(myheads)) and True
-            return myheads, hasincoming, heads
-
-    unknown = []
-    for h in heads:
-        if h not in m:
-            unknown.append(h)
-        else:
-            base.add(h)
-
-    heads = unknown
-    if not unknown:
-        return list(base), [], []
-
-    req = set(unknown)
-    reqcnt = 0
-
-    # search through remote branches
-    # a 'branch' here is a linear segment of history, with four parts:
-    # head, root, first parent, second parent
-    # (a branch always has two parents (or none) by definition)
-    unknown = remote.branches(unknown)
-    while unknown:
-        r = []
-        while unknown:
-            n = unknown.pop(0)
-            if n[0] in seen:
-                continue
+    if not remote.capable('getbundle'):
+        return treediscovery.findcommonincoming(repo, remote, heads, force)
 
-            repo.ui.debug("examining %s:%s\n"
-                          % (short(n[0]), short(n[1])))
-            if n[0] == nullid: # found the end of the branch
-                pass
-            elif n in seenbranch:
-                repo.ui.debug("branch already found\n")
-                continue
-            elif n[1] and n[1] in m: # do we know the base?
-                repo.ui.debug("found incomplete branch %s:%s\n"
-                              % (short(n[0]), short(n[1])))
-                search.append(n[0:2]) # schedule branch range for scanning
-                seenbranch.add(n)
-            else:
-                if n[1] not in seen and n[1] not in fetch:
-                    if n[2] in m and n[3] in m:
-                        repo.ui.debug("found new changeset %s\n" %
-                                      short(n[1]))
-                        fetch.add(n[1]) # earliest unknown
-                    for p in n[2:4]:
-                        if p in m:
-                            base.add(p) # latest known
-
-                for p in n[2:4]:
-                    if p not in req and p not in m:
-                        r.append(p)
-                        req.add(p)
-            seen.add(n[0])
-
-        if r:
-            reqcnt += 1
-            repo.ui.progress(_('searching'), reqcnt, unit=_('queries'))
-            repo.ui.debug("request %d: %s\n" %
-                        (reqcnt, " ".join(map(short, r))))
-            for p in xrange(0, len(r), 10):
-                for b in remote.branches(r[p:p + 10]):
-                    repo.ui.debug("received %s:%s\n" %
-                                  (short(b[0]), short(b[1])))
-                    unknown.append(b)
+    if heads:
+        allknown = True
+        nm = repo.changelog.nodemap
+        for h in heads:
+            if nm.get(h) is None:
+                allknown = False
+                break
+        if allknown:
+            return (heads, False, heads)
 
-    # do binary search on the branches we found
-    while search:
-        newsearch = []
-        reqcnt += 1
-        repo.ui.progress(_('searching'), reqcnt, unit=_('queries'))
-        for n, l in zip(search, remote.between(search)):
-            l.append(n[1])
-            p = n[0]
-            f = 1
-            for i in l:
-                repo.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i)))
-                if i in m:
-                    if f <= 2:
-                        repo.ui.debug("found new branch changeset %s\n" %
-                                          short(p))
-                        fetch.add(p)
-                        base.add(i)
-                    else:
-                        repo.ui.debug("narrowed branch search to %s:%s\n"
-                                      % (short(p), short(i)))
-                        newsearch.append((p, i))
-                    break
-                p, f = i, f * 2
-            search = newsearch
-
-    # sanity check our fetch list
-    for f in fetch:
-        if f in m:
-            raise error.RepoError(_("already have changeset ")
-                                  + short(f[:4]))
-
-    base = list(base)
-    if base == [nullid]:
-        if force:
-            repo.ui.warn(_("warning: repository is unrelated\n"))
-        else:
-            raise util.Abort(_("repository is unrelated"))
-
-    repo.ui.debug("found new changesets starting at " +
-                 " ".join([short(f) for f in fetch]) + "\n")
-
-    repo.ui.progress(_('searching'), None)
-    repo.ui.debug("%d total queries\n" % reqcnt)
-
-    return base, list(fetch), heads
+    res = setdiscovery.findcommonheads(repo.ui, repo, remote,
+                                       abortwhenunrelated=not force)
+    common, anyinc, srvheads = res
+    return (list(common), anyinc, heads or list(srvheads))
 
 def prepush(repo, remote, force, revs, newbranch):
     '''Analyze the local and remote repositories and determine which
@@ -174,9 +57,7 @@
     changegroup is a readable file-like object whose read() returns
     successive changegroup chunks ready to be sent over the wire and
     remoteheads is the list of remote heads.'''
-    remoteheads = remote.heads()
-    common, inc, _rheads = findcommonincoming(repo, remote, heads=remoteheads,
-                                              force=force)
+    common, inc, remoteheads = findcommonincoming(repo, remote, force=force)
 
     cl = repo.changelog
     outg = cl.findmissing(common, revs)
--- a/mercurial/filemerge.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/filemerge.py	Wed May 04 08:21:50 2011 -0500
@@ -113,14 +113,14 @@
 
 def _matcheol(file, origfile):
     "Convert EOL markers in a file to match origfile"
-    tostyle = _eoltype(open(origfile, "rb").read())
+    tostyle = _eoltype(util.readfile(origfile))
     if tostyle:
-        data = open(file, "rb").read()
+        data = util.readfile(file)
         style = _eoltype(data)
         if style:
             newdata = data.replace(style, tostyle)
             if newdata != data:
-                open(file, "wb").write(newdata)
+                util.writefile(file, newdata)
 
 def filemerge(repo, mynode, orig, fcd, fco, fca):
     """perform a 3-way merge in the working directory
--- a/mercurial/help.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/help.py	Wed May 04 08:21:50 2011 -0500
@@ -8,6 +8,7 @@
 from i18n import gettext, _
 import sys, os
 import extensions
+import util
 
 
 def moduledoc(file):
@@ -79,7 +80,7 @@
                 break
 
         path = os.path.join(docdir, topic + ".txt")
-        doc = gettext(open(path).read())
+        doc = gettext(util.readfile(path))
         for rewriter in helphooks.get(topic, []):
             doc = rewriter(topic, doc)
         return doc
--- a/mercurial/hg.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/hg.py	Wed May 04 08:21:50 2011 -0500
@@ -137,14 +137,14 @@
 
     requirements = ''
     try:
-        requirements = srcrepo.opener('requires').read()
+        requirements = srcrepo.opener.read('requires')
     except IOError, inst:
         if inst.errno != errno.ENOENT:
             raise
 
     requirements += 'shared\n'
-    file(os.path.join(roothg, 'requires'), 'w').write(requirements)
-    file(os.path.join(roothg, 'sharedpath'), 'w').write(sharedpath)
+    util.writefile(os.path.join(roothg, 'requires'), requirements)
+    util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath)
 
     r = repository(ui, root)
 
@@ -427,14 +427,13 @@
 
     if revs:
         revs = [other.lookup(rev) for rev in revs]
-    other, common, anyinc, bundle = bundlerepo.getremotechanges(ui, repo, other,
-                                     revs, opts["bundle"], opts["force"])
-    if not anyinc:
-        ui.status(_("no changes found\n"))
-        return subreporecurse()
+    other, chlist, cleanupfn = bundlerepo.getremotechanges(ui, repo, other,
+                                revs, opts["bundle"], opts["force"])
+    try:
+        if not chlist:
+            ui.status(_("no changes found\n"))
+            return subreporecurse()
 
-    try:
-        chlist = other.changelog.findmissing(common, revs)
         displayer = cmdutil.show_changeset(ui, other, opts, buffered)
 
         # XXX once graphlog extension makes it into core,
@@ -443,10 +442,7 @@
 
         displayer.close()
     finally:
-        if hasattr(other, 'close'):
-            other.close()
-        if bundle:
-            os.unlink(bundle)
+        cleanupfn()
     subreporecurse()
     return 0 # exit code is zero since we found incoming changes
 
--- a/mercurial/localrepo.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/localrepo.py	Wed May 04 08:21:50 2011 -0500
@@ -56,7 +56,8 @@
                         if self.ui.configbool('format', 'dotencode', True):
                             requirements.append('dotencode')
                     # create an invalid changelog
-                    self.opener("00changelog.i", "a").write(
+                    self.opener.append(
+                        "00changelog.i",
                         '\0\0\0\2' # represents revlogv2
                         ' dummy changelog to prevent using the old repo layout'
                     )
@@ -70,7 +71,7 @@
             # find requirements
             requirements = set()
             try:
-                requirements = set(self.opener("requires").read().splitlines())
+                requirements = set(self.opener.read("requires").splitlines())
             except IOError, inst:
                 if inst.errno != errno.ENOENT:
                     raise
@@ -80,7 +81,7 @@
 
         self.sharedpath = self.path
         try:
-            s = os.path.realpath(self.opener("sharedpath").read())
+            s = os.path.realpath(self.opener.read("sharedpath"))
             if not os.path.exists(s):
                 raise error.RepoError(
                     _('.hg/sharedpath points to nonexistent directory %s') % s)
@@ -652,7 +653,7 @@
         if self._link(filename):
             data = os.readlink(self.wjoin(filename))
         else:
-            data = self.wopener(filename, 'r').read()
+            data = self.wopener.read(filename)
         return self._filter(self._encodefilterpats, filename, data)
 
     def wwrite(self, filename, data, flags):
@@ -660,7 +661,7 @@
         if 'l' in flags:
             self.wopener.symlink(data, filename)
         else:
-            self.wopener(filename, 'w').write(data)
+            fp = self.wopener.write(filename, data)
             if 'x' in flags:
                 util.set_flags(self.wjoin(filename), False, True)
 
@@ -679,13 +680,14 @@
 
         # save dirstate for rollback
         try:
-            ds = self.opener("dirstate").read()
+            ds = self.opener.read("dirstate")
         except IOError:
             ds = ""
-        self.opener("journal.dirstate", "w").write(ds)
-        self.opener("journal.branch", "w").write(
-            encoding.fromlocal(self.dirstate.branch()))
-        self.opener("journal.desc", "w").write("%d\n%s\n" % (len(self), desc))
+        self.opener.write("journal.dirstate", ds)
+        self.opener.write("journal.branch",
+                          encoding.fromlocal(self.dirstate.branch()))
+        self.opener.write("journal.desc",
+                          "%d\n%s\n" % (len(self), desc))
 
         renames = [(self.sjoin("journal"), self.sjoin("undo")),
                    (self.join("journal.dirstate"), self.join("undo.dirstate")),
@@ -720,7 +722,7 @@
             lock = self.lock()
             if os.path.exists(self.sjoin("undo")):
                 try:
-                    args = self.opener("undo.desc", "r").read().splitlines()
+                    args = self.opener.read("undo.desc").splitlines()
                     if len(args) >= 3 and self.ui.verbose:
                         desc = _("repository tip rolled back to revision %s"
                                  " (undo %s: %s)\n") % (
@@ -741,7 +743,7 @@
                     util.rename(self.join('undo.bookmarks'),
                                 self.join('bookmarks'))
                 try:
-                    branch = self.opener("undo.branch").read()
+                    branch = self.opener.read("undo.branch")
                     self.dirstate.setbranch(branch)
                 except IOError:
                     self.ui.warn(_("named branch could not be reset, "
@@ -1043,8 +1045,6 @@
         tr = lock = None
         removed = list(ctx.removed())
         p1, p2 = ctx.p1(), ctx.p2()
-        m1 = p1.manifest().copy()
-        m2 = p2.manifest()
         user = ctx.user()
 
         lock = self.lock()
@@ -1052,40 +1052,48 @@
             tr = self.transaction("commit")
             trp = weakref.proxy(tr)
 
-            # check in files
-            new = {}
-            changed = []
-            linkrev = len(self)
-            for f in sorted(ctx.modified() + ctx.added()):
-                self.ui.note(f + "\n")
-                try:
-                    fctx = ctx[f]
-                    new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
-                                              changed)
-                    m1.set(f, fctx.flags())
-                except OSError, inst:
-                    self.ui.warn(_("trouble committing %s!\n") % f)
-                    raise
-                except IOError, inst:
-                    errcode = getattr(inst, 'errno', errno.ENOENT)
-                    if error or errcode and errcode != errno.ENOENT:
+            if ctx.files():
+                m1 = p1.manifest().copy()
+                m2 = p2.manifest()
+
+                # check in files
+                new = {}
+                changed = []
+                linkrev = len(self)
+                for f in sorted(ctx.modified() + ctx.added()):
+                    self.ui.note(f + "\n")
+                    try:
+                        fctx = ctx[f]
+                        new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
+                                                  changed)
+                        m1.set(f, fctx.flags())
+                    except OSError, inst:
                         self.ui.warn(_("trouble committing %s!\n") % f)
                         raise
-                    else:
-                        removed.append(f)
+                    except IOError, inst:
+                        errcode = getattr(inst, 'errno', errno.ENOENT)
+                        if error or errcode and errcode != errno.ENOENT:
+                            self.ui.warn(_("trouble committing %s!\n") % f)
+                            raise
+                        else:
+                            removed.append(f)
 
-            # update manifest
-            m1.update(new)
-            removed = [f for f in sorted(removed) if f in m1 or f in m2]
-            drop = [f for f in removed if f in m1]
-            for f in drop:
-                del m1[f]
-            mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(),
-                                   p2.manifestnode(), (new, drop))
+                # update manifest
+                m1.update(new)
+                removed = [f for f in sorted(removed) if f in m1 or f in m2]
+                drop = [f for f in removed if f in m1]
+                for f in drop:
+                    del m1[f]
+                mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(),
+                                       p2.manifestnode(), (new, drop))
+                files = changed + removed
+            else:
+                mn = p1.manifestnode()
+                files = []
 
             # update changelog
             self.changelog.delayupdate()
-            n = self.changelog.add(mn, changed + removed, ctx.description(),
+            n = self.changelog.add(mn, files, ctx.description(),
                                    trp, p1.node(), p2.node(),
                                    user, ctx.date(), ctx.extra().copy())
             p = lambda: self.changelog.writepending() and self.root or ""
--- a/mercurial/match.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/match.py	Wed May 04 08:21:50 2011 -0500
@@ -275,7 +275,7 @@
         elif kind in ('listfile', 'listfile0'):
             delimiter = kind == 'listfile0' and '\0' or '\n'
             try:
-                files = open(name, 'r').read().split(delimiter)
+                files = util.readfile(name).split(delimiter)
                 files = [f for f in files if f]
             except EnvironmentError:
                 raise util.Abort(_("unable to read file list (%s)") % name)
--- a/mercurial/merge.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/merge.py	Wed May 04 08:21:50 2011 -0500
@@ -47,7 +47,7 @@
             self._dirty = False
     def add(self, fcl, fco, fca, fd, flags):
         hash = util.sha1(fcl.path()).hexdigest()
-        self._repo.opener("merge/" + hash, "w").write(fcl.data())
+        self._repo.opener.write("merge/" + hash, fcl.data())
         self._state[fd] = ['u', hash, fcl.path(), fca.path(),
                            hex(fca.filenode()), fco.path(), flags]
         self._dirty = True
--- a/mercurial/minirst.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/minirst.py	Wed May 04 08:21:50 2011 -0500
@@ -467,7 +467,7 @@
         print
         return blocks
 
-    text = open(sys.argv[1]).read()
+    text = util.readfile(sys.argv[1])
     blocks = debug(findblocks, text)
     blocks = debug(findliteralblocks, blocks)
     blocks, pruned = debug(prunecontainers, blocks, sys.argv[2:])
--- a/mercurial/posix.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/posix.py	Wed May 04 08:21:50 2011 -0500
@@ -316,7 +316,9 @@
                 if not os.isatty(fd):
                     continue
                 arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)
-                return array.array('h', arri)[1]
+                width = array.array('h', arri)[1]
+                if width > 0:
+                    return width
             except ValueError:
                 pass
             except IOError, e:
--- a/mercurial/revlog.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/revlog.py	Wed May 04 08:21:50 2011 -0500
@@ -617,6 +617,17 @@
         assert heads
         return (orderedout, roots, heads)
 
+    def headrevs(self):
+        count = len(self)
+        if not count:
+            return [nullrev]
+        ishead = [1] * (count + 1)
+        index = self.index
+        for r in xrange(count):
+            e = index[r]
+            ishead[e[5]] = ishead[e[6]] = 0
+        return [r for r in xrange(count) if ishead[r]]
+
     def heads(self, start=None, stop=None):
         """return the list of all nodes that have no children
 
@@ -626,15 +637,9 @@
         as if they had no children
         """
         if start is None and stop is None:
-            count = len(self)
-            if not count:
+            if not len(self):
                 return [nullid]
-            ishead = [1] * (count + 1)
-            index = self.index
-            for r in xrange(count):
-                e = index[r]
-                ishead[e[5]] = ishead[e[6]] = 0
-            return [self.node(r) for r in xrange(count) if ishead[r]]
+            return [self.node(r) for r in self.headrevs()]
 
         if start is None:
             start = nullid
--- a/mercurial/scmutil.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/scmutil.py	Wed May 04 08:21:50 2011 -0500
@@ -139,15 +139,22 @@
         '''Prevent instantiation; don't call this from subclasses.'''
         raise NotImplementedError('attempted instantiating ' + str(type(self)))
 
-    def read(self, *args, **kwargs):
-        fp = self(*args, **kwargs)
+    def read(self, path):
+        fp = self(path, 'rb')
         try:
             return fp.read()
         finally:
             fp.close()
 
-    def write(self, data, *args, **kwargs):
-        fp = self(*args, **kwargs)
+    def write(self, path, data):
+        fp = self(path, 'wb')
+        try:
+            return fp.write(data)
+        finally:
+            fp.close()
+
+    def append(self, path, data):
+        fp = self(path, 'ab')
         try:
             return fp.write(data)
         finally:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/setdiscovery.py	Wed May 04 08:21:50 2011 -0500
@@ -0,0 +1,178 @@
+# setdiscovery.py - improved discovery of common nodeset for mercurial
+#
+# Copyright 2010 Benoit Boissinot <bboissin@gmail.com>
+# and Peter Arrenbrecht <peter@arrenbrecht.ch>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from node import nullid
+from i18n import _
+import random, collections, util, dagutil
+
+def _updatesample(dag, nodes, sample, always, quicksamplesize=0):
+    # if nodes is empty we scan the entire graph
+    if nodes:
+        heads = dag.headsetofconnecteds(nodes)
+    else:
+        heads = dag.heads()
+    dist = {}
+    visit = collections.deque(heads)
+    seen = set()
+    factor = 1
+    while visit:
+        curr = visit.popleft()
+        if curr in seen:
+            continue
+        d = dist.setdefault(curr, 1)
+        if d > factor:
+            factor *= 2
+        if d == factor:
+            if curr not in always: # need this check for the early exit below
+                sample.add(curr)
+                if quicksamplesize and (len(sample) >= quicksamplesize):
+                    return
+        seen.add(curr)
+        for p in dag.parents(curr):
+            if not nodes or p in nodes:
+                dist.setdefault(p, d + 1)
+                visit.append(p)
+
+def _setupsample(dag, nodes, size):
+    if len(nodes) <= size:
+        return set(nodes), None, 0
+    always = set(dag.heads())
+    desiredlen = size - len(always)
+    if desiredlen <= 0:
+        # This could be bad if there are very many heads, all unknown to the
+        # server. We're counting on long request support here.
+        return always, None, desiredlen
+    return always, set(), desiredlen
+
+def _takequicksample(dag, nodes, size, initial):
+    always, sample, desiredlen = _setupsample(dag, nodes, size)
+    if sample is None:
+        return always
+    if initial:
+        fromset = None
+    else:
+        fromset = nodes
+    _updatesample(dag, fromset, sample, always, quicksamplesize=desiredlen)
+    sample.update(always)
+    return sample
+
+def _takefullsample(dag, nodes, size):
+    always, sample, desiredlen = _setupsample(dag, nodes, size)
+    if sample is None:
+        return always
+    # update from heads
+    _updatesample(dag, nodes, sample, always)
+    # update from roots
+    _updatesample(dag.inverse(), nodes, sample, always)
+    assert sample
+    if len(sample) > desiredlen:
+        sample = set(random.sample(sample, desiredlen))
+    elif len(sample) < desiredlen:
+        more = desiredlen - len(sample)
+        sample.update(random.sample(list(nodes - sample - always), more))
+    sample.update(always)
+    return sample
+
+def findcommonheads(ui, local, remote,
+                    initialsamplesize=100,
+                    fullsamplesize=200,
+                    abortwhenunrelated=True):
+    '''Return a tuple (common, anyincoming, remoteheads) used to identify missing
+    nodes from or in remote.
+
+    shortcutlocal determines whether we try use direct access to localrepo if
+    remote is actually local.
+    '''
+    roundtrips = 0
+    cl = local.changelog
+    dag = dagutil.revlogdag(cl)
+    nodes = dag.nodeset()
+
+    # early exit if we know all the specified server heads already
+    ui.debug("query 1; heads\n")
+    roundtrips += 1
+    srvheadhashes = remote.heads()
+
+    ## TODO We might want to request an additional random sample of the server's
+    ## nodes batched with the heads query here.
+
+    if cl.tip() == nullid:
+        if srvheadhashes != [nullid]:
+            return [nullid], True, srvheadhashes
+        return [nullid], False, []
+
+    # start actual discovery (we note this before the next "if" for compatibility
+    # reasons)
+    ui.status(_("searching for changes\n"))
+
+    srvheads = dag.internalizeall(srvheadhashes, filterunknown=True)
+    if len(srvheads) == len(srvheadhashes):
+        ui.note("all remote heads known locally\n")
+        return (srvheadhashes, False, srvheadhashes,)
+
+    # full blown discovery
+    undecided = nodes # own nodes where I don't know if the server knows them
+    common = set() # own nodes I know we both know
+    missing = set() # own nodes I know the server lacks
+
+    # treat remote heads as a first implicit sample response
+    common.update(dag.ancestorset(srvheads))
+    undecided.difference_update(common)
+    # use cheapish initial sample
+    if common:
+        ui.debug("taking initial sample\n")
+        sample = _takefullsample(dag, undecided, size=fullsamplesize)
+    else:
+        ui.debug("taking quick initial sample\n")
+        sample = _takequicksample(dag, nodes, size=initialsamplesize,
+                                  initial=True)
+
+    roundtrips += 1
+    ui.progress(_('searching'), roundtrips, unit=_('queries'))
+    ui.debug("query %i; still undecided: %i, sample size is: %i\n"
+             % (roundtrips, len(undecided), len(sample)))
+    # indices between sample and externalized version must match
+    sample = list(sample)
+    yesno = remote.known(dag.externalizeall(sample))
+
+    while undecided:
+        commoninsample = set(n for i, n in enumerate(sample) if yesno[i])
+        common.update(dag.ancestorset(commoninsample, common))
+
+        missinginsample = [n for i, n in enumerate(sample) if not yesno[i]]
+        missing.update(dag.descendantset(missinginsample, missing))
+
+        undecided.difference_update(missing)
+        undecided.difference_update(common)
+
+        if not undecided:
+            break
+
+        ui.note("sampling from both directions\n")
+        sample = _takefullsample(dag, undecided, size=fullsamplesize)
+
+        roundtrips += 1
+        ui.progress(_('searching'), roundtrips, unit=_('queries'))
+        ui.debug("query %i; still undecided: %i, sample size is: %i\n"
+                 % (roundtrips, len(undecided), len(sample)))
+        # indices between sample and externalized version must match
+        sample = list(sample)
+        yesno = remote.known(dag.externalizeall(sample))
+
+    result = dag.headsetofconnecteds(common)
+    ui.progress(_('searching'), None)
+    ui.debug("%d total queries\n" % roundtrips)
+
+    if not result and srvheadhashes != [nullid]:
+        if abortwhenunrelated:
+            raise util.Abort(_("repository is unrelated"))
+        else:
+            ui.warn(_("warning: repository is unrelated\n"))
+        return (set([nullid]), True, srvheadhashes,)
+
+    return (dag.externalizeall(result), True, srvheadhashes,)
--- a/mercurial/statichttprepo.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/statichttprepo.py	Wed May 04 08:21:50 2011 -0500
@@ -93,7 +93,7 @@
 
         # find requirements
         try:
-            requirements = self.opener("requires").read().splitlines()
+            requirements = self.opener.read("requires").splitlines()
         except IOError, inst:
             if inst.errno != errno.ENOENT:
                 raise
--- a/mercurial/store.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/store.py	Wed May 04 08:21:50 2011 -0500
@@ -370,16 +370,21 @@
         self.encode = encode
         self.path = path + '/store'
         self.createmode = _calcmode(self.path)
-        op = openertype(self.path)
+
+        storeself = self
+
+        class fncacheopener(openertype):
+            def __call__(self, path, mode='r', *args, **kw):
+                if mode not in ('r', 'rb') and path.startswith('data/'):
+                    fnc.add(path)
+                return openertype.__call__(self, storeself.encode(path), mode,
+                                           *args, **kw)
+
+        op = fncacheopener(self.path)
         op.createmode = self.createmode
         fnc = fncache(op)
         self.fncache = fnc
-
-        def fncacheopener(path, mode='r', *args, **kw):
-            if mode not in ('r', 'rb') and path.startswith('data/'):
-                fnc.add(path)
-            return op(self.encode(path), mode, *args, **kw)
-        self.opener = fncacheopener
+        self.opener = op
 
     def join(self, f):
         return self.path + '/' + self.encode(f)
--- a/mercurial/tags.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/tags.py	Wed May 04 08:21:50 2011 -0500
@@ -60,7 +60,7 @@
 def readlocaltags(ui, repo, alltags, tagtypes):
     '''Read local tags in repo.  Update alltags and tagtypes.'''
     try:
-        data = repo.opener("localtags").read()
+        data = repo.opener.read("localtags")
     except IOError, inst:
         if inst.errno != errno.ENOENT:
             raise
--- a/mercurial/templater.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/templater.py	Wed May 04 08:21:50 2011 -0500
@@ -311,7 +311,7 @@
         '''Get the template for the given template name. Use a local cache.'''
         if not t in self.cache:
             try:
-                self.cache[t] = open(self.map[t][1]).read()
+                self.cache[t] = util.readfile(self.map[t][1])
             except KeyError, inst:
                 raise util.Abort(_('"%s" not in template map') % inst.args[0])
             except IOError, inst:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/treediscovery.py	Wed May 04 08:21:50 2011 -0500
@@ -0,0 +1,151 @@
+# discovery.py - protocol changeset discovery functions
+#
+# Copyright 2010 Matt Mackall <mpm@selenic.com>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+from node import nullid, short
+from i18n import _
+import util, error
+
+def findcommonincoming(repo, remote, heads=None, force=False):
+    """Return a tuple (common, fetch, heads) used to identify the common
+    subset of nodes between repo and remote.
+
+    "common" is a list of (at least) the heads of the common subset.
+    "fetch" is a list of roots of the nodes that would be incoming, to be
+      supplied to changegroupsubset.
+    "heads" is either the supplied heads, or else the remote's heads.
+    """
+
+    m = repo.changelog.nodemap
+    search = []
+    fetch = set()
+    seen = set()
+    seenbranch = set()
+    base = set()
+
+    if not heads:
+        heads = remote.heads()
+
+    if repo.changelog.tip() == nullid:
+        base.add(nullid)
+        if heads != [nullid]:
+            return [nullid], [nullid], list(heads)
+        return [nullid], [], []
+
+    # assume we're closer to the tip than the root
+    # and start by examining the heads
+    repo.ui.status(_("searching for changes\n"))
+
+    unknown = []
+    for h in heads:
+        if h not in m:
+            unknown.append(h)
+        else:
+            base.add(h)
+
+    heads = unknown
+    if not unknown:
+        return list(base), [], []
+
+    req = set(unknown)
+    reqcnt = 0
+
+    # search through remote branches
+    # a 'branch' here is a linear segment of history, with four parts:
+    # head, root, first parent, second parent
+    # (a branch always has two parents (or none) by definition)
+    unknown = remote.branches(unknown)
+    while unknown:
+        r = []
+        while unknown:
+            n = unknown.pop(0)
+            if n[0] in seen:
+                continue
+
+            repo.ui.debug("examining %s:%s\n"
+                          % (short(n[0]), short(n[1])))
+            if n[0] == nullid: # found the end of the branch
+                pass
+            elif n in seenbranch:
+                repo.ui.debug("branch already found\n")
+                continue
+            elif n[1] and n[1] in m: # do we know the base?
+                repo.ui.debug("found incomplete branch %s:%s\n"
+                              % (short(n[0]), short(n[1])))
+                search.append(n[0:2]) # schedule branch range for scanning
+                seenbranch.add(n)
+            else:
+                if n[1] not in seen and n[1] not in fetch:
+                    if n[2] in m and n[3] in m:
+                        repo.ui.debug("found new changeset %s\n" %
+                                      short(n[1]))
+                        fetch.add(n[1]) # earliest unknown
+                    for p in n[2:4]:
+                        if p in m:
+                            base.add(p) # latest known
+
+                for p in n[2:4]:
+                    if p not in req and p not in m:
+                        r.append(p)
+                        req.add(p)
+            seen.add(n[0])
+
+        if r:
+            reqcnt += 1
+            repo.ui.progress(_('searching'), reqcnt, unit=_('queries'))
+            repo.ui.debug("request %d: %s\n" %
+                        (reqcnt, " ".join(map(short, r))))
+            for p in xrange(0, len(r), 10):
+                for b in remote.branches(r[p:p + 10]):
+                    repo.ui.debug("received %s:%s\n" %
+                                  (short(b[0]), short(b[1])))
+                    unknown.append(b)
+
+    # do binary search on the branches we found
+    while search:
+        newsearch = []
+        reqcnt += 1
+        repo.ui.progress(_('searching'), reqcnt, unit=_('queries'))
+        for n, l in zip(search, remote.between(search)):
+            l.append(n[1])
+            p = n[0]
+            f = 1
+            for i in l:
+                repo.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i)))
+                if i in m:
+                    if f <= 2:
+                        repo.ui.debug("found new branch changeset %s\n" %
+                                          short(p))
+                        fetch.add(p)
+                        base.add(i)
+                    else:
+                        repo.ui.debug("narrowed branch search to %s:%s\n"
+                                      % (short(p), short(i)))
+                        newsearch.append((p, i))
+                    break
+                p, f = i, f * 2
+            search = newsearch
+
+    # sanity check our fetch list
+    for f in fetch:
+        if f in m:
+            raise error.RepoError(_("already have changeset ")
+                                  + short(f[:4]))
+
+    base = list(base)
+    if base == [nullid]:
+        if force:
+            repo.ui.warn(_("warning: repository is unrelated\n"))
+        else:
+            raise util.Abort(_("repository is unrelated"))
+
+    repo.ui.debug("found new changesets starting at " +
+                 " ".join([short(f) for f in fetch]) + "\n")
+
+    repo.ui.progress(_('searching'), None)
+    repo.ui.debug("%d total queries\n" % reqcnt)
+
+    return base, list(fetch), heads
--- a/mercurial/util.py	Wed May 04 13:37:41 2011 +0200
+++ b/mercurial/util.py	Wed May 04 08:21:50 2011 -0500
@@ -778,8 +778,15 @@
     finally:
         fp.close()
 
-def writefile(path, mode, text):
-    fp = open(path, mode)
+def writefile(path, text):
+    fp = open(path, 'wb')
+    try:
+        fp.write(text)
+    finally:
+        fp.close()
+
+def appendfile(path, text):
+    fp = open(path, 'ab')
     try:
         fp.write(text)
     finally:
--- a/tests/filterpyflakes.py	Wed May 04 13:37:41 2011 +0200
+++ b/tests/filterpyflakes.py	Wed May 04 08:21:50 2011 -0500
@@ -4,9 +4,29 @@
 
 import sys, re
 
+def makekey(message):
+    # "path/file:line: message"
+    match = re.search(r"(line \d+)", message)
+    line = ''
+    if match:
+        line = match.group(0)
+        message = re.sub(r"(line \d+)", '', message)
+    return re.sub(r"([^:]*):([^:]+):([^']*)('[^']*')(.*)$",
+                  r'\3:\5:\4:\1:\2:' + line,
+                  message)
+
+lines = []
 for line in sys.stdin:
     # We whitelist tests
-    if not re.search("imported but unused", line):
+    pats = [
+            r"imported but unused",
+            r"local variable '.*' is assigned to but never used",
+            r"unable to detect undefined names",
+           ]
+    if not re.search('|'.join(pats), line):
         continue
+    lines.append(line)
+
+for line in sorted(lines, key = makekey):
     sys.stdout.write(line)
 print
--- a/tests/test-acl.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-acl.t	Wed May 04 08:21:50 2011 -0500
@@ -82,7 +82,9 @@
   hgrc = """
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -135,7 +137,9 @@
   pretxnchangegroup.acl = python:hgext.acl.hook
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   3 changesets found
   list of changesets:
@@ -192,7 +196,9 @@
   sources = push
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   3 changesets found
   list of changesets:
@@ -258,7 +264,9 @@
   [acl.allow]
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   3 changesets found
   list of changesets:
@@ -322,7 +330,9 @@
   foo/** = fred
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -390,7 +400,9 @@
   [acl.deny]
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -455,7 +467,9 @@
   foo/bar/** = fred
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -525,7 +539,9 @@
   foo/Bar/** = fred
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -592,7 +608,9 @@
   foo/Bar/** = fred
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -661,7 +679,9 @@
   ** = barney
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -733,7 +753,9 @@
   **/*.txt = wilma
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   3 changesets found
   list of changesets:
@@ -810,7 +832,9 @@
   config = ../acl.config
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -880,7 +904,9 @@
   foo/** = betty
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -962,7 +988,9 @@
   changegroup.acl = false
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -1035,7 +1063,9 @@
   ** = fred
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   3 changesets found
   list of changesets:
@@ -1105,7 +1135,9 @@
   foo/Bar/** = *
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   3 changesets found
   list of changesets:
@@ -1178,7 +1210,9 @@
   ** = @group1
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   3 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
@@ -1248,7 +1282,9 @@
   foo/Bar/** = @group1
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   3 changesets found
   list of changesets:
@@ -1359,13 +1395,15 @@
   [extensions]
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   4 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  4ea792ff64284af438188103a0ee8aca1724fb8c
+  e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   adding changesets
   bundling: 1 changesets
   bundling: 2 changesets
@@ -1386,7 +1424,7 @@
   changesets: 3 chunks
   add changeset 911600dab2ae
   changesets: 4 chunks
-  add changeset 4ea792ff6428
+  add changeset e8fc755d4d82
   adding manifests
   manifests: 1/4 chunks (25.00%)
   manifests: 2/4 chunks (50.00%)
@@ -1413,13 +1451,13 @@
   acl: allowing changeset f9cafe1212c8
   acl: branch access granted: "911600dab2ae" on branch "default"
   acl: allowing changeset 911600dab2ae
-  acl: branch access granted: "4ea792ff6428" on branch "foobar"
-  acl: allowing changeset 4ea792ff6428
+  acl: branch access granted: "e8fc755d4d82" on branch "foobar"
+  acl: allowing changeset e8fc755d4d82
   updating the branch cache
   checking for updated bookmarks
   repository tip rolled back to revision 2 (undo push)
   working directory now based on revision 2
-  2:07e028174695
+  2:fb35475503ef
   
 
 Branch acl deny test
@@ -1436,14 +1474,16 @@
   foobar = *
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   4 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  4ea792ff64284af438188103a0ee8aca1724fb8c
+  e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   adding changesets
   bundling: 1 changesets
   bundling: 2 changesets
@@ -1464,7 +1504,7 @@
   changesets: 3 chunks
   add changeset 911600dab2ae
   changesets: 4 chunks
-  add changeset 4ea792ff6428
+  add changeset e8fc755d4d82
   adding manifests
   manifests: 1/4 chunks (25.00%)
   manifests: 2/4 chunks (50.00%)
@@ -1491,12 +1531,12 @@
   acl: allowing changeset f9cafe1212c8
   acl: branch access granted: "911600dab2ae" on branch "default"
   acl: allowing changeset 911600dab2ae
-  error: pretxnchangegroup.acl hook failed: acl: user "astro" denied on branch "foobar" (changeset "4ea792ff6428")
+  error: pretxnchangegroup.acl hook failed: acl: user "astro" denied on branch "foobar" (changeset "e8fc755d4d82")
   transaction abort!
   rollback completed
-  abort: acl: user "astro" denied on branch "foobar" (changeset "4ea792ff6428")
+  abort: acl: user "astro" denied on branch "foobar" (changeset "e8fc755d4d82")
   no rollback information available
-  2:07e028174695
+  2:fb35475503ef
   
 
 Branch acl empty allow test
@@ -1512,13 +1552,15 @@
   [acl.allow.branches]
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   4 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  4ea792ff64284af438188103a0ee8aca1724fb8c
+  e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   adding changesets
   bundling: 1 changesets
   bundling: 2 changesets
@@ -1539,7 +1581,7 @@
   changesets: 3 chunks
   add changeset 911600dab2ae
   changesets: 4 chunks
-  add changeset 4ea792ff6428
+  add changeset e8fc755d4d82
   adding manifests
   manifests: 1/4 chunks (25.00%)
   manifests: 2/4 chunks (50.00%)
@@ -1565,7 +1607,7 @@
   rollback completed
   abort: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
   no rollback information available
-  2:07e028174695
+  2:fb35475503ef
   
 
 Branch acl allow other
@@ -1583,13 +1625,15 @@
   * = george
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   4 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  4ea792ff64284af438188103a0ee8aca1724fb8c
+  e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   adding changesets
   bundling: 1 changesets
   bundling: 2 changesets
@@ -1610,7 +1654,7 @@
   changesets: 3 chunks
   add changeset 911600dab2ae
   changesets: 4 chunks
-  add changeset 4ea792ff6428
+  add changeset e8fc755d4d82
   adding manifests
   manifests: 1/4 chunks (25.00%)
   manifests: 2/4 chunks (50.00%)
@@ -1636,7 +1680,7 @@
   rollback completed
   abort: acl: user "astro" not allowed on branch "default" (changeset "ef1ea85a6374")
   no rollback information available
-  2:07e028174695
+  2:fb35475503ef
   
   $ do_push george
   Pushing as user george
@@ -1648,13 +1692,15 @@
   * = george
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   4 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  4ea792ff64284af438188103a0ee8aca1724fb8c
+  e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   adding changesets
   bundling: 1 changesets
   bundling: 2 changesets
@@ -1675,7 +1721,7 @@
   changesets: 3 chunks
   add changeset 911600dab2ae
   changesets: 4 chunks
-  add changeset 4ea792ff6428
+  add changeset e8fc755d4d82
   adding manifests
   manifests: 1/4 chunks (25.00%)
   manifests: 2/4 chunks (50.00%)
@@ -1702,13 +1748,13 @@
   acl: allowing changeset f9cafe1212c8
   acl: branch access granted: "911600dab2ae" on branch "default"
   acl: allowing changeset 911600dab2ae
-  acl: branch access granted: "4ea792ff6428" on branch "foobar"
-  acl: allowing changeset 4ea792ff6428
+  acl: branch access granted: "e8fc755d4d82" on branch "foobar"
+  acl: allowing changeset e8fc755d4d82
   updating the branch cache
   checking for updated bookmarks
   repository tip rolled back to revision 2 (undo push)
   working directory now based on revision 2
-  2:07e028174695
+  2:fb35475503ef
   
 
 Branch acl conflicting allow
@@ -1730,14 +1776,16 @@
   * = george
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   4 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  4ea792ff64284af438188103a0ee8aca1724fb8c
+  e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   adding changesets
   bundling: 1 changesets
   bundling: 2 changesets
@@ -1758,7 +1806,7 @@
   changesets: 3 chunks
   add changeset 911600dab2ae
   changesets: 4 chunks
-  add changeset 4ea792ff6428
+  add changeset e8fc755d4d82
   adding manifests
   manifests: 1/4 chunks (25.00%)
   manifests: 2/4 chunks (50.00%)
@@ -1785,13 +1833,13 @@
   acl: allowing changeset f9cafe1212c8
   acl: branch access granted: "911600dab2ae" on branch "default"
   acl: allowing changeset 911600dab2ae
-  acl: branch access granted: "4ea792ff6428" on branch "foobar"
-  acl: allowing changeset 4ea792ff6428
+  acl: branch access granted: "e8fc755d4d82" on branch "foobar"
+  acl: allowing changeset e8fc755d4d82
   updating the branch cache
   checking for updated bookmarks
   repository tip rolled back to revision 2 (undo push)
   working directory now based on revision 2
-  2:07e028174695
+  2:fb35475503ef
   
 Branch acl conflicting deny
 
@@ -1812,14 +1860,16 @@
   * = george
   """
   pushing to ../b
+  query 1; heads
   searching for changes
+  all remote heads known locally
   invalidating branch cache (tip differs)
   4 changesets found
   list of changesets:
   ef1ea85a6374b77d6da9dcda9541f498f2d17df7
   f9cafe1212c8c6fa1120d14a556e18cc44ff8bdd
   911600dab2ae7a9baff75958b84fe606851ce955
-  4ea792ff64284af438188103a0ee8aca1724fb8c
+  e8fc755d4d8217ee5b0c2bb41558c40d43b92c01
   adding changesets
   bundling: 1 changesets
   bundling: 2 changesets
@@ -1840,7 +1890,7 @@
   changesets: 3 chunks
   add changeset 911600dab2ae
   changesets: 4 chunks
-  add changeset 4ea792ff6428
+  add changeset e8fc755d4d82
   adding manifests
   manifests: 1/4 chunks (25.00%)
   manifests: 2/4 chunks (50.00%)
@@ -1866,5 +1916,5 @@
   rollback completed
   abort: acl: user "george" denied on branch "default" (changeset "ef1ea85a6374")
   no rollback information available
-  2:07e028174695
+  2:fb35475503ef
   
--- a/tests/test-bookmarks-pushpull.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-bookmarks-pushpull.t	Wed May 04 08:21:50 2011 -0500
@@ -39,7 +39,6 @@
   Z	4e3505fd95835d721066b76e75dbb8cc554d7f77
   $ hg pull -B X ../a
   pulling from ../a
-  searching for changes
   no changes found
   importing bookmark X
   $ hg bookmark
@@ -173,7 +172,6 @@
      foobar                    000000000000
   $ hg pull -B Z http://localhost:$HGPORT/
   pulling from http://localhost:$HGPORT/
-  searching for changes
   no changes found
   not updating divergent bookmark X
   importing bookmark Z
--- a/tests/test-branch-tag-confict.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-branch-tag-confict.t	Wed May 04 08:21:50 2011 -0500
@@ -19,7 +19,7 @@
 This is what we have:
 
   $ hg log
-  changeset:   2:02b1af9b58c2
+  changeset:   2:10519b3f489a
   branch:      branchortag
   tag:         tip
   user:        test
@@ -53,7 +53,7 @@
   $ hg up 'branch(branchortag)'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg parents
-  changeset:   2:02b1af9b58c2
+  changeset:   2:10519b3f489a
   branch:      branchortag
   tag:         tip
   user:        test
--- a/tests/test-branches.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-branches.t	Wed May 04 08:21:50 2011 -0500
@@ -230,7 +230,7 @@
   default                        0:19709c5a4e75 (inactive)
   $ hg branches -c
   a branch name much longer than the default justification used by branches 7:10ff5895aa57
-  b                             12:2da6583810df (closed)
+  b                             12:e3d49c0575d8 (closed)
   c                              6:589736a22561 (inactive)
   a                              5:d8cbc61dbaa6 (inactive)
   default                        0:19709c5a4e75 (inactive)
@@ -240,7 +240,7 @@
   no open branch heads found on branches b
   [1]
   $ hg heads --closed b
-  changeset:   12:2da6583810df
+  changeset:   12:e3d49c0575d8
   branch:      b
   tag:         tip
   parent:      8:eebb944467c9
@@ -248,7 +248,7 @@
   date:        Thu Jan 01 00:00:09 1970 +0000
   summary:     close this part branch too
   
-  changeset:   11:c84627f3c15d
+  changeset:   11:d3f163457ebf
   branch:      b
   user:        test
   date:        Thu Jan 01 00:00:09 1970 +0000
@@ -261,13 +261,13 @@
 --- branch b is back in action
 
   $ hg branches -a
-  b                             13:6ac12926b8c3
+  b                             13:e23b5505d1ad
   a branch name much longer than the default justification used by branches 7:10ff5895aa57
 
 ---- test heads listings
 
   $ hg heads
-  changeset:   13:6ac12926b8c3
+  changeset:   13:e23b5505d1ad
   branch:      b
   tag:         tip
   user:        test
@@ -325,7 +325,7 @@
 branch b
 
   $ hg heads b
-  changeset:   13:6ac12926b8c3
+  changeset:   13:e23b5505d1ad
   branch:      b
   tag:         tip
   user:        test
@@ -333,14 +333,14 @@
   summary:     reopen branch with a change
   
   $ hg heads --closed b
-  changeset:   13:6ac12926b8c3
+  changeset:   13:e23b5505d1ad
   branch:      b
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:09 1970 +0000
   summary:     reopen branch with a change
   
-  changeset:   11:c84627f3c15d
+  changeset:   11:d3f163457ebf
   branch:      b
   user:        test
   date:        Thu Jan 01 00:00:09 1970 +0000
@@ -359,7 +359,7 @@
   $ hg up -C b
   2 files updated, 0 files merged, 3 files removed, 0 files unresolved
   $ hg branches --color=always
-  \x1b[0;32mb\x1b[0m \x1b[0;33m                            13:6ac12926b8c3\x1b[0m (esc)
+  \x1b[0;32mb\x1b[0m \x1b[0;33m                            13:e23b5505d1ad\x1b[0m (esc)
   \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;33m7:10ff5895aa57\x1b[0m (esc)
   \x1b[0;0ma\x1b[0m \x1b[0;33m                             5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
   \x1b[0;0mdefault\x1b[0m \x1b[0;33m                       0:19709c5a4e75\x1b[0m (inactive) (esc)
@@ -367,9 +367,9 @@
 default closed branch color:
 
   $ hg branches --color=always --closed
-  \x1b[0;32mb\x1b[0m \x1b[0;33m                            13:6ac12926b8c3\x1b[0m (esc)
+  \x1b[0;32mb\x1b[0m \x1b[0;33m                            13:e23b5505d1ad\x1b[0m (esc)
   \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;33m7:10ff5895aa57\x1b[0m (esc)
-  \x1b[0;30;1mc\x1b[0m \x1b[0;33m                            14:717d2e6fabe1\x1b[0m (closed) (esc)
+  \x1b[0;30;1mc\x1b[0m \x1b[0;33m                            14:f894c25619d3\x1b[0m (closed) (esc)
   \x1b[0;0ma\x1b[0m \x1b[0;33m                             5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
   \x1b[0;0mdefault\x1b[0m \x1b[0;33m                       0:19709c5a4e75\x1b[0m (inactive) (esc)
 
@@ -385,7 +385,7 @@
 custom branch colors:
 
   $ hg branches --color=always
-  \x1b[0;31mb\x1b[0m \x1b[0;36m                            13:6ac12926b8c3\x1b[0m (esc)
+  \x1b[0;31mb\x1b[0m \x1b[0;36m                            13:e23b5505d1ad\x1b[0m (esc)
   \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;36m7:10ff5895aa57\x1b[0m (esc)
   \x1b[0;35ma\x1b[0m \x1b[0;36m                             5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
   \x1b[0;35mdefault\x1b[0m \x1b[0;36m                       0:19709c5a4e75\x1b[0m (inactive) (esc)
@@ -393,8 +393,8 @@
 custom closed branch color:
 
   $ hg branches --color=always --closed
-  \x1b[0;31mb\x1b[0m \x1b[0;36m                            13:6ac12926b8c3\x1b[0m (esc)
+  \x1b[0;31mb\x1b[0m \x1b[0;36m                            13:e23b5505d1ad\x1b[0m (esc)
   \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m \x1b[0;36m7:10ff5895aa57\x1b[0m (esc)
-  \x1b[0;34mc\x1b[0m \x1b[0;36m                            14:717d2e6fabe1\x1b[0m (closed) (esc)
+  \x1b[0;34mc\x1b[0m \x1b[0;36m                            14:f894c25619d3\x1b[0m (closed) (esc)
   \x1b[0;35ma\x1b[0m \x1b[0;36m                             5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
   \x1b[0;35mdefault\x1b[0m \x1b[0;36m                       0:19709c5a4e75\x1b[0m (inactive) (esc)
--- a/tests/test-bundle.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-bundle.t	Wed May 04 08:21:50 2011 -0500
@@ -561,7 +561,9 @@
 == bundling
 
   $ hg bundle bundle.hg part --debug
+  query 1; heads
   searching for changes
+  all remote heads known locally
   2 changesets found
   list of changesets:
   d2ae7f538514cd87c17547b0de4cea71fe1af9fb
--- a/tests/test-casecollision.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-casecollision.t	Wed May 04 08:21:50 2011 -0500
@@ -31,4 +31,10 @@
   $ hg st
   A A
   A a
+
+case changing rename must not warn or abort
+
+  $ echo c > c
+  $ hg ci -qAmx
+  $ hg mv c C
   $ cd ..
--- a/tests/test-check-pyflakes.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-check-pyflakes.t	Wed May 04 08:21:50 2011 -0500
@@ -1,11 +1,15 @@
   $ "$TESTDIR/hghave" pyflakes || exit 80
   $ cd $(dirname $TESTDIR)
-  $ pyflakes mercurial hgext 2>&1 | sort | $TESTDIR/filterpyflakes.py
+  $ pyflakes mercurial hgext 2>&1 | $TESTDIR/filterpyflakes.py
+  mercurial/hgweb/server.py:*: 'activeCount' imported but unused (glob)
   mercurial/commands.py:*: 'base85' imported but unused (glob)
   mercurial/commands.py:*: 'bdiff' imported but unused (glob)
   mercurial/commands.py:*: 'mpatch' imported but unused (glob)
   mercurial/commands.py:*: 'osutil' imported but unused (glob)
-  mercurial/hgweb/server.py:*: 'activeCount' imported but unused (glob)
   mercurial/revlog.py:*: 'short' imported but unused (glob)
+  hgext/inotify/linux/__init__.py:*: 'from _inotify import *' used; unable to detect undefined names (glob)
+  mercurial/util.py:*: 'from posix import *' used; unable to detect undefined names (glob)
+  mercurial/windows.py:*: 'from win32 import *' used; unable to detect undefined names (glob)
+  mercurial/util.py:*: 'from windows import *' used; unable to detect undefined names (glob)
   
 
--- a/tests/test-command-template.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-command-template.t	Wed May 04 08:21:50 2011 -0500
@@ -77,13 +77,13 @@
   7:-1   29114dbae42b   1970-01-12 13:46 +0000   user
     second
   
-  6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
+  6:5,4   d41e714fe50d   1970-01-18 08:40 +0000   person
     merge
   
   5:3   13207e5a10d9   1970-01-18 08:40 +0000   person
     new head
   
-  4   32a18f097fcc   1970-01-17 04:53 +0000   person
+  4   bbe44766e73d   1970-01-17 04:53 +0000   person
     new branch
   
   3   10e46f2dcbf4   1970-01-16 01:06 +0000   person
@@ -106,13 +106,13 @@
   7:-1   29114dbae42b   1970-01-12 13:46 +0000   User Name <user@hostname>
     second
   
-  6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
+  6:5,4   d41e714fe50d   1970-01-18 08:40 +0000   person
     merge
   
   5:3   13207e5a10d9   1970-01-18 08:40 +0000   person
     new head
   
-  4   32a18f097fcc   1970-01-17 04:53 +0000   person
+  4   bbe44766e73d   1970-01-17 04:53 +0000   person
     new branch
   
   3   10e46f2dcbf4   1970-01-16 01:06 +0000   person
@@ -139,13 +139,13 @@
   7:-1,-1   29114dbae42b   1970-01-12 13:46 +0000   User Name <user@hostname>
     second
   
-  6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
+  6:5,4   d41e714fe50d   1970-01-18 08:40 +0000   person
     merge
   
   5:3,-1   13207e5a10d9   1970-01-18 08:40 +0000   person
     new head
   
-  4:3,-1   32a18f097fcc   1970-01-17 04:53 +0000   person
+  4:3,-1   bbe44766e73d   1970-01-17 04:53 +0000   person
     new branch
   
   3:2,-1   10e46f2dcbf4   1970-01-16 01:06 +0000   person
@@ -182,9 +182,9 @@
   <date>1970-01-12T13:46:40+00:00</date>
   <msg xml:space="preserve">second</msg>
   </logentry>
-  <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
+  <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
   <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
-  <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
+  <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
   <author email="person">person</author>
   <date>1970-01-18T08:40:01+00:00</date>
   <msg xml:space="preserve">merge</msg>
@@ -195,7 +195,7 @@
   <date>1970-01-18T08:40:00+00:00</date>
   <msg xml:space="preserve">new head</msg>
   </logentry>
-  <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
+  <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
   <branch>foo</branch>
   <author email="person">person</author>
   <date>1970-01-17T04:53:20+00:00</date>
@@ -253,9 +253,9 @@
   <path action="A">second</path>
   </paths>
   </logentry>
-  <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
+  <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
   <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
-  <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
+  <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
   <author email="person">person</author>
   <date>1970-01-18T08:40:01+00:00</date>
   <msg xml:space="preserve">merge</msg>
@@ -271,7 +271,7 @@
   <path action="A">d</path>
   </paths>
   </logentry>
-  <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
+  <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
   <branch>foo</branch>
   <author email="person">person</author>
   <date>1970-01-17T04:53:20+00:00</date>
@@ -348,9 +348,9 @@
   </paths>
   <extra key="branch">default</extra>
   </logentry>
-  <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
+  <logentry revision="6" node="d41e714fe50d9e4a5f11b4d595d543481b5f980b">
   <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
-  <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
+  <parent revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74" />
   <author email="person">person</author>
   <date>1970-01-18T08:40:01+00:00</date>
   <msg xml:space="preserve">merge</msg>
@@ -369,7 +369,7 @@
   </paths>
   <extra key="branch">default</extra>
   </logentry>
-  <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
+  <logentry revision="4" node="bbe44766e73d5f11ed2177f1838de10c53ef3e74">
   <branch>foo</branch>
   <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
   <parent revision="-1" node="0000000000000000000000000000000000000000" />
@@ -510,7 +510,7 @@
   1970-01-18  person  <person>
   
   	* merge
-  	[c7b487c6c50e]
+  	[d41e714fe50d]
   
   	* d:
   	new head
@@ -519,7 +519,7 @@
   1970-01-17  person  <person>
   
   	* new branch
-  	[32a18f097fcc] <foo>
+  	[bbe44766e73d] <foo>
   
   1970-01-16  person  <person>
   
@@ -560,12 +560,12 @@
   1970-01-18  person  <person>
   
   	* merge
-  	[c7b487c6c50e]
+  	[d41e714fe50d]
   
   1970-01-17  person  <person>
   
   	* new branch
-  	[32a18f097fcc] <foo>
+  	[bbe44766e73d] <foo>
   
 
 Keys work:
@@ -886,63 +886,63 @@
   files--debug: c
   files--debug: b
   files--debug: a
-  manifest: 8:94961b75a2da
-  manifest: 7:f2dbc354b94e
-  manifest: 6:91015e9dbdd7
-  manifest: 5:4dc3def4f9b4
-  manifest: 4:90ae8dda64e1
+  manifest: 6:94961b75a2da
+  manifest: 5:f2dbc354b94e
+  manifest: 4:4dc3def4f9b4
+  manifest: 4:4dc3def4f9b4
+  manifest: 3:cb5a1327723b
   manifest: 3:cb5a1327723b
   manifest: 2:6e0e82995c35
   manifest: 1:4e8d705b1e53
   manifest: 0:a0c8bcbbb45c
-  manifest--verbose: 8:94961b75a2da
-  manifest--verbose: 7:f2dbc354b94e
-  manifest--verbose: 6:91015e9dbdd7
-  manifest--verbose: 5:4dc3def4f9b4
-  manifest--verbose: 4:90ae8dda64e1
+  manifest--verbose: 6:94961b75a2da
+  manifest--verbose: 5:f2dbc354b94e
+  manifest--verbose: 4:4dc3def4f9b4
+  manifest--verbose: 4:4dc3def4f9b4
+  manifest--verbose: 3:cb5a1327723b
   manifest--verbose: 3:cb5a1327723b
   manifest--verbose: 2:6e0e82995c35
   manifest--verbose: 1:4e8d705b1e53
   manifest--verbose: 0:a0c8bcbbb45c
-  manifest--debug: 8:94961b75a2da554b4df6fb599e5bfc7d48de0c64
-  manifest--debug: 7:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
-  manifest--debug: 6:91015e9dbdd76a6791085d12b0a0ec7fcd22ffbf
-  manifest--debug: 5:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
-  manifest--debug: 4:90ae8dda64e1a876c792bccb9af66284f6018363
+  manifest--debug: 6:94961b75a2da554b4df6fb599e5bfc7d48de0c64
+  manifest--debug: 5:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
+  manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
+  manifest--debug: 4:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
+  manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
   manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
   manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
   manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
   manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
   node: 95c24699272ef57d062b8bccc32c878bf841784a
   node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
-  node: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
+  node: d41e714fe50d9e4a5f11b4d595d543481b5f980b
   node: 13207e5a10d9fd28ec424934298e176197f2c67f
-  node: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
+  node: bbe44766e73d5f11ed2177f1838de10c53ef3e74
   node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
   node: 97054abb4ab824450e9164180baf491ae0078465
   node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
   node: 1e4e1b8f71e05681d422154f5421e385fec3454f
   node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
   node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
-  node--verbose: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
+  node--verbose: d41e714fe50d9e4a5f11b4d595d543481b5f980b
   node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
-  node--verbose: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
+  node--verbose: bbe44766e73d5f11ed2177f1838de10c53ef3e74
   node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
   node--verbose: 97054abb4ab824450e9164180baf491ae0078465
   node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
   node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
   node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
   node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
-  node--debug: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
+  node--debug: d41e714fe50d9e4a5f11b4d595d543481b5f980b
   node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
-  node--debug: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
+  node--debug: bbe44766e73d5f11ed2177f1838de10c53ef3e74
   node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
   node--debug: 97054abb4ab824450e9164180baf491ae0078465
   node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
   node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
   parents: 
   parents: -1:000000000000 
-  parents: 5:13207e5a10d9 4:32a18f097fcc 
+  parents: 5:13207e5a10d9 4:bbe44766e73d 
   parents: 3:10e46f2dcbf4 
   parents: 
   parents: 
@@ -951,7 +951,7 @@
   parents: 
   parents--verbose: 
   parents--verbose: -1:000000000000 
-  parents--verbose: 5:13207e5a10d9 4:32a18f097fcc 
+  parents--verbose: 5:13207e5a10d9 4:bbe44766e73d 
   parents--verbose: 3:10e46f2dcbf4 
   parents--verbose: 
   parents--verbose: 
@@ -960,7 +960,7 @@
   parents--verbose: 
   parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000 
   parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000 
-  parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:32a18f097fcccf76ef282f62f8a85b3adf8d13c4 
+  parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74 
   parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000 
   parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000 
   parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000 
@@ -1174,9 +1174,9 @@
   $ hg log --template '{node|short}\n'
   95c24699272e
   29114dbae42b
-  c7b487c6c50e
+  d41e714fe50d
   13207e5a10d9
-  32a18f097fcc
+  bbe44766e73d
   10e46f2dcbf4
   97054abb4ab8
   b608e9d1a3f0
@@ -1197,9 +1197,9 @@
   8: 
   7: 8:95c24699272e
   6: 
-  5: 6:c7b487c6c50e
-  4: 6:c7b487c6c50e
-  3: 4:32a18f097fcc 5:13207e5a10d9
+  5: 6:d41e714fe50d
+  4: 6:d41e714fe50d
+  3: 4:bbe44766e73d 5:13207e5a10d9
   2: 3:10e46f2dcbf4
   1: 2:97054abb4ab8
   0: 1:b608e9d1a3f0
--- a/tests/test-convert-svn-branches.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-convert-svn-branches.t	Wed May 04 08:21:50 2011 -0500
@@ -83,10 +83,10 @@
   
 
   $ hg branches
-  newbranch                     11:08fca3ff8634
-  default                       10:098988aa63ba
-  old                            9:b308f345079b
-  old2                           8:49f2336c7b8b (inactive)
+  newbranch                     11:a6d7cc050ad1
+  default                       10:6e2b33404495
+  old                            9:93c4b0f99529
+  old2                           8:b52884d7bead (inactive)
   $ hg tags -q
   tip
   $ cd ..
--- a/tests/test-convert-svn-encoding.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-convert-svn-encoding.t	Wed May 04 08:21:50 2011 -0500
@@ -129,7 +129,7 @@
 Check tags are in UTF-8
 
   $ cat .hgtags
-  221c3fdaf24df5f14c0a64c597581e2eacfb47bb branch\xc3\xa9e (esc)
-  7a40952c2db29cf00d9e31df3749e98d8a4bdcbf branch\xc3\xa9 (esc)
+  e94e4422020e715add80525e8f0f46c9968689f1 branch\xc3\xa9e (esc)
+  f7e66f98380ed1e53a797c5c7a7a2616a7ab377d branch\xc3\xa9 (esc)
 
   $ cd ..
--- a/tests/test-debugbuilddag.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-debugbuilddag.t	Wed May 04 08:21:50 2011 -0500
@@ -1,12 +1,16 @@
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "graphlog=" >> $HGRCPATH
 
-overwritten and appended files
+plain
 
   $ rm -rf repo
   $ hg init repo
   $ cd repo
-  $ hg debugbuilddag '+2:f +3:p2 @temp <f+4 @default /p2 +2' -q -oa
+  $ hg debugbuilddag '+2:f +3:p2 @temp <f+4 @default /p2 +2'
+tags
+  $ cat .hg/localtags
+  66f7d451a68b85ed82ff5fcc254daf50c74144bd f
+  bebd167eb94d257ace0e814aeb98e6972ed2970d p2
 dag
   $ hg debugdag -t -b
   +2:f
@@ -15,10 +19,56 @@
   @default*/p2+2:tip
 tip
   $ hg id
-  f96e381c614c tip
+  000000000000
 glog
   $ hg glog --template '{rev}: {desc} [{branches}] @ {date}\n'
-  @  11: r11 [] @ 11.00
+  o  11: r11 [] @ 11.00
+  |
+  o  10: r10 [] @ 10.00
+  |
+  o    9: r9 [] @ 9.00
+  |\
+  | o  8: r8 [temp] @ 8.00
+  | |
+  | o  7: r7 [temp] @ 7.00
+  | |
+  | o  6: r6 [temp] @ 6.00
+  | |
+  | o  5: r5 [temp] @ 5.00
+  | |
+  o |  4: r4 [] @ 4.00
+  | |
+  o |  3: r3 [] @ 3.00
+  | |
+  o |  2: r2 [] @ 2.00
+  |/
+  o  1: r1 [] @ 1.00
+  |
+  o  0: r0 [] @ 0.00
+  
+
+overwritten files
+
+  $ rm -rf repo
+  $ hg init repo
+  $ cd repo
+  $ hg debugbuilddag '+2:f +3:p2 @temp <f+4 @default /p2 +2' -q -o
+tags
+  $ cat .hg/localtags
+  2a8ed67d317e370eac733dccc501b12d7b9c441a f
+  4226a30965b7af58f94d0cda7e6c2c9c63e6bf90 p2
+dag
+  $ hg debugdag -t -b
+  +2:f
+  +3:p2
+  @temp*f+3
+  @default*/p2+2:tip
+tip
+  $ hg id
+  000000000000
+glog
+  $ hg glog --template '{rev}: {desc} [{branches}] @ {date}\n'
+  o  11: r11 [] @ 11.00
   |
   o  10: r10 [] @ 10.00
   |
@@ -44,33 +94,7 @@
   
 glog of
   $ hg glog --template '{rev}: {desc} [{branches}]\n' of
-  @  11: r11 []
-  |
-  o  10: r10 []
-  |
-  o    9: r9 []
-  |\
-  | o  8: r8 [temp]
-  | |
-  | o  7: r7 [temp]
-  | |
-  | o  6: r6 [temp]
-  | |
-  | o  5: r5 [temp]
-  | |
-  o |  4: r4 []
-  | |
-  o |  3: r3 []
-  | |
-  o |  2: r2 []
-  |/
-  o  1: r1 []
-  |
-  o  0: r0 []
-  
-glog af
-  $ hg glog --template '{rev}: {desc} [{branches}]\n' af
-  @  11: r11 []
+  o  11: r11 []
   |
   o  10: r10 []
   |
@@ -96,25 +120,15 @@
   
 tags
   $ hg tags -v
-  tip                               11:f96e381c614c
-  p2                                 4:d9d6db981b55 local
-  f                                  1:73253def624e local
+  tip                               11:58a51e5eb988
+  p2                                 4:4226a30965b7 local
+  f                                  1:2a8ed67d317e local
 cat of
-  $ hg cat of
-  r11
-cat af
-  $ hg cat af
-  r0
-  r1
-  r5
-  r6
-  r7
-  r8
-  r9
-  r10
+  $ hg cat of --rev tip
   r11
   $ cd ..
 
+
 new and mergeable files
 
   $ rm -rf repo
@@ -129,10 +143,10 @@
   @default*/p2+2:tip
 tip
   $ hg id
-  9c5ce9b70771 tip
+  000000000000
 glog
   $ hg glog --template '{rev}: {desc} [{branches}] @ {date}\n'
-  @  11: r11 [] @ 11.00
+  o  11: r11 [] @ 11.00
   |
   o  10: r10 [] @ 10.00
   |
@@ -158,7 +172,7 @@
   
 glog mf
   $ hg glog --template '{rev}: {desc} [{branches}]\n' mf
-  @  11: r11 []
+  o  11: r11 []
   |
   o  10: r10 []
   |
@@ -253,7 +267,7 @@
   22
   23
 man
-  $ hg manifest
+  $ hg manifest --rev tip
   mf
   nf0
   nf1
@@ -268,7 +282,7 @@
   nf8
   nf9
 cat mf
-  $ hg cat mf
+  $ hg cat mf --rev tip
   0 r0
   1
   2 r1
@@ -295,27 +309,5 @@
   23
   $ cd ..
 
-command
 
-  $ rm -rf repo
-  $ hg init repo
-  $ cd repo
-  $ hg debugbuilddag '+2 !"touch X" +2' -q -o
-dag
-  $ hg debugdag -t -b
-  +4:tip
-glog
-  $ hg glog --template '{rev}: {desc} [{branches}]\n'
-  @  3: r3 []
-  |
-  o  2: r2 []
-  |
-  o  1: r1 []
-  |
-  o  0: r0 []
-  
-glog X
-  $ hg glog --template '{rev}: {desc} [{branches}]\n' X
-  o  2: r2 []
-  |
-  $ cd ..
+
--- a/tests/test-debugcomplete.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-debugcomplete.t	Wed May 04 08:21:50 2011 -0500
@@ -75,6 +75,7 @@
   debugdag
   debugdata
   debugdate
+  debugdiscovery
   debugfsinfo
   debuggetbundle
   debugignore
@@ -211,7 +212,7 @@
   cat: output, rev, decode, include, exclude
   copy: after, force, include, exclude, dry-run
   debugancestor: 
-  debugbuilddag: mergeable-file, appended-file, overwritten-file, new-file
+  debugbuilddag: mergeable-file, overwritten-file, new-file
   debugbundle: all
   debugcheckstate: 
   debugcommands: 
@@ -219,6 +220,7 @@
   debugdag: tags, branches, dots, spaces
   debugdata: 
   debugdate: extended
+  debugdiscovery: old, nonheads, ssh, remotecmd, insecure
   debugfsinfo: 
   debuggetbundle: head, common, type
   debugignore: 
--- a/tests/test-empty-group.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-empty-group.t	Wed May 04 08:21:50 2011 -0500
@@ -67,7 +67,7 @@
   $ hg -R a outgoing b
   comparing with b
   searching for changes
-  changeset:   4:119caaef4ed1
+  changeset:   4:1ec3c74fc0e0
   tag:         tip
   parent:      1:79f9e10cd04e
   parent:      2:8e1bb01c1a24
@@ -78,7 +78,7 @@
   $ hg -R a outgoing c
   comparing with c
   searching for changes
-  changeset:   3:cbb48b367d1b
+  changeset:   3:d15a0c284984
   parent:      2:8e1bb01c1a24
   parent:      1:79f9e10cd04e
   user:        test
@@ -88,7 +88,7 @@
   $ hg -R b outgoing c
   comparing with c
   searching for changes
-  changeset:   3:cbb48b367d1b
+  changeset:   3:d15a0c284984
   tag:         tip
   parent:      2:8e1bb01c1a24
   parent:      1:79f9e10cd04e
@@ -99,7 +99,7 @@
   $ hg -R c outgoing b
   comparing with b
   searching for changes
-  changeset:   3:119caaef4ed1
+  changeset:   3:1ec3c74fc0e0
   tag:         tip
   parent:      1:79f9e10cd04e
   parent:      2:8e1bb01c1a24
--- a/tests/test-encoding.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-encoding.t	Wed May 04 08:21:50 2011 -0500
@@ -48,7 +48,7 @@
 hg log (ascii)
 
   $ hg --encoding ascii log
-  changeset:   5:093c6077d1c8
+  changeset:   5:a52c0692f24a
   branch:      ?
   tag:         tip
   user:        test
@@ -85,7 +85,7 @@
 hg log (latin-1)
 
   $ hg --encoding latin-1 log
-  changeset:   5:093c6077d1c8
+  changeset:   5:a52c0692f24a
   branch:      \xe9 (esc)
   tag:         tip
   user:        test
@@ -122,7 +122,7 @@
 hg log (utf-8)
 
   $ hg --encoding utf-8 log
-  changeset:   5:093c6077d1c8
+  changeset:   5:a52c0692f24a
   branch:      \xc3\xa9 (esc)
   tag:         tip
   user:        test
@@ -159,37 +159,37 @@
 hg tags (ascii)
 
   $ HGENCODING=ascii hg tags
-  tip                                5:093c6077d1c8
+  tip                                5:a52c0692f24a
   ?                                  3:ca661e7520de
 
 hg tags (latin-1)
 
   $ HGENCODING=latin-1 hg tags
-  tip                                5:093c6077d1c8
+  tip                                5:a52c0692f24a
   \xe9                                  3:ca661e7520de (esc)
 
 hg tags (utf-8)
 
   $ HGENCODING=utf-8 hg tags
-  tip                                5:093c6077d1c8
+  tip                                5:a52c0692f24a
   \xc3\xa9                                  3:ca661e7520de (esc)
 
 hg branches (ascii)
 
   $ HGENCODING=ascii hg branches
-  ?                              5:093c6077d1c8
+  ?                              5:a52c0692f24a
   default                        4:94db611b4196 (inactive)
 
 hg branches (latin-1)
 
   $ HGENCODING=latin-1 hg branches
-  \xe9                              5:093c6077d1c8 (esc)
+  \xe9                              5:a52c0692f24a (esc)
   default                        4:94db611b4196 (inactive)
 
 hg branches (utf-8)
 
   $ HGENCODING=utf-8 hg branches
-  \xc3\xa9                              5:093c6077d1c8 (esc)
+  \xc3\xa9                              5:a52c0692f24a (esc)
   default                        4:94db611b4196 (inactive)
   $ echo '[ui]' >> .hg/hgrc
   $ echo 'fallbackencoding = koi8-r' >> .hg/hgrc
@@ -197,7 +197,7 @@
 hg log (utf-8)
 
   $ HGENCODING=utf-8 hg log
-  changeset:   5:093c6077d1c8
+  changeset:   5:a52c0692f24a
   branch:      \xc3\xa9 (esc)
   tag:         tip
   user:        test
--- a/tests/test-getbundle.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-getbundle.t	Wed May 04 08:21:50 2011 -0500
@@ -12,41 +12,41 @@
   $ cd repo
   $ hg debugbuilddag -n -m '+2 :fork +5 :p1 *fork +6 :p2 /p1 :m1 +3' > /dev/null
   $ hg glog --template '{node}\n'
-  @  2bba2f40f321484159b395a43f20101d4bb7ead0
+  o  10c14a2cc935e1d8c31f9e98587dcf27fb08a6da
   |
-  o  d9e5488323c782fe684573f3043369d199038b6f
+  o  4801a72e5d88cb515b0c7e40fae34180f3f837f2
   |
-  o  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
+  o  0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3
   |
-  o    733bf0910832b26b768a09172f325f995b5476e1
+  o    8365676dbab05860ce0d9110f2af51368b961bbd
   |\
-  | o  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
+  | o  5686dbbd9fc46cb806599c878d02fe1cb56b83d3
   | |
-  | o  6b57ee934bb2996050540f84cdfc8dcad1e7267d
+  | o  13c0170174366b441dc68e8e33757232fa744458
   | |
-  | o  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
+  | o  63476832d8ec6558cf9bbe3cbe0c757e5cf18043
   | |
-  | o  c1818a9f5977dd4139a48f93f5425c67d44a9368
+  | o  700b7e19db54103633c4bf4a6a6b6d55f4d50c03
   | |
-  | o  6c725a58ad10aea441540bfd06c507f63e8b9cdd
+  | o  928b5f94cdb278bb536eba552de348a4e92ef24d
   | |
-  | o  18063366a155bd56b5618229ae2ac3e91849aa5e
+  | o  f34414c64173e0ecb61b25dc55e116dbbcc89bee
   | |
-  | o  a21d913c992197a2eb60b298521ec0f045a04799
+  | o  8931463777131cd73923e560b760061f2aa8a4bc
   | |
-  o |  b6b2b682253df2ffedc10e9415e4114202b303c5
+  o |  6621d79f61b23ec74cf4b69464343d9e0980ec8b
   | |
-  o |  2114148793524fd045998f71a45b0aaf139f752b
+  o |  bac16991d12ff45f9dc43c52da1946dfadb83e80
   | |
-  o |  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
+  o |  ff42371d57168345fdf1a3aac66a51f6a45d41d2
   | |
-  o |  ea919464b16e003894c48b6cb68df3cd9411b544
+  o |  d5f6e1ea452285324836a49d7d3c2a63cfed1d31
   | |
-  o |  0f82d97ec2778746743fbc996740d409558fda22
+  o |  713346a995c363120712aed1aee7e04afd867638
   |/
-  o  6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
+  o  29a4d1f17bd3f0779ca0525bebb1cfb51067c738
   |
-  o  10e64d654571f11577745b4d8372e859d9e4df63
+  o  7704483d56b2a7b5db54dcee7c62378ac629b348
   
   $ cd ..
 
@@ -57,62 +57,62 @@
 
   $ hg debuggetbundle repo bundle
   $ hg debugbundle bundle
-  10e64d654571f11577745b4d8372e859d9e4df63
-  6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
-  0f82d97ec2778746743fbc996740d409558fda22
-  ea919464b16e003894c48b6cb68df3cd9411b544
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
-  2114148793524fd045998f71a45b0aaf139f752b
-  b6b2b682253df2ffedc10e9415e4114202b303c5
-  a21d913c992197a2eb60b298521ec0f045a04799
-  18063366a155bd56b5618229ae2ac3e91849aa5e
-  6c725a58ad10aea441540bfd06c507f63e8b9cdd
-  c1818a9f5977dd4139a48f93f5425c67d44a9368
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d
-  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
-  733bf0910832b26b768a09172f325f995b5476e1
-  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
-  d9e5488323c782fe684573f3043369d199038b6f
-  2bba2f40f321484159b395a43f20101d4bb7ead0
+  7704483d56b2a7b5db54dcee7c62378ac629b348
+  29a4d1f17bd3f0779ca0525bebb1cfb51067c738
+  713346a995c363120712aed1aee7e04afd867638
+  d5f6e1ea452285324836a49d7d3c2a63cfed1d31
+  ff42371d57168345fdf1a3aac66a51f6a45d41d2
+  bac16991d12ff45f9dc43c52da1946dfadb83e80
+  6621d79f61b23ec74cf4b69464343d9e0980ec8b
+  8931463777131cd73923e560b760061f2aa8a4bc
+  f34414c64173e0ecb61b25dc55e116dbbcc89bee
+  928b5f94cdb278bb536eba552de348a4e92ef24d
+  700b7e19db54103633c4bf4a6a6b6d55f4d50c03
+  63476832d8ec6558cf9bbe3cbe0c757e5cf18043
+  13c0170174366b441dc68e8e33757232fa744458
+  5686dbbd9fc46cb806599c878d02fe1cb56b83d3
+  8365676dbab05860ce0d9110f2af51368b961bbd
+  0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3
+  4801a72e5d88cb515b0c7e40fae34180f3f837f2
+  10c14a2cc935e1d8c31f9e98587dcf27fb08a6da
 
 Get part of linear run:
 
-  $ hg debuggetbundle repo bundle -H d9e5488323c782fe684573f3043369d199038b6f -C 733bf0910832b26b768a09172f325f995b5476e1
+  $ hg debuggetbundle repo bundle -H 4801a72e5d88cb515b0c7e40fae34180f3f837f2 -C 8365676dbab05860ce0d9110f2af51368b961bbd
   $ hg debugbundle bundle
-  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
-  d9e5488323c782fe684573f3043369d199038b6f
+  0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3
+  4801a72e5d88cb515b0c7e40fae34180f3f837f2
 
 Get missing branch and merge:
 
-  $ hg debuggetbundle repo bundle -H d9e5488323c782fe684573f3043369d199038b6f -C 6b57ee934bb2996050540f84cdfc8dcad1e7267d
+  $ hg debuggetbundle repo bundle -H 4801a72e5d88cb515b0c7e40fae34180f3f837f2 -C 13c0170174366b441dc68e8e33757232fa744458
   $ hg debugbundle bundle
-  0f82d97ec2778746743fbc996740d409558fda22
-  ea919464b16e003894c48b6cb68df3cd9411b544
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
-  2114148793524fd045998f71a45b0aaf139f752b
-  b6b2b682253df2ffedc10e9415e4114202b303c5
-  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
-  733bf0910832b26b768a09172f325f995b5476e1
-  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
-  d9e5488323c782fe684573f3043369d199038b6f
+  713346a995c363120712aed1aee7e04afd867638
+  d5f6e1ea452285324836a49d7d3c2a63cfed1d31
+  ff42371d57168345fdf1a3aac66a51f6a45d41d2
+  bac16991d12ff45f9dc43c52da1946dfadb83e80
+  6621d79f61b23ec74cf4b69464343d9e0980ec8b
+  5686dbbd9fc46cb806599c878d02fe1cb56b83d3
+  8365676dbab05860ce0d9110f2af51368b961bbd
+  0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3
+  4801a72e5d88cb515b0c7e40fae34180f3f837f2
 
 Get from only one head:
 
-  $ hg debuggetbundle repo bundle -H 6c725a58ad10aea441540bfd06c507f63e8b9cdd -C 6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
+  $ hg debuggetbundle repo bundle -H 928b5f94cdb278bb536eba552de348a4e92ef24d -C 29a4d1f17bd3f0779ca0525bebb1cfb51067c738
   $ hg debugbundle bundle
-  a21d913c992197a2eb60b298521ec0f045a04799
-  18063366a155bd56b5618229ae2ac3e91849aa5e
-  6c725a58ad10aea441540bfd06c507f63e8b9cdd
+  8931463777131cd73923e560b760061f2aa8a4bc
+  f34414c64173e0ecb61b25dc55e116dbbcc89bee
+  928b5f94cdb278bb536eba552de348a4e92ef24d
 
 Get parts of two branches:
 
-  $ hg debuggetbundle repo bundle -H 6b57ee934bb2996050540f84cdfc8dcad1e7267d -C c1818a9f5977dd4139a48f93f5425c67d44a9368 -H 2114148793524fd045998f71a45b0aaf139f752b -C ea919464b16e003894c48b6cb68df3cd9411b544
+  $ hg debuggetbundle repo bundle -H 13c0170174366b441dc68e8e33757232fa744458 -C 700b7e19db54103633c4bf4a6a6b6d55f4d50c03 -H bac16991d12ff45f9dc43c52da1946dfadb83e80 -C d5f6e1ea452285324836a49d7d3c2a63cfed1d31
   $ hg debugbundle bundle
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
-  2114148793524fd045998f71a45b0aaf139f752b
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d
+  ff42371d57168345fdf1a3aac66a51f6a45d41d2
+  bac16991d12ff45f9dc43c52da1946dfadb83e80
+  63476832d8ec6558cf9bbe3cbe0c757e5cf18043
+  13c0170174366b441dc68e8e33757232fa744458
 
 Check that we get all needed file changes:
 
@@ -120,54 +120,54 @@
   format: id, p1, p2, cset, delta base, len(delta)
   
   changelog
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 99
-  2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 2114148793524fd045998f71a45b0aaf139f752b 102
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
+  ff42371d57168345fdf1a3aac66a51f6a45d41d2 d5f6e1ea452285324836a49d7d3c2a63cfed1d31 0000000000000000000000000000000000000000 ff42371d57168345fdf1a3aac66a51f6a45d41d2 d5f6e1ea452285324836a49d7d3c2a63cfed1d31 99
+  bac16991d12ff45f9dc43c52da1946dfadb83e80 ff42371d57168345fdf1a3aac66a51f6a45d41d2 0000000000000000000000000000000000000000 bac16991d12ff45f9dc43c52da1946dfadb83e80 ff42371d57168345fdf1a3aac66a51f6a45d41d2 99
+  63476832d8ec6558cf9bbe3cbe0c757e5cf18043 700b7e19db54103633c4bf4a6a6b6d55f4d50c03 0000000000000000000000000000000000000000 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 bac16991d12ff45f9dc43c52da1946dfadb83e80 102
+  13c0170174366b441dc68e8e33757232fa744458 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 0000000000000000000000000000000000000000 13c0170174366b441dc68e8e33757232fa744458 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 102
   
   manifest
-  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 591f732a3faf1fb903815273f3c199a514a61ccb 113
-  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b dac7984588fc4eea7acbf39693a9c1b06f5b175d 113
-  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0772616e6b48a76afb6c1458e193cbb3dae2e4ff 295
-  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d eb498cd9af6c44108e43041e951ce829e29f6c80 114
+  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 ff42371d57168345fdf1a3aac66a51f6a45d41d2 591f732a3faf1fb903815273f3c199a514a61ccb 113
+  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 bac16991d12ff45f9dc43c52da1946dfadb83e80 dac7984588fc4eea7acbf39693a9c1b06f5b175d 113
+  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 0772616e6b48a76afb6c1458e193cbb3dae2e4ff 295
+  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 13c0170174366b441dc68e8e33757232fa744458 eb498cd9af6c44108e43041e951ce829e29f6c80 114
   
   mf
-  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 17
-  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 18
-  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c7b583de053293870e145f45bd2d61643563fd06 149
-  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 266ee3c0302a5a18f1cf96817ac79a51836179e9 19
+  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 ff42371d57168345fdf1a3aac66a51f6a45d41d2 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 17
+  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 bac16991d12ff45f9dc43c52da1946dfadb83e80 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 18
+  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 c7b583de053293870e145f45bd2d61643563fd06 149
+  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 13c0170174366b441dc68e8e33757232fa744458 266ee3c0302a5a18f1cf96817ac79a51836179e9 19
   
   nf11
-  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 16
+  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 0000000000000000000000000000000000000000 16
   
   nf12
-  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 0000000000000000000000000000000000000000 16
+  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 13c0170174366b441dc68e8e33757232fa744458 0000000000000000000000000000000000000000 16
   
   nf4
-  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 15
+  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 ff42371d57168345fdf1a3aac66a51f6a45d41d2 0000000000000000000000000000000000000000 15
   
   nf5
-  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 0000000000000000000000000000000000000000 15
+  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 bac16991d12ff45f9dc43c52da1946dfadb83e80 0000000000000000000000000000000000000000 15
 
 Get branch and merge:
 
-  $ hg debuggetbundle repo bundle -C 10e64d654571f11577745b4d8372e859d9e4df63 -H 6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
+  $ hg debuggetbundle repo bundle -C 7704483d56b2a7b5db54dcee7c62378ac629b348 -H 0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3
   $ hg debugbundle bundle
-  6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
-  0f82d97ec2778746743fbc996740d409558fda22
-  ea919464b16e003894c48b6cb68df3cd9411b544
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
-  2114148793524fd045998f71a45b0aaf139f752b
-  b6b2b682253df2ffedc10e9415e4114202b303c5
-  a21d913c992197a2eb60b298521ec0f045a04799
-  18063366a155bd56b5618229ae2ac3e91849aa5e
-  6c725a58ad10aea441540bfd06c507f63e8b9cdd
-  c1818a9f5977dd4139a48f93f5425c67d44a9368
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d
-  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
-  733bf0910832b26b768a09172f325f995b5476e1
-  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
+  29a4d1f17bd3f0779ca0525bebb1cfb51067c738
+  713346a995c363120712aed1aee7e04afd867638
+  d5f6e1ea452285324836a49d7d3c2a63cfed1d31
+  ff42371d57168345fdf1a3aac66a51f6a45d41d2
+  bac16991d12ff45f9dc43c52da1946dfadb83e80
+  6621d79f61b23ec74cf4b69464343d9e0980ec8b
+  8931463777131cd73923e560b760061f2aa8a4bc
+  f34414c64173e0ecb61b25dc55e116dbbcc89bee
+  928b5f94cdb278bb536eba552de348a4e92ef24d
+  700b7e19db54103633c4bf4a6a6b6d55f4d50c03
+  63476832d8ec6558cf9bbe3cbe0c757e5cf18043
+  13c0170174366b441dc68e8e33757232fa744458
+  5686dbbd9fc46cb806599c878d02fe1cb56b83d3
+  8365676dbab05860ce0d9110f2af51368b961bbd
+  0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3
 
 
 = Test via HTTP =
@@ -178,33 +178,33 @@
   $ cat hg.pid >> $DAEMON_PIDS
   $ hg debuggetbundle http://localhost:$HGPORT/ bundle
   $ hg debugbundle bundle
-  10e64d654571f11577745b4d8372e859d9e4df63
-  6e23b016bc0f0e79c7bd9dd372ccee07055d7fd4
-  0f82d97ec2778746743fbc996740d409558fda22
-  ea919464b16e003894c48b6cb68df3cd9411b544
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
-  2114148793524fd045998f71a45b0aaf139f752b
-  b6b2b682253df2ffedc10e9415e4114202b303c5
-  a21d913c992197a2eb60b298521ec0f045a04799
-  18063366a155bd56b5618229ae2ac3e91849aa5e
-  6c725a58ad10aea441540bfd06c507f63e8b9cdd
-  c1818a9f5977dd4139a48f93f5425c67d44a9368
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d
-  b5af5d6ea56d73ce24c40bc3cd19a862f74888ac
-  733bf0910832b26b768a09172f325f995b5476e1
-  6e9a5adf5437e49c746288cf95c5ac34fa8f2f72
-  d9e5488323c782fe684573f3043369d199038b6f
-  2bba2f40f321484159b395a43f20101d4bb7ead0
+  7704483d56b2a7b5db54dcee7c62378ac629b348
+  29a4d1f17bd3f0779ca0525bebb1cfb51067c738
+  713346a995c363120712aed1aee7e04afd867638
+  d5f6e1ea452285324836a49d7d3c2a63cfed1d31
+  ff42371d57168345fdf1a3aac66a51f6a45d41d2
+  bac16991d12ff45f9dc43c52da1946dfadb83e80
+  6621d79f61b23ec74cf4b69464343d9e0980ec8b
+  8931463777131cd73923e560b760061f2aa8a4bc
+  f34414c64173e0ecb61b25dc55e116dbbcc89bee
+  928b5f94cdb278bb536eba552de348a4e92ef24d
+  700b7e19db54103633c4bf4a6a6b6d55f4d50c03
+  63476832d8ec6558cf9bbe3cbe0c757e5cf18043
+  13c0170174366b441dc68e8e33757232fa744458
+  5686dbbd9fc46cb806599c878d02fe1cb56b83d3
+  8365676dbab05860ce0d9110f2af51368b961bbd
+  0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3
+  4801a72e5d88cb515b0c7e40fae34180f3f837f2
+  10c14a2cc935e1d8c31f9e98587dcf27fb08a6da
 
 Get parts of two branches:
 
-  $ hg debuggetbundle http://localhost:$HGPORT/ bundle -H 6b57ee934bb2996050540f84cdfc8dcad1e7267d -C c1818a9f5977dd4139a48f93f5425c67d44a9368 -H 2114148793524fd045998f71a45b0aaf139f752b -C ea919464b16e003894c48b6cb68df3cd9411b544
+  $ hg debuggetbundle http://localhost:$HGPORT/ bundle -H 13c0170174366b441dc68e8e33757232fa744458 -C 700b7e19db54103633c4bf4a6a6b6d55f4d50c03 -H bac16991d12ff45f9dc43c52da1946dfadb83e80 -C d5f6e1ea452285324836a49d7d3c2a63cfed1d31
   $ hg debugbundle bundle
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc
-  2114148793524fd045998f71a45b0aaf139f752b
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d
+  ff42371d57168345fdf1a3aac66a51f6a45d41d2
+  bac16991d12ff45f9dc43c52da1946dfadb83e80
+  63476832d8ec6558cf9bbe3cbe0c757e5cf18043
+  13c0170174366b441dc68e8e33757232fa744458
 
 Check that we get all needed file changes:
 
@@ -212,34 +212,34 @@
   format: id, p1, p2, cset, delta base, len(delta)
   
   changelog
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 99
-  2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 2114148793524fd045998f71a45b0aaf139f752b 102
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
+  ff42371d57168345fdf1a3aac66a51f6a45d41d2 d5f6e1ea452285324836a49d7d3c2a63cfed1d31 0000000000000000000000000000000000000000 ff42371d57168345fdf1a3aac66a51f6a45d41d2 d5f6e1ea452285324836a49d7d3c2a63cfed1d31 99
+  bac16991d12ff45f9dc43c52da1946dfadb83e80 ff42371d57168345fdf1a3aac66a51f6a45d41d2 0000000000000000000000000000000000000000 bac16991d12ff45f9dc43c52da1946dfadb83e80 ff42371d57168345fdf1a3aac66a51f6a45d41d2 99
+  63476832d8ec6558cf9bbe3cbe0c757e5cf18043 700b7e19db54103633c4bf4a6a6b6d55f4d50c03 0000000000000000000000000000000000000000 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 bac16991d12ff45f9dc43c52da1946dfadb83e80 102
+  13c0170174366b441dc68e8e33757232fa744458 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 0000000000000000000000000000000000000000 13c0170174366b441dc68e8e33757232fa744458 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 102
   
   manifest
-  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 591f732a3faf1fb903815273f3c199a514a61ccb 113
-  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b dac7984588fc4eea7acbf39693a9c1b06f5b175d 113
-  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0772616e6b48a76afb6c1458e193cbb3dae2e4ff 295
-  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d eb498cd9af6c44108e43041e951ce829e29f6c80 114
+  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 ff42371d57168345fdf1a3aac66a51f6a45d41d2 591f732a3faf1fb903815273f3c199a514a61ccb 113
+  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 bac16991d12ff45f9dc43c52da1946dfadb83e80 dac7984588fc4eea7acbf39693a9c1b06f5b175d 113
+  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 0772616e6b48a76afb6c1458e193cbb3dae2e4ff 295
+  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 13c0170174366b441dc68e8e33757232fa744458 eb498cd9af6c44108e43041e951ce829e29f6c80 114
   
   mf
-  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 17
-  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 18
-  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c7b583de053293870e145f45bd2d61643563fd06 149
-  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 266ee3c0302a5a18f1cf96817ac79a51836179e9 19
+  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 ff42371d57168345fdf1a3aac66a51f6a45d41d2 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 17
+  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 bac16991d12ff45f9dc43c52da1946dfadb83e80 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 18
+  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 c7b583de053293870e145f45bd2d61643563fd06 149
+  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 13c0170174366b441dc68e8e33757232fa744458 266ee3c0302a5a18f1cf96817ac79a51836179e9 19
   
   nf11
-  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 16
+  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 0000000000000000000000000000000000000000 16
   
   nf12
-  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 0000000000000000000000000000000000000000 16
+  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 13c0170174366b441dc68e8e33757232fa744458 0000000000000000000000000000000000000000 16
   
   nf4
-  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 15
+  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 ff42371d57168345fdf1a3aac66a51f6a45d41d2 0000000000000000000000000000000000000000 15
   
   nf5
-  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 0000000000000000000000000000000000000000 15
+  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 bac16991d12ff45f9dc43c52da1946dfadb83e80 0000000000000000000000000000000000000000 15
 
 Verify we hit the HTTP server:
 
@@ -247,7 +247,7 @@
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
   * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - (glob)
   * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
-  * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=c1818a9f5977dd4139a48f93f5425c67d44a9368+ea919464b16e003894c48b6cb68df3cd9411b544&heads=6b57ee934bb2996050540f84cdfc8dcad1e7267d+2114148793524fd045998f71a45b0aaf139f752b (glob)
+  * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=700b7e19db54103633c4bf4a6a6b6d55f4d50c03+d5f6e1ea452285324836a49d7d3c2a63cfed1d31&heads=13c0170174366b441dc68e8e33757232fa744458+bac16991d12ff45f9dc43c52da1946dfadb83e80 (glob)
 
   $ cat error.log
 
--- a/tests/test-hook.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-hook.t	Wed May 04 08:21:50 2011 -0500
@@ -189,7 +189,7 @@
   $ hg pull -B bar ../a
   pulling from ../a
   listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} 
-  searching for changes
+  no changes found
   listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} 
   importing bookmark bar
   $ cd ../a
--- a/tests/test-http.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-http.t	Wed May 04 08:21:50 2011 -0500
@@ -70,6 +70,24 @@
   adding bar
   $ cd ..
 
+incoming via HTTP
+
+  $ hg clone http://localhost:$HGPORT1/ --rev 0 partial
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 4 changes to 4 files
+  updating to branch default
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd partial
+  $ touch LOCAL
+  $ hg ci -qAm LOCAL
+  $ hg incoming http://localhost:$HGPORT1/ --template '{desc}\n'
+  comparing with http://localhost:$HGPORT1/
+  searching for changes
+  2
+  $ cd ..
+
 pull
 
   $ cd copy-pull
--- a/tests/test-issue1306.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-issue1306.t	Wed May 04 08:21:50 2011 -0500
@@ -18,14 +18,14 @@
   adding c
 
   $ hg log
-  changeset:   2:1630aed6ed2b
+  changeset:   2:ae3d9c30ec50
   branch:      br
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     c
   
-  changeset:   1:234f53e6c5ff
+  changeset:   1:3f7f930ca414
   branch:      br
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -50,7 +50,7 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg -R local1 parents
-  changeset:   2:1630aed6ed2b
+  changeset:   2:ae3d9c30ec50
   branch:      br
   tag:         tip
   user:        test
@@ -86,7 +86,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
   $ hg -R local3 parents
-  changeset:   1:234f53e6c5ff
+  changeset:   1:3f7f930ca414
   branch:      br
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
--- a/tests/test-keyword.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-keyword.t	Wed May 04 08:21:50 2011 -0500
@@ -982,7 +982,7 @@
   $ HGMERGE=internal:local hg resolve -a
   $ hg commit -m localresolve
   $ cat m
-  $Id: m 41efa6d38e9b Thu, 01 Jan 1970 00:00:00 +0000 test $
+  $Id: m 800511b3a22d Thu, 01 Jan 1970 00:00:00 +0000 test $
   bar
 
 Test restricted mode with transplant -b
@@ -1000,19 +1000,19 @@
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg -y transplant -b foo tip
   applying 4aa30d025d50
-  4aa30d025d50 transplanted to 5a4da427c162
+  4aa30d025d50 transplanted to e00abbf63521
 
 Expansion in changeset but not in file
 
   $ hg tip -p
-  changeset:   11:5a4da427c162
+  changeset:   11:e00abbf63521
   tag:         tip
-  parent:      9:41efa6d38e9b
+  parent:      9:800511b3a22d
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     9foobranch
   
-  diff -r 41efa6d38e9b -r 5a4da427c162 a
+  diff -r 800511b3a22d -r e00abbf63521 a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,3 +1,4 @@
@@ -1023,7 +1023,7 @@
   
   $ head -n 2 a
   foobranch
-  expand $Id: a 5a4da427c162 Thu, 01 Jan 1970 00:00:00 +0000 test $
+  expand $Id: a e00abbf63521 Thu, 01 Jan 1970 00:00:00 +0000 test $
 
 Turn off expansion
 
--- a/tests/test-mq-qdelete.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-mq-qdelete.t	Wed May 04 08:21:50 2011 -0500
@@ -8,77 +8,77 @@
   $ hg ci -Ambase -d '1 0'
   adding base
 
-  $ hg qnew -d '1 0' a
-  $ hg qnew -d '1 0' b
-  $ hg qnew -d '1 0' c
+  $ hg qnew -d '1 0' pa
+  $ hg qnew -d '1 0' pb
+  $ hg qnew -d '1 0' pc
 
   $ hg qdel
   abort: qdelete requires at least one revision or patch name
   [255]
 
-  $ hg qdel c
-  abort: cannot delete applied patch c
+  $ hg qdel pc
+  abort: cannot delete applied patch pc
   [255]
 
   $ hg qpop
-  popping c
-  now at: b
+  popping pc
+  now at: pb
 
 Delete the same patch twice in one command (issue2427)
 
-  $ hg qdel c c
+  $ hg qdel pc pc
 
   $ hg qseries
-  a
-  b
+  pa
+  pb
 
   $ ls .hg/patches
-  a
-  b
+  pa
+  pb
   series
   status
 
   $ hg qpop
-  popping b
-  now at: a
+  popping pb
+  now at: pa
 
   $ hg qdel -k 1
 
   $ ls .hg/patches
-  a
-  b
+  pa
+  pb
   series
   status
 
-  $ hg qdel -r a
-  patch a finalized without changeset message
+  $ hg qdel -r pa
+  patch pa finalized without changeset message
 
   $ hg qapplied
 
   $ hg log --template '{rev} {desc}\n'
-  1 [mq]: a
+  1 [mq]: pa
   0 base
 
-  $ hg qnew d
-  $ hg qnew e
-  $ hg qnew f
+  $ hg qnew pd
+  $ hg qnew pe
+  $ hg qnew pf
 
-  $ hg qdel -r e
+  $ hg qdel -r pe
   abort: cannot delete revision 3 above applied patches
   [255]
 
-  $ hg qdel -r qbase:e
-  patch d finalized without changeset message
-  patch e finalized without changeset message
+  $ hg qdel -r qbase:pe
+  patch pd finalized without changeset message
+  patch pe finalized without changeset message
 
   $ hg qapplied
-  f
+  pf
 
   $ hg log --template '{rev} {desc}\n'
-  4 [mq]: f
-  3 [mq]: e
-  2 [mq]: d
-  1 [mq]: a
+  4 [mq]: pf
+  3 [mq]: pe
+  2 [mq]: pd
+  1 [mq]: pa
   0 base
 
   $ cd ..
@@ -97,53 +97,53 @@
   $ hg qfinish -a
   no patches applied
 
-  $ hg qnew -d '1 0' a
-  $ hg qnew -d '1 0' b
-  $ hg qnew c # XXX fails to apply by /usr/bin/patch if we put a date
+  $ hg qnew -d '1 0' pa
+  $ hg qnew -d '1 0' pb
+  $ hg qnew pc # XXX fails to apply by /usr/bin/patch if we put a date
 
   $ hg qfinish 0
   abort: revision 0 is not managed
   [255]
 
-  $ hg qfinish b
+  $ hg qfinish pb
   abort: cannot delete revision 2 above applied patches
   [255]
 
   $ hg qpop
-  popping c
-  now at: b
+  popping pc
+  now at: pb
 
-  $ hg qfinish -a c
-  abort: unknown revision 'c'!
+  $ hg qfinish -a pc
+  abort: unknown revision 'pc'!
   [255]
 
   $ hg qpush
-  applying c
-  patch c is empty
-  now at: c
+  applying pc
+  patch pc is empty
+  now at: pc
 
-  $ hg qfinish qbase:b
-  patch a finalized without changeset message
-  patch b finalized without changeset message
+  $ hg qfinish qbase:pb
+  patch pa finalized without changeset message
+  patch pb finalized without changeset message
 
   $ hg qapplied
-  c
+  pc
 
   $ hg log --template '{rev} {desc}\n'
-  3 imported patch c
-  2 [mq]: b
-  1 [mq]: a
+  3 imported patch pc
+  2 [mq]: pb
+  1 [mq]: pa
   0 base
 
-  $ hg qfinish -a c
-  patch c finalized without changeset message
+  $ hg qfinish -a pc
+  patch pc finalized without changeset message
 
   $ hg qapplied
 
   $ hg log --template '{rev} {desc}\n'
-  3 imported patch c
-  2 [mq]: b
-  1 [mq]: a
+  3 imported patch pc
+  2 [mq]: pb
+  1 [mq]: pa
   0 base
 
   $ ls .hg/patches
@@ -177,7 +177,7 @@
   $ hg qrefresh -d '1 0'
   $ echo > .hg/patches/series # remove 3.diff from series to confuse mq
   $ hg qfinish -a
-  revision c4dd2b624061 refers to unknown patches: 3.diff
+  revision 47dfa8501675 refers to unknown patches: 3.diff
 
 more complex state 'both known and unknown patches
 
@@ -189,6 +189,6 @@
   $ echo hup >>  base
   $ hg qnew -f -d '1 0' -m 6 6.diff
   $ hg qfinish -a
-  revision 6fdec4b20ec3 refers to unknown patches: 5.diff
-  revision 2ba51db7ba24 refers to unknown patches: 4.diff
+  revision 2b1c98802260 refers to unknown patches: 5.diff
+  revision 33a6861311c0 refers to unknown patches: 4.diff
 
--- a/tests/test-mq-qpush-exact.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-mq-qpush-exact.t	Wed May 04 08:21:50 2011 -0500
@@ -26,7 +26,14 @@
 
   $ echo cp0 >> fp0
   $ hg add fp0
-  $ hg qnew p0 -d "0 0"
+  $ hg ci -m p0 -d "0 0"
+  $ hg export -r. > p0
+  $ hg strip -qn .
+  $ hg qimport p0
+  adding p0 to series file
+  $ hg qpush
+  applying p0
+  now at: p0
 
   $ echo cp1 >> fp1
   $ hg add fp1
@@ -63,15 +70,6 @@
   $ hg qpop -aq
   patch queue now empty
 
-  $ hg qpush -ea
-  applying p0
-  applying p1
-  now at: p1
-  $ hg parents -qr qbase
-  1:d7fe2034f71b
-  $ hg qpop -aq
-  patch queue now empty
-
 qpush --exact when at another rev
 
   $ hg update 0 -q
--- a/tests/test-mq.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-mq.t	Wed May 04 08:21:50 2011 -0500
@@ -1282,7 +1282,7 @@
   patch empty is empty
   now at: empty
   $ hg diff --config diff.nodates=True
-  diff -r bf5fc3f07a0a hello.txt
+  diff -r d58265112590 hello.txt
   --- a/hello.txt
   +++ b/hello.txt
   @@ -1,1 +1,2 @@
@@ -1296,7 +1296,7 @@
    hello
   +world
   $ hg log -l1 -p
-  changeset:   1:bf5fc3f07a0a
+  changeset:   1:d58265112590
   tag:         empty
   tag:         qbase
   tag:         qtip
--- a/tests/test-newbranch.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-newbranch.t	Wed May 04 08:21:50 2011 -0500
@@ -31,7 +31,7 @@
 There should be only one default branch head
 
   $ hg heads .
-  changeset:   3:9d567d0b51f9
+  changeset:   3:1c28f494dae6
   tag:         tip
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -54,34 +54,34 @@
   $ hg ci -m "merge"
 
   $ hg log
-  changeset:   5:dc140083783b
+  changeset:   5:530046499edf
   branch:      foo
   tag:         tip
-  parent:      4:98d14f698afe
-  parent:      3:9d567d0b51f9
+  parent:      4:adf1a74a7f7b
+  parent:      3:1c28f494dae6
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     merge
   
-  changeset:   4:98d14f698afe
+  changeset:   4:adf1a74a7f7b
   branch:      foo
-  parent:      1:0079f24813e2
+  parent:      1:6c0e42da283a
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     modify a branch
   
-  changeset:   3:9d567d0b51f9
+  changeset:   3:1c28f494dae6
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     clear branch name
   
-  changeset:   2:ed2bbf4e0102
+  changeset:   2:c21617b13b22
   branch:      bar
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     change branch name
   
-  changeset:   1:0079f24813e2
+  changeset:   1:6c0e42da283a
   branch:      foo
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -93,9 +93,9 @@
   summary:     initial
   
   $ hg branches
-  foo                            5:dc140083783b
-  default                        3:9d567d0b51f9 (inactive)
-  bar                            2:ed2bbf4e0102 (inactive)
+  foo                            5:530046499edf
+  default                        3:1c28f494dae6 (inactive)
+  bar                            2:c21617b13b22 (inactive)
 
   $ hg branches -q
   foo
@@ -111,10 +111,10 @@
   $ cp $branchcache .hg/bc-invalid
 
   $ hg log -r foo
-  changeset:   4:98d14f698afe
+  changeset:   4:adf1a74a7f7b
   branch:      foo
   tag:         tip
-  parent:      1:0079f24813e2
+  parent:      1:6c0e42da283a
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     modify a branch
@@ -123,12 +123,12 @@
 
   $ hg --debug log -r foo
   invalidating branch cache (tip differs)
-  changeset:   4:98d14f698afeaff8cb612dcf215ce95e639effc3
+  changeset:   4:adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6
   branch:      foo
   tag:         tip
-  parent:      1:0079f24813e2b73a891577c243684c5066347bc8
+  parent:      1:6c0e42da283a56b5edc5b4fadb491365ec7f5fa8
   parent:      -1:0000000000000000000000000000000000000000
-  manifest:    4:d01b250baaa05909152f7ae07d7a649deea0df9a
+  manifest:    1:8c342a37dfba0b3d3ce073562a00d8a813c54ffe
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   files:       a
@@ -141,13 +141,13 @@
   $ echo corrupted > $branchcache
 
   $ hg log -qr foo
-  4:98d14f698afe
+  4:adf1a74a7f7b
 
   $ cat $branchcache
-  98d14f698afeaff8cb612dcf215ce95e639effc3 4
-  9d567d0b51f9e2068b054e1948e1a927f99b5874 default
-  98d14f698afeaff8cb612dcf215ce95e639effc3 foo
-  ed2bbf4e01029020711be82ca905283e883f0e11 bar
+  adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
+  1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
+  adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo
+  c21617b13b220988e7a2e26290fbe4325ffa7139 bar
 
 Push should update the branch cache:
 
@@ -166,22 +166,22 @@
   $ hg push -qf ../target
 
   $ cat ../target/$branchcache
-  98d14f698afeaff8cb612dcf215ce95e639effc3 4
-  9d567d0b51f9e2068b054e1948e1a927f99b5874 default
-  98d14f698afeaff8cb612dcf215ce95e639effc3 foo
-  ed2bbf4e01029020711be82ca905283e883f0e11 bar
+  adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
+  1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
+  adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo
+  c21617b13b220988e7a2e26290fbe4325ffa7139 bar
 
 Update with no arguments: tipmost revision of the current branch:
 
   $ hg up -q -C 0
   $ hg up -q
   $ hg id
-  9d567d0b51f9
+  1c28f494dae6
 
   $ hg up -q 1
   $ hg up -q
   $ hg id
-  98d14f698afe (foo) tip
+  adf1a74a7f7b (foo) tip
 
   $ hg branch foobar
   marked working directory as branch foobar
@@ -210,11 +210,11 @@
   foo
   $ hg commit -m'Merge ff into foo'
   $ hg parents
-  changeset:   6:917eb54e1b4b
+  changeset:   6:185ffbfefa30
   branch:      foo
   tag:         tip
-  parent:      4:98d14f698afe
-  parent:      5:6683a60370cb
+  parent:      4:adf1a74a7f7b
+  parent:      5:1a3c27dc5e11
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     Merge ff into foo
--- a/tests/test-notify.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-notify.t	Wed May 04 08:21:50 2011 -0500
@@ -298,11 +298,11 @@
   Date: * (glob)
   Subject: merge
   From: test@test.com
-  X-Hg-Notification: changeset 22c88b85aa27
+  X-Hg-Notification: changeset 6a0cf76b2701
   Message-Id: <*> (glob)
   To: baz@test.com, foo@bar
   
-  changeset 22c88b85aa27 in b
+  changeset 6a0cf76b2701 in b
   description: merge
   (run 'hg update' to get a working copy)
 
@@ -330,11 +330,11 @@
   Date: * (glob)
   Subject: \xc3\xa0... (esc)
   From: test@test.com
-  X-Hg-Notification: changeset 4a47f01c1356
+  X-Hg-Notification: changeset 7ea05ad269dc
   Message-Id: <*> (glob)
   To: baz@test.com, foo@bar
   
-  changeset 4a47f01c1356 in b
+  changeset 7ea05ad269dc in b
   description: \xc3\xa0\xc3\xa1\xc3\xa2\xc3\xa3\xc3\xa4 (esc)
   diffstat:
   
@@ -343,7 +343,7 @@
   
   diffs (7 lines):
   
-  diff -r 22c88b85aa27 -r 4a47f01c1356 a
+  diff -r 6a0cf76b2701 -r 7ea05ad269dc a
   --- a/a	Thu Jan 01 00:00:03 1970 +0000
   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,2 +1,3 @@
--- a/tests/test-pull-r.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-pull-r.t	Wed May 04 08:21:50 2011 -0500
@@ -51,7 +51,7 @@
   added 2 changesets with 1 changes to 1 files
   (run 'hg update' to get a working copy)
   $ hg heads -q --closed
-  4:996201fa1abf
+  4:00cfe9073916
   2:effea6de0384
   1:ed1b79f46b9a
 
--- a/tests/test-push-warn.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-push-warn.t	Wed May 04 08:21:50 2011 -0500
@@ -31,14 +31,12 @@
 
   $ hg push --debug ../a
   pushing to ../a
+  query 1; heads
   searching for changes
-  examining 1c9246a22a0a:d8d565842d04
-  found incomplete branch 1c9246a22a0a:d8d565842d04
-  searching: 1 queries
-  narrowing 1:1 d8d565842d04
-  found new branch changeset 1c9246a22a0a
-  found new changesets starting at 1c9246a22a0a
-  1 total queries
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 2, sample size is: 2
+  2 total queries
   new remote heads on branch 'default'
   new remote head 1e108cc5548c
   abort: push creates new remote heads on branch 'default'!
--- a/tests/test-rebase-cache.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-rebase-cache.t	Wed May 04 08:21:50 2011 -0500
@@ -85,9 +85,9 @@
   o  0: 'A'
   
   $ hg branches
-  branch3                        8:05b64c4ca2d8
-  branch2                        6:b410fbec727a
-  branch1                        2:9d931918fcf7 (inactive)
+  branch3                        8:4666b71e8e32
+  branch2                        6:5097051d331d
+  branch1                        2:0a03079c47fd (inactive)
   default                        0:1994f17a630e (inactive)
 
   $ hg theads
@@ -101,9 +101,9 @@
   saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
 
   $ hg branches
-  branch3                        8:c1d4b9719987
-  branch2                        4:1be2b203ae5e
-  branch1                        2:9d931918fcf7
+  branch3                        8:466cdfb14b62
+  branch2                        4:e4fdb121d036
+  branch1                        2:0a03079c47fd
   default                        0:1994f17a630e (inactive)
 
   $ hg theads
@@ -162,9 +162,9 @@
   saved backup bundle to $TESTTMP/a2/.hg/strip-backup/*-backup.hg (glob)
 
   $ hg branches
-  branch2                        8:e1e80ed73210
-  branch3                        7:75fd7b643dce
-  branch1                        2:9d931918fcf7 (inactive)
+  branch2                        8:6b4bdc1b5ac0
+  branch3                        7:653b9feb4616
+  branch1                        2:0a03079c47fd (inactive)
   default                        0:1994f17a630e (inactive)
 
   $ hg theads
@@ -226,8 +226,8 @@
   saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
 
   $ hg branches
-  branch2                        7:e1e80ed73210
-  branch1                        2:9d931918fcf7 (inactive)
+  branch2                        7:6b4bdc1b5ac0
+  branch1                        2:0a03079c47fd (inactive)
   default                        0:1994f17a630e (inactive)
 
   $ hg theads
--- a/tests/test-schemes.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-schemes.t	Wed May 04 08:21:50 2011 -0500
@@ -27,9 +27,10 @@
   using http://localhost:$HGPORT/
   sending capabilities command
   comparing with parts://localhost/
+  query 1; heads
   sending heads command
   searching for changes
-  sending known command
+  all remote heads known locally
   no changes found
   [1]
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-setdiscovery.t	Wed May 04 08:21:50 2011 -0500
@@ -0,0 +1,271 @@
+
+Function to test discovery between two repos in both directions, using both the local shortcut
+(which is currently not activated by default) and the full remotable protocol:
+
+  $ testdesc() { # revs_a, revs_b, dagdesc
+  >     if [ -e foo ]; then rm -rf foo; fi
+  >     hg init foo
+  >     cd foo
+  >     hg debugbuilddag "$3"
+  >     hg clone . a $1 --quiet
+  >     hg clone . b $2 --quiet
+  >     echo
+  >     echo "% -- a -> b tree"
+  >     hg -R a debugdiscovery b --verbose --old
+  >     echo
+  >     echo "% -- a -> b set"
+  >     hg -R a debugdiscovery b --verbose --debug
+  >     echo
+  >     echo "% -- b -> a tree"
+  >     hg -R b debugdiscovery a --verbose --old
+  >     echo
+  >     echo "% -- b -> a set"
+  >     hg -R b debugdiscovery a --verbose --debug
+  >     cd ..
+  > }
+
+
+Small superset:
+
+  $ testdesc '-ra1 -ra2' '-rb1 -rb2 -rb3' '
+  > +2:f +1:a1:b1
+  > <f +4 :a2
+  > +5 :b2
+  > <f +3 :b3'
+  
+  % -- a -> b tree
+  comparing with b
+  searching for changes
+  unpruned common: b5714e113bc0 66f7d451a68b 01241442b3c2
+  common heads: b5714e113bc0 01241442b3c2
+  local is subset
+  
+  % -- a -> b set
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking initial sample
+  searching: 2 queries
+  query 2; still undecided: 4, sample size is: 4
+  2 total queries
+  common heads: b5714e113bc0 01241442b3c2
+  local is subset
+  
+  % -- b -> a tree
+  comparing with a
+  searching for changes
+  unpruned common: b5714e113bc0 01241442b3c2
+  common heads: b5714e113bc0 01241442b3c2
+  remote is subset
+  
+  % -- b -> a set
+  comparing with a
+  query 1; heads
+  searching for changes
+  all remote heads known locally
+  common heads: b5714e113bc0 01241442b3c2
+  remote is subset
+
+
+Many new:
+
+  $ testdesc '-ra1 -ra2' '-rb' '
+  > +2:f +3:a1 +3:b
+  > <f +30 :a2'
+  
+  % -- a -> b tree
+  comparing with b
+  searching for changes
+  unpruned common: bebd167eb94d
+  common heads: bebd167eb94d
+  
+  % -- a -> b set
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 35, sample size is: 35
+  2 total queries
+  common heads: bebd167eb94d
+  
+  % -- b -> a tree
+  comparing with a
+  searching for changes
+  unpruned common: bebd167eb94d 66f7d451a68b
+  common heads: bebd167eb94d
+  
+  % -- b -> a set
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking initial sample
+  searching: 2 queries
+  query 2; still undecided: 3, sample size is: 3
+  2 total queries
+  common heads: bebd167eb94d
+
+
+Both sides many new with stub:
+
+  $ testdesc '-ra1 -ra2' '-rb' '
+  > +2:f +2:a1 +30 :b
+  > <f +30 :a2'
+  
+  % -- a -> b tree
+  comparing with b
+  searching for changes
+  unpruned common: 2dc09a01254d
+  common heads: 2dc09a01254d
+  
+  % -- a -> b set
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 34, sample size is: 34
+  2 total queries
+  common heads: 2dc09a01254d
+  
+  % -- b -> a tree
+  comparing with a
+  searching for changes
+  unpruned common: 66f7d451a68b 2dc09a01254d
+  common heads: 2dc09a01254d
+  
+  % -- b -> a set
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking initial sample
+  searching: 2 queries
+  query 2; still undecided: 30, sample size is: 30
+  2 total queries
+  common heads: 2dc09a01254d
+
+
+Both many new:
+
+  $ testdesc '-ra' '-rb' '
+  > +2:f +30 :b
+  > <f +30 :a'
+  
+  % -- a -> b tree
+  comparing with b
+  searching for changes
+  unpruned common: 66f7d451a68b
+  common heads: 66f7d451a68b
+  
+  % -- a -> b set
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 32, sample size is: 32
+  2 total queries
+  common heads: 66f7d451a68b
+  
+  % -- b -> a tree
+  comparing with a
+  searching for changes
+  unpruned common: 66f7d451a68b
+  common heads: 66f7d451a68b
+  
+  % -- b -> a set
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 32, sample size is: 32
+  2 total queries
+  common heads: 66f7d451a68b
+
+
+Both many new skewed:
+
+  $ testdesc '-ra' '-rb' '
+  > +2:f +30 :b
+  > <f +50 :a'
+  
+  % -- a -> b tree
+  comparing with b
+  searching for changes
+  unpruned common: 66f7d451a68b
+  common heads: 66f7d451a68b
+  
+  % -- a -> b set
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 52, sample size is: 52
+  2 total queries
+  common heads: 66f7d451a68b
+  
+  % -- b -> a tree
+  comparing with a
+  searching for changes
+  unpruned common: 66f7d451a68b
+  common heads: 66f7d451a68b
+  
+  % -- b -> a set
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 32, sample size is: 32
+  2 total queries
+  common heads: 66f7d451a68b
+
+
+Both many new on top of long history:
+
+  $ testdesc '-ra' '-rb' '
+  > +1000:f +30 :b
+  > <f +50 :a'
+  
+  % -- a -> b tree
+  comparing with b
+  searching for changes
+  unpruned common: 7ead0cba2838
+  common heads: 7ead0cba2838
+  
+  % -- a -> b set
+  comparing with b
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 1050, sample size is: 11
+  sampling from both directions
+  searching: 3 queries
+  query 3; still undecided: 31, sample size is: 31
+  3 total queries
+  common heads: 7ead0cba2838
+  
+  % -- b -> a tree
+  comparing with a
+  searching for changes
+  unpruned common: 7ead0cba2838
+  common heads: 7ead0cba2838
+  
+  % -- b -> a set
+  comparing with a
+  query 1; heads
+  searching for changes
+  taking quick initial sample
+  searching: 2 queries
+  query 2; still undecided: 1030, sample size is: 11
+  sampling from both directions
+  searching: 3 queries
+  query 3; still undecided: 16, sample size is: 16
+  3 total queries
+  common heads: 7ead0cba2838
+
+
+
--- a/tests/test-ssh.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-ssh.t	Wed May 04 08:21:50 2011 -0500
@@ -219,7 +219,6 @@
   $ hg book -f -r 0 foo
   $ hg pull -B foo
   pulling from ssh://user@dummy/remote
-  searching for changes
   no changes found
   updating bookmark foo
   importing bookmark foo
--- a/tests/test-symlink-os-yes-fs-no.py	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-symlink-os-yes-fs-no.py	Wed May 04 08:21:50 2011 -0500
@@ -1,5 +1,5 @@
 import os, sys, time
-from mercurial import hg, ui, commands
+from mercurial import hg, ui, commands, util
 
 TESTDIR = os.environ["TESTDIR"]
 BUNDLEPATH = os.path.join(TESTDIR, 'bundles', 'test-no-symlinks.hg')
@@ -29,7 +29,7 @@
 for f in 'test0/a.lnk', 'test0/d/b.lnk':
     os.unlink(f)
     fp = open(f, 'wb')
-    fp.write(open(f[:-4]).read())
+    fp.write(util.readfile(f[:-4]))
     fp.close()
 
 # reload repository
--- a/tests/test-tag.t	Wed May 04 13:37:41 2011 +0200
+++ b/tests/test-tag.t	Wed May 04 08:21:50 2011 -0500
@@ -292,7 +292,7 @@
   [255]
   $ hg tag --rev 1 --local t3
   $ hg tags -v
-  tip                                2:8a8f787d0d5c
+  tip                                2:2a156e8887cc
   t3                                 1:c3adabd1a5f4 local
 
   $ cd ..