merge with mpm
authorSune Foldager <cryo@cyanite.org>
Sun, 01 May 2011 19:44:28 +0200
changeset 14154 497493b777ad
parent 14153 f8047a059ca0 (current diff)
parent 14145 4b7e4b9db8fb (diff)
child 14155 921683f14ad7
merge with mpm
mercurial/localrepo.py
--- a/contrib/check-code.py	Sun May 01 17:35:05 2011 +0200
+++ b/contrib/check-code.py	Sun May 01 19:44:28 2011 +0200
@@ -208,11 +208,31 @@
     (r'(\()([^)]+\))', repcallspaces),
 ]
 
+inutilpats = [
+  [
+    (r'\bui\.', "don't use ui in util"),
+  ],
+  # warnings
+  []
+]
+
+inrevlogpats = [
+  [
+    (r'\brepo\.', "don't use repo in revlog"),
+  ],
+  # warnings
+  []
+]
+
 checks = [
     ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
     ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
     ('c', r'.*\.c$', cfilters, cpats),
     ('unified test', r'.*\.t$', utestfilters, utestpats),
+    ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
+     inrevlogpats),
+    ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
+     inutilpats),
 ]
 
 class norepeatlogger(object):
@@ -251,7 +271,7 @@
     return lines
 
 def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
-              blame=False):
+              blame=False, debug=False):
     """checks style and portability of a given file
 
     :f: filepath
@@ -265,13 +285,21 @@
     blamecache = None
     result = True
     for name, match, filters, pats in checks:
+        if debug:
+            print name, f
         fc = 0
         if not re.match(match, f):
+            if debug:
+                print "Skipping %s for %s it doesn't match %s" % (
+                       name, match, f)
             continue
         fp = open(f)
         pre = post = fp.read()
         fp.close()
         if "no-" + "check-code" in pre:
+            if debug:
+                print "Skipping %s for %s it has no- and check-code" % (
+                       name, f)
             break
         for p, r in filters:
             post = re.sub(p, r, post)
@@ -281,8 +309,13 @@
             pats = pats[0]
         # print post # uncomment to show filtered version
         z = enumerate(zip(pre.splitlines(), post.splitlines(True)))
+        if debug:
+            print "Checking %s for %s" % (name, f)
         for n, l in z:
             if "check-code" + "-ignore" in l[0]:
+                if debug:
+                    print "Skipping %s for %s:%s (check-code -ignore)" % (
+                           name, f, n)
                 continue
             for p, msg in pats:
                 if re.search(p, l[1]):
@@ -301,7 +334,6 @@
             if maxerr is not None and fc >= maxerr:
                 print " (too many errors, giving up)"
                 break
-        break
     return result
 
 if __name__ == "__main__":
@@ -312,8 +344,10 @@
                       help="max warnings per file")
     parser.add_option("-b", "--blame", action="store_true",
                       help="use annotate to generate blame info")
+    parser.add_option("", "--debug", action="store_true",
+                      help="show debug information")
 
-    parser.set_defaults(per_file=15, warnings=False, blame=False)
+    parser.set_defaults(per_file=15, warnings=False, blame=False, debug=False)
     (options, args) = parser.parse_args()
 
     if len(args) == 0:
@@ -324,6 +358,6 @@
     for f in check:
         ret = 0
         if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
-                         blame=options.blame):
+                         blame=options.blame, debug=options.debug):
             ret = 1
     sys.exit(ret)
--- a/hgext/color.py	Sun May 01 17:35:05 2011 +0200
+++ b/hgext/color.py	Sun May 01 19:44:28 2011 +0200
@@ -100,7 +100,7 @@
 
 '''
 
-import os, sys
+import os
 
 from mercurial import commands, dispatch, extensions, ui as uimod, util
 from mercurial.i18n import _
@@ -290,7 +290,7 @@
             s = _styles.get(l, '')
             if s:
                 effects.append(s)
-        effects = ''.join(effects)
+        effects = ' '.join(effects)
         if effects:
             return '\n'.join([render_effects(s, effects)
                               for s in msg.split('\n')])
--- a/hgext/convert/darcs.py	Sun May 01 17:35:05 2011 +0200
+++ b/hgext/convert/darcs.py	Sun May 01 19:44:28 2011 +0200
@@ -7,7 +7,7 @@
 
 from common import NoRepo, checktool, commandline, commit, converter_source
 from mercurial.i18n import _
-from mercurial import encoding, util
+from mercurial import util
 import os, shutil, tempfile, re
 
 # The naming drift of ElementTree is fun!
--- a/hgext/graphlog.py	Sun May 01 17:35:05 2011 +0200
+++ b/hgext/graphlog.py	Sun May 01 19:44:28 2011 +0200
@@ -17,7 +17,7 @@
 from mercurial.i18n import _
 from mercurial.node import nullrev
 from mercurial import cmdutil, commands, extensions
-from mercurial import hg, scmutil, util, graphmod
+from mercurial import hg, util, graphmod
 
 ASCIIDATA = 'ASC'
 
--- a/hgext/progress.py	Sun May 01 17:35:05 2011 +0200
+++ b/hgext/progress.py	Sun May 01 19:44:28 2011 +0200
@@ -47,7 +47,6 @@
 import time
 
 from mercurial.i18n import _
-from mercurial import util
 
 def spacejoin(*args):
     return ' '.join(s for s in args if s)
--- a/mercurial/bundlerepo.py	Sun May 01 17:35:05 2011 +0200
+++ b/mercurial/bundlerepo.py	Sun May 01 19:44:28 2011 +0200
@@ -18,8 +18,7 @@
 import localrepo, changelog, manifest, filelog, revlog, error
 
 class bundlerevlog(revlog.revlog):
-    def __init__(self, opener, indexfile, bundle,
-                 linkmapper=None):
+    def __init__(self, opener, indexfile, bundle, linkmapper):
         # How it works:
         # to retrieve a revision, we need to know the offset of
         # the revision in the bundle (an unbundle object).
@@ -32,43 +31,39 @@
         revlog.revlog.__init__(self, opener, indexfile)
         self.bundle = bundle
         self.basemap = {}
-        def chunkpositer():
-            while 1:
-                chunk = bundle.chunk()
-                if not chunk:
-                    break
-                pos = bundle.tell()
-                yield chunk, pos - len(chunk)
         n = len(self)
-        prev = None
-        for chunk, start in chunkpositer():
-            size = len(chunk)
-            if size < 80:
-                raise util.Abort(_("invalid changegroup"))
-            start += 80
-            size -= 80
-            node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80])
+        chain = None
+        while 1:
+            chunkdata = bundle.deltachunk(chain)
+            if not chunkdata:
+                break
+            node = chunkdata['node']
+            p1 = chunkdata['p1']
+            p2 = chunkdata['p2']
+            cs = chunkdata['cs']
+            deltabase = chunkdata['deltabase']
+            delta = chunkdata['delta']
+
+            size = len(delta)
+            start = bundle.tell() - size
+
+            link = linkmapper(cs)
             if node in self.nodemap:
-                prev = node
+                # this can happen if two branches make the same change
+                chain = node
                 continue
+
             for p in (p1, p2):
                 if not p in self.nodemap:
                     raise error.LookupError(p, self.indexfile,
                                             _("unknown parent"))
-            if linkmapper is None:
-                link = n
-            else:
-                link = linkmapper(cs)
-
-            if not prev:
-                prev = p1
             # start, size, full unc. size, base (unused), link, p1, p2, node
             e = (revlog.offset_type(start, 0), size, -1, -1, link,
                  self.rev(p1), self.rev(p2), node)
-            self.basemap[n] = prev
+            self.basemap[n] = deltabase
             self.index.insert(-1, e)
             self.nodemap[node] = n
-            prev = node
+            chain = node
             n += 1
 
     def inbundle(self, rev):
@@ -144,7 +139,9 @@
 class bundlechangelog(bundlerevlog, changelog.changelog):
     def __init__(self, opener, bundle):
         changelog.changelog.__init__(self, opener)
-        bundlerevlog.__init__(self, opener, self.indexfile, bundle)
+        linkmapper = lambda x: x
+        bundlerevlog.__init__(self, opener, self.indexfile, bundle,
+                              linkmapper)
 
 class bundlemanifest(bundlerevlog, manifest.manifest):
     def __init__(self, opener, bundle, linkmapper):
@@ -200,6 +197,8 @@
 
     @util.propertycache
     def changelog(self):
+        # consume the header if it exists
+        self.bundle.changelogheader()
         c = bundlechangelog(self.sopener, self.bundle)
         self.manstart = self.bundle.tell()
         return c
@@ -207,6 +206,8 @@
     @util.propertycache
     def manifest(self):
         self.bundle.seek(self.manstart)
+        # consume the header if it exists
+        self.bundle.manifestheader()
         m = bundlemanifest(self.sopener, self.bundle, self.changelog.rev)
         self.filestart = self.bundle.tell()
         return m
@@ -228,12 +229,13 @@
         if not self.bundlefilespos:
             self.bundle.seek(self.filestart)
             while 1:
-                chunk = self.bundle.chunk()
-                if not chunk:
+                chunkdata = self.bundle.filelogheader()
+                if not chunkdata:
                     break
-                self.bundlefilespos[chunk] = self.bundle.tell()
+                fname = chunkdata['filename']
+                self.bundlefilespos[fname] = self.bundle.tell()
                 while 1:
-                    c = self.bundle.chunk()
+                    c = self.bundle.deltachunk(None)
                     if not c:
                         break
 
--- a/mercurial/changegroup.py	Sun May 01 17:35:05 2011 +0200
+++ b/mercurial/changegroup.py	Sun May 01 19:44:28 2011 +0200
@@ -6,9 +6,12 @@
 # GNU General Public License version 2 or any later version.
 
 from i18n import _
-import util
+from node import nullrev
+import mdiff, util
 import struct, os, bz2, zlib, tempfile
 
+_BUNDLE10_DELTA_HEADER = "20s20s20s20s"
+
 def readexactly(stream, n):
     '''read n bytes from stream.read and abort if less was available'''
     s = stream.read(n)
@@ -128,6 +131,8 @@
     return util.chunkbuffer(generator(fh))
 
 class unbundle10(object):
+    deltaheader = _BUNDLE10_DELTA_HEADER
+    deltaheadersize = struct.calcsize(deltaheader)
     def __init__(self, fh, alg):
         self._stream = decompressor(fh, alg)
         self._type = alg
@@ -154,19 +159,40 @@
             self.callback()
         return l - 4
 
-    def chunk(self):
-        """return the next chunk from changegroup 'source' as a string"""
-        l = self.chunklength()
-        return readexactly(self._stream, l)
+    def changelogheader(self):
+        """v10 does not have a changelog header chunk"""
+        return {}
 
-    def parsechunk(self):
+    def manifestheader(self):
+        """v10 does not have a manifest header chunk"""
+        return {}
+
+    def filelogheader(self):
+        """return the header of the filelogs chunk, v10 only has the filename"""
         l = self.chunklength()
         if not l:
             return {}
-        h = readexactly(self._stream, 80)
-        node, p1, p2, cs = struct.unpack("20s20s20s20s", h)
-        data = readexactly(self._stream, l - 80)
-        return dict(node=node, p1=p1, p2=p2, cs=cs, data=data)
+        fname = readexactly(self._stream, l)
+        return dict(filename=fname)
+
+    def _deltaheader(self, headertuple, prevnode):
+        node, p1, p2, cs = headertuple
+        if prevnode is None:
+            deltabase = p1
+        else:
+            deltabase = prevnode
+        return node, p1, p2, deltabase, cs
+
+    def deltachunk(self, prevnode):
+        l = self.chunklength()
+        if not l:
+            return {}
+        headerdata = readexactly(self._stream, self.deltaheadersize)
+        header = struct.unpack(self.deltaheader, headerdata)
+        delta = readexactly(self._stream, l - self.deltaheadersize)
+        node, p1, p2, deltabase, cs = self._deltaheader(header, prevnode)
+        return dict(node=node, p1=p1, p2=p2, cs=cs,
+                    deltabase=deltabase, delta=delta)
 
 class headerlessfixup(object):
     def __init__(self, fh, h):
@@ -198,16 +224,33 @@
     return unbundle10(fh, alg)
 
 class bundle10(object):
+    deltaheader = _BUNDLE10_DELTA_HEADER
     def __init__(self, lookup):
         self._lookup = lookup
     def close(self):
         return closechunk()
     def fileheader(self, fname):
         return chunkheader(len(fname)) + fname
-    def revchunk(self, revlog, node='', p1='', p2='', prefix='', data=''):
+    def revchunk(self, revlog, rev, prev):
+        node = revlog.node(rev)
+        p1, p2 = revlog.parentrevs(rev)
+        base = prev
+
+        prefix = ''
+        if base == nullrev:
+            delta = revlog.revision(node)
+            prefix = mdiff.trivialdiffheader(len(delta))
+        else:
+            delta = revlog.revdiff(base, rev)
         linknode = self._lookup(revlog, node)
-        meta = node + p1 + p2 + linknode + prefix
-        l = len(meta) + len(data)
+        p1n, p2n = revlog.parents(node)
+        basenode = revlog.node(base)
+        meta = self.builddeltaheader(node, p1n, p2n, basenode, linknode)
+        meta += prefix
+        l = len(meta) + len(delta)
         yield chunkheader(l)
         yield meta
-        yield data
+        yield delta
+    def builddeltaheader(self, node, p1n, p2n, basenode, linknode):
+        # do nothing with basenode, it is implicitly the previous one in HG10
+        return struct.pack(self.deltaheader, node, p1n, p2n, linknode)
--- a/mercurial/cmdutil.py	Sun May 01 17:35:05 2011 +0200
+++ b/mercurial/cmdutil.py	Sun May 01 19:44:28 2011 +0200
@@ -1314,14 +1314,15 @@
     match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
     names = []
     wctx = repo[None]
-    existing = None
-    if scmutil.showportabilityalert(ui):
-        existing = dict([(fn.lower(), fn) for fn in wctx])
+    cca = None
+    abort, warn = scmutil.checkportabilityalert(ui)
+    if abort or warn:
+        cca = scmutil.casecollisionauditor(ui, abort, wctx)
     for f in repo.walk(match):
         exact = match.exact(f)
         if exact or f not in repo.dirstate:
-            if existing:
-                scmutil.checkcasecollision(ui, f, existing)
+            if cca:
+                cca(f)
             names.append(f)
             if ui.verbose or not exact:
                 ui.status(_('adding %s\n') % match.rel(join(f)))
--- a/mercurial/commands.py	Sun May 01 17:35:05 2011 +0200
+++ b/mercurial/commands.py	Sun May 01 19:44:28 2011 +0200
@@ -1214,37 +1214,46 @@
     try:
         gen = changegroup.readbundle(f, bundlepath)
         if all:
-            ui.write("format: id, p1, p2, cset, len(delta)\n")
+            ui.write("format: id, p1, p2, cset, delta base, len(delta)\n")
 
             def showchunks(named):
                 ui.write("\n%s\n" % named)
+                chain = None
                 while 1:
-                    chunkdata = gen.parsechunk()
+                    chunkdata = gen.deltachunk(chain)
                     if not chunkdata:
                         break
                     node = chunkdata['node']
                     p1 = chunkdata['p1']
                     p2 = chunkdata['p2']
                     cs = chunkdata['cs']
-                    delta = chunkdata['data']
-                    ui.write("%s %s %s %s %s\n" %
+                    deltabase = chunkdata['deltabase']
+                    delta = chunkdata['delta']
+                    ui.write("%s %s %s %s %s %s\n" %
                              (hex(node), hex(p1), hex(p2),
-                              hex(cs), len(delta)))
-
+                              hex(cs), hex(deltabase), len(delta)))
+                    chain = node
+
+            chunkdata = gen.changelogheader()
             showchunks("changelog")
+            chunkdata = gen.manifestheader()
             showchunks("manifest")
             while 1:
-                fname = gen.chunk()
-                if not fname:
+                chunkdata = gen.filelogheader()
+                if not chunkdata:
                     break
+                fname = chunkdata['filename']
                 showchunks(fname)
         else:
+            chunkdata = gen.changelogheader()
+            chain = None
             while 1:
-                chunkdata = gen.parsechunk()
+                chunkdata = gen.deltachunk(chain)
                 if not chunkdata:
                     break
                 node = chunkdata['node']
                 ui.write("%s\n" % hex(node))
+                chain = node
     finally:
         f.close()
 
--- a/mercurial/localrepo.py	Sun May 01 17:35:05 2011 +0200
+++ b/mercurial/localrepo.py	Sun May 01 19:44:28 2011 +0200
@@ -1711,6 +1711,7 @@
             pr = prog()
             source.callback = pr
 
+            source.changelogheader()
             if (cl.addgroup(source, csmap, trp) is None
                 and not emptyok):
                 raise util.Abort(_("received changelog group is empty"))
@@ -1730,6 +1731,7 @@
             # if the result of the merge of 1 and 2 is the same in 3 and 4,
             # no new manifest will be created and the manifest group will
             # be empty during the pull
+            source.manifestheader()
             self.manifest.addgroup(source, revmap, trp)
             self.ui.progress(_('manifests'), None)
 
@@ -1751,9 +1753,10 @@
             source.callback = None
 
             while 1:
-                f = source.chunk()
-                if not f:
+                chunkdata = source.filelogheader()
+                if not chunkdata:
                     break
+                f = chunkdata["filename"]
                 self.ui.debug("adding %s revisions\n" % f)
                 pr()
                 fl = self.file(f)
--- a/mercurial/revlog.py	Sun May 01 17:35:05 2011 +0200
+++ b/mercurial/revlog.py	Sun May 01 19:44:28 2011 +0200
@@ -1086,17 +1086,8 @@
 
         # build deltas
         for r in xrange(len(revs) - 1):
-            a, b = revs[r], revs[r + 1]
-            nb = self.node(b)
-            p1, p2 = self.parents(nb)
-            prefix = ''
-
-            if a == nullrev:
-                d = self.revision(nb)
-                prefix = mdiff.trivialdiffheader(len(d))
-            else:
-                d = self.revdiff(a, b)
-            for c in bundler.revchunk(self, nb, p1, p2, prefix, d):
+            prev, curr = revs[r], revs[r + 1]
+            for c in bundler.revchunk(self, curr, prev):
                 yield c
 
         yield bundler.close()
@@ -1131,14 +1122,15 @@
             # loop through our set of deltas
             chain = None
             while 1:
-                chunkdata = bundle.parsechunk()
+                chunkdata = bundle.deltachunk(chain)
                 if not chunkdata:
                     break
                 node = chunkdata['node']
                 p1 = chunkdata['p1']
                 p2 = chunkdata['p2']
                 cs = chunkdata['cs']
-                delta = chunkdata['data']
+                deltabase = chunkdata['deltabase']
+                delta = chunkdata['delta']
 
                 link = linkmapper(cs)
                 if (node in self.nodemap and
@@ -1168,15 +1160,13 @@
                             raise LookupError(p, self.indexfile,
                                               _('unknown parent'))
 
-                if not chain:
-                    # retrieve the parent revision of the delta chain
-                    chain = p1
-                    if not chain in self.nodemap:
-                        raise LookupError(chain, self.indexfile, _('unknown base'))
+                if deltabase not in self.nodemap:
+                    raise LookupError(deltabase, self.indexfile,
+                                      _('unknown delta base'))
 
-                chainrev = self.rev(chain)
+                baserev = self.rev(deltabase)
                 chain = self._addrevision(node, None, transaction, link,
-                                          p1, p2, (chainrev, delta), ifh, dfh)
+                                          p1, p2, (baserev, delta), ifh, dfh)
                 if not dfh and not self._inline:
                     # addrevision switched from inline to conventional
                     # reopen the index
--- a/mercurial/scmutil.py	Sun May 01 17:35:05 2011 +0200
+++ b/mercurial/scmutil.py	Sun May 01 19:44:28 2011 +0200
@@ -17,15 +17,14 @@
 def checkportable(ui, f):
     '''Check if filename f is portable and warn or abort depending on config'''
     checkfilename(f)
-    if showportabilityalert(ui):
+    abort, warn = checkportabilityalert(ui)
+    if abort or warn:
         msg = util.checkwinfilename(f)
         if msg:
-            portabilityalert(ui, "%s: %r" % (msg, f))
-
-def checkcasecollision(ui, f, files):
-    if f.lower() in files and files[f.lower()] != f:
-        portabilityalert(ui, _('possible case-folding collision for %s') % f)
-    files[f.lower()] = f
+            msg = "%s: %r" % (msg, f)
+            if abort:
+                raise util.Abort(msg)
+            ui.warn(_("warning: %s\n") % msg)
 
 def checkportabilityalert(ui):
     '''check if the user's config requests nothing, a warning, or abort for
@@ -40,19 +39,23 @@
             _("ui.portablefilenames value is invalid ('%s')") % val)
     return abort, warn
 
-def showportabilityalert(ui):
-    '''check if the user wants any notification of portability problems'''
-    abort, warn = checkportabilityalert(ui)
-    return abort or warn
+class casecollisionauditor(object):
+    def __init__(self, ui, abort, existingiter):
+        self._ui = ui
+        self._abort = abort
+        self._map = {}
+        for f in existingiter:
+            self._map[f.lower()] = f
 
-def portabilityalert(ui, msg):
-    if not msg:
-        return
-    abort, warn = checkportabilityalert(ui)
-    if abort:
-        raise util.Abort("%s" % msg)
-    elif warn:
-        ui.warn(_("warning: %s\n") % msg)
+    def __call__(self, f):
+        fl = f.lower()
+        map = self._map
+        if fl in map and map[fl] != f:
+            msg = _('possible case-folding collision for %s') % f
+            if self._abort:
+                raise util.Abort(msg)
+            self._ui.warn(_("warning: %s\n") % msg)
+        map[fl] = f
 
 class path_auditor(object):
     '''ensure that a filesystem path contains no banned components.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/filterpyflakes.py	Sun May 01 19:44:28 2011 +0200
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+# Filter output by pyflakes to control which warnings we check
+
+import sys, re
+
+for line in sys.stdin:
+    # We whitelist tests
+    if not re.search("imported but unused", line):
+        continue
+    sys.stdout.write(line)
+print
--- a/tests/hghave	Sun May 01 17:35:05 2011 +0200
+++ b/tests/hghave	Sun May 01 19:44:28 2011 +0200
@@ -172,6 +172,11 @@
     finally:
         os.rmdir(d)
 
+def has_pyflakes():
+    return matchoutput('echo "import re" 2>&1 | pyflakes',
+                       r"<stdin>:1: 're' imported but unused",
+                       True)
+
 def has_pygments():
     try:
         import pygments
@@ -210,6 +215,7 @@
     "mtn": (has_mtn, "monotone client (> 0.31)"),
     "outer-repo": (has_outer_repo, "outer repo"),
     "p4": (has_p4, "Perforce server and client"),
+    "pyflakes": (has_pyflakes, "Pyflakes python linter"),
     "pygments": (has_pygments, "Pygments source highlighting library"),
     "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
     "svn": (has_svn, "subversion client and admin tools"),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-check-pyflakes.t	Sun May 01 19:44:28 2011 +0200
@@ -0,0 +1,11 @@
+  $ "$TESTDIR/hghave" pyflakes || exit 80
+  $ cd $(dirname $TESTDIR)
+  $ pyflakes mercurial hgext 2>&1 | sort | $TESTDIR/filterpyflakes.py
+  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)
+  
+
--- a/tests/test-debugbundle.t	Sun May 01 17:35:05 2011 +0200
+++ b/tests/test-debugbundle.t	Sun May 01 19:44:28 2011 +0200
@@ -18,19 +18,19 @@
 Verbose output:
 
   $ hg debugbundle --all bundle.hg
-  format: id, p1, p2, cset, len(delta)
+  format: id, p1, p2, cset, delta base, len(delta)
   
   changelog
-  0e067c57feba1a5694ca4844f05588bb1bf82342 3903775176ed42b1458a6281db4a0ccf4d9f287a 0000000000000000000000000000000000000000 0e067c57feba1a5694ca4844f05588bb1bf82342 80
-  991a3460af53952d10ec8a295d3d2cc2e5fa9690 0e067c57feba1a5694ca4844f05588bb1bf82342 0000000000000000000000000000000000000000 991a3460af53952d10ec8a295d3d2cc2e5fa9690 80
+  0e067c57feba1a5694ca4844f05588bb1bf82342 3903775176ed42b1458a6281db4a0ccf4d9f287a 0000000000000000000000000000000000000000 0e067c57feba1a5694ca4844f05588bb1bf82342 3903775176ed42b1458a6281db4a0ccf4d9f287a 80
+  991a3460af53952d10ec8a295d3d2cc2e5fa9690 0e067c57feba1a5694ca4844f05588bb1bf82342 0000000000000000000000000000000000000000 991a3460af53952d10ec8a295d3d2cc2e5fa9690 0e067c57feba1a5694ca4844f05588bb1bf82342 80
   
   manifest
-  686dbf0aeca417636fa26a9121c681eabbb15a20 8515d4bfda768e04af4c13a69a72e28c7effbea7 0000000000000000000000000000000000000000 0e067c57feba1a5694ca4844f05588bb1bf82342 55
-  ae25a31b30b3490a981e7b96a3238cc69583fda1 686dbf0aeca417636fa26a9121c681eabbb15a20 0000000000000000000000000000000000000000 991a3460af53952d10ec8a295d3d2cc2e5fa9690 55
+  686dbf0aeca417636fa26a9121c681eabbb15a20 8515d4bfda768e04af4c13a69a72e28c7effbea7 0000000000000000000000000000000000000000 0e067c57feba1a5694ca4844f05588bb1bf82342 8515d4bfda768e04af4c13a69a72e28c7effbea7 55
+  ae25a31b30b3490a981e7b96a3238cc69583fda1 686dbf0aeca417636fa26a9121c681eabbb15a20 0000000000000000000000000000000000000000 991a3460af53952d10ec8a295d3d2cc2e5fa9690 686dbf0aeca417636fa26a9121c681eabbb15a20 55
   
   b
-  b80de5d138758541c5f05265ad144ab9fa86d1db 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0e067c57feba1a5694ca4844f05588bb1bf82342 12
+  b80de5d138758541c5f05265ad144ab9fa86d1db 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0e067c57feba1a5694ca4844f05588bb1bf82342 0000000000000000000000000000000000000000 12
   
   c
-  b80de5d138758541c5f05265ad144ab9fa86d1db 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 991a3460af53952d10ec8a295d3d2cc2e5fa9690 12
+  b80de5d138758541c5f05265ad144ab9fa86d1db 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 991a3460af53952d10ec8a295d3d2cc2e5fa9690 0000000000000000000000000000000000000000 12
 
--- a/tests/test-getbundle.t	Sun May 01 17:35:05 2011 +0200
+++ b/tests/test-getbundle.t	Sun May 01 19:44:28 2011 +0200
@@ -117,37 +117,37 @@
 Check that we get all needed file changes:
 
   $ hg debugbundle bundle --all
-  format: id, p1, p2, cset, len(delta)
+  format: id, p1, p2, cset, delta base, len(delta)
   
   changelog
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
-  2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 99
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 102
+  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 99
+  2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
+  2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 2114148793524fd045998f71a45b0aaf139f752b 102
+  6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
   
   manifest
-  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 113
-  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 113
-  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 295
-  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 114
+  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 591f732a3faf1fb903815273f3c199a514a61ccb 113
+  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b dac7984588fc4eea7acbf39693a9c1b06f5b175d 113
+  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0772616e6b48a76afb6c1458e193cbb3dae2e4ff 295
+  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d eb498cd9af6c44108e43041e951ce829e29f6c80 114
   
   mf
-  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 17
-  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 18
-  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 149
-  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 19
+  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 17
+  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 18
+  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c7b583de053293870e145f45bd2d61643563fd06 149
+  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 266ee3c0302a5a18f1cf96817ac79a51836179e9 19
   
   nf11
-  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 16
+  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 16
   
   nf12
-  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 16
+  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 0000000000000000000000000000000000000000 16
   
   nf4
-  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 15
+  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 15
   
   nf5
-  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 15
+  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 0000000000000000000000000000000000000000 15
 
 Get branch and merge:
 
@@ -209,37 +209,37 @@
 Check that we get all needed file changes:
 
   $ hg debugbundle bundle --all
-  format: id, p1, p2, cset, len(delta)
+  format: id, p1, p2, cset, delta base, len(delta)
   
   changelog
-  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
-  2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 99
-  2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
-  6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 102
+  74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc ea919464b16e003894c48b6cb68df3cd9411b544 99
+  2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 99
+  2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c1818a9f5977dd4139a48f93f5425c67d44a9368 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 2114148793524fd045998f71a45b0aaf139f752b 102
+  6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 102
   
   manifest
-  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 113
-  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 113
-  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 295
-  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 114
+  dac7984588fc4eea7acbf39693a9c1b06f5b175d 591f732a3faf1fb903815273f3c199a514a61ccb 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 591f732a3faf1fb903815273f3c199a514a61ccb 113
+  0772616e6b48a76afb6c1458e193cbb3dae2e4ff dac7984588fc4eea7acbf39693a9c1b06f5b175d 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b dac7984588fc4eea7acbf39693a9c1b06f5b175d 113
+  eb498cd9af6c44108e43041e951ce829e29f6c80 bff2f4817ced57b386caf7c4e3e36a4bc9af7e93 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0772616e6b48a76afb6c1458e193cbb3dae2e4ff 295
+  b15709c071ddd2d93188508ba156196ab4f19620 eb498cd9af6c44108e43041e951ce829e29f6c80 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d eb498cd9af6c44108e43041e951ce829e29f6c80 114
   
   mf
-  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 17
-  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 18
-  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 149
-  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 19
+  4f73f97080266ab8e0c0561ca8d0da3eaf65b695 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 301ca08d026bb72cb4258a9d211bdf7ca0bcd810 17
+  c7b583de053293870e145f45bd2d61643563fd06 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 4f73f97080266ab8e0c0561ca8d0da3eaf65b695 18
+  266ee3c0302a5a18f1cf96817ac79a51836179e9 edc0f6b8db80d68ae6aff2b19f7e5347ab68fa63 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 c7b583de053293870e145f45bd2d61643563fd06 149
+  698c6a36220548cd3903ca7dada27c59aa500c52 266ee3c0302a5a18f1cf96817ac79a51836179e9 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 266ee3c0302a5a18f1cf96817ac79a51836179e9 19
   
   nf11
-  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 16
+  33fbc651630ffa7ccbebfe4eb91320a873e7291c 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2c0ec49482e8abe888b7bd090b5827acfc22b3d7 0000000000000000000000000000000000000000 16
   
   nf12
-  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 16
+  ddce0544363f037e9fb889faca058f52dc01c0a5 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6b57ee934bb2996050540f84cdfc8dcad1e7267d 0000000000000000000000000000000000000000 16
   
   nf4
-  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 15
+  3c1407305701051cbed9f9cb9a68bdfb5997c235 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 74a573f2ae100f1cedfad9aa7b96f8eaab1dabfc 0000000000000000000000000000000000000000 15
   
   nf5
-  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 15
+  0dbd89c185f53a1727c54cd1ce256482fa23968e 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 2114148793524fd045998f71a45b0aaf139f752b 0000000000000000000000000000000000000000 15
 
 Verify we hit the HTTP server: