changeset 12545:a2577df1e163

merge with i18n
author Wagner Bruna <wbruna@yahoo.com>
date Tue, 21 Sep 2010 01:55:53 -0300
parents dbca8f134f00 (diff) 0788d6194a2c (current diff)
children 5a19b576df52
files
diffstat 137 files changed, 2392 insertions(+), 2238 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/shrink-revlog.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/contrib/shrink-revlog.py	Tue Sep 21 01:55:53 2010 -0300
@@ -117,8 +117,8 @@
 
     try:
         group = util.chunkbuffer(r1.group(order, lookup, progress))
-        chunkiter = changegroup.chunkiter(group)
-        r2.addgroup(chunkiter, unlookup, tr)
+        group = changegroup.unbundle10(group, "UN")
+        r2.addgroup(group, unlookup, tr)
     finally:
         ui.progress(_('writing'), None)
 
--- a/hgext/convert/gnuarch.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/hgext/convert/gnuarch.py	Tue Sep 21 01:55:53 2010 -0300
@@ -138,7 +138,7 @@
             raise util.Abort(_('internal calling inconsistency'))
 
         # Raise IOError if necessary (i.e. deleted files).
-        if not os.path.exists(os.path.join(self.tmppath, name)):
+        if not os.path.lexists(os.path.join(self.tmppath, name)):
             raise IOError
 
         return self._getfile(name, rev)
--- a/hgext/convert/subversion.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/hgext/convert/subversion.py	Tue Sep 21 01:55:53 2010 -0300
@@ -1037,7 +1037,7 @@
         # our copyfile method expects to record a copy that has
         # already occurred.  Cross the semantic gap.
         wdest = self.wjoin(dest)
-        exists = os.path.exists(wdest)
+        exists = os.path.lexists(wdest)
         if exists:
             fd, tempname = tempfile.mkstemp(
                 prefix='hg-copy-', dir=os.path.dirname(wdest))
--- a/hgext/mq.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/hgext/mq.py	Tue Sep 21 01:55:53 2010 -0300
@@ -674,7 +674,7 @@
                 removed = []
                 merged = []
                 for f in files:
-                    if os.path.exists(repo.wjoin(f)):
+                    if os.path.lexists(repo.wjoin(f)):
                         merged.append(f)
                     else:
                         removed.append(f)
@@ -2376,7 +2376,7 @@
 def restore(ui, repo, rev, **opts):
     """restore the queue state saved by a revision (DEPRECATED)
 
-    This command is deprecated, use rebase --mq instead."""
+    This command is deprecated, use :hg:`rebase` instead."""
     rev = repo.lookup(rev)
     q = repo.mq
     q.restore(repo, rev, delete=opts.get('delete'),
@@ -2387,7 +2387,7 @@
 def save(ui, repo, **opts):
     """save current queue state (DEPRECATED)
 
-    This command is deprecated, use rebase --mq instead."""
+    This command is deprecated, use :hg:`rebase` instead."""
     q = repo.mq
     message = cmdutil.logmessage(opts)
     ret = q.save(repo, msg=message)
--- a/hgext/transplant.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/hgext/transplant.py	Tue Sep 21 01:55:53 2010 -0300
@@ -48,9 +48,9 @@
             if not os.path.isdir(self.path):
                 os.mkdir(self.path)
             fp = self.opener(self.transplantfile, 'w')
-            for l in self.transplants.itervalues():
-                for c in l:
-                    l, r = map(revlog.hex, (c.lnode, c.rnode))
+            for list in self.transplants.itervalues():
+                for t in list:
+                    l, r = map(revlog.hex, (t.lnode, t.rnode))
                     fp.write(l + ':' + r + '\n')
             fp.close()
         self.dirty = False
--- a/mercurial/archival.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/archival.py	Tue Sep 21 01:55:53 2010 -0300
@@ -150,6 +150,13 @@
         self.z = zipfile.ZipFile(dest, 'w',
                                  compress and zipfile.ZIP_DEFLATED or
                                  zipfile.ZIP_STORED)
+
+        # Python's zipfile module emits deprecation warnings if we try
+        # to store files with a date before 1980.
+        epoch = 315532800 # calendar.timegm((1980, 1, 1, 0, 0, 0, 1, 1, 0))
+        if mtime < epoch:
+            mtime = epoch
+
         self.date_time = time.gmtime(mtime)[:6]
 
     def addfile(self, name, mode, islink, data):
@@ -198,7 +205,7 @@
     }
 
 def archive(repo, dest, node, kind, decode=True, matchfn=None,
-            prefix=None, mtime=None):
+            prefix=None, mtime=None, subrepos=False):
     '''create archive of repo as it was at node.
 
     dest can be name of directory, name of archive file, or file
@@ -256,4 +263,10 @@
     for f in ctx:
         ff = ctx.flags(f)
         write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data)
+
+    if subrepos:
+        for subpath in ctx.substate:
+            sub = ctx.sub(subpath)
+            sub.archive(archiver, prefix)
+
     archiver.done()
--- a/mercurial/bundlerepo.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/bundlerepo.py	Tue Sep 21 01:55:53 2010 -0300
@@ -18,11 +18,11 @@
 import localrepo, changelog, manifest, filelog, revlog, error
 
 class bundlerevlog(revlog.revlog):
-    def __init__(self, opener, indexfile, bundlefile,
+    def __init__(self, opener, indexfile, bundle,
                  linkmapper=None):
         # How it works:
         # to retrieve a revision, we need to know the offset of
-        # the revision in the bundlefile (an opened file).
+        # the revision in the bundle (an unbundle object).
         #
         # We store this offset in the index (start), to differentiate a
         # rev in the bundle and from a rev in the revlog, we check
@@ -30,11 +30,14 @@
         # (it is bigger since we store the node to which the delta is)
         #
         revlog.revlog.__init__(self, opener, indexfile)
-        self.bundlefile = bundlefile
+        self.bundle = bundle
         self.basemap = {}
         def chunkpositer():
-            for chunk in changegroup.chunkiter(bundlefile):
-                pos = bundlefile.tell()
+            while 1:
+                chunk = bundle.chunk()
+                if not chunk:
+                    break
+                pos = bundle.tell()
                 yield chunk, pos - len(chunk)
         n = len(self)
         prev = None
@@ -68,7 +71,7 @@
             prev = node
             n += 1
 
-    def bundle(self, rev):
+    def inbundle(self, rev):
         """is rev from the bundle"""
         if rev < 0:
             return False
@@ -79,19 +82,19 @@
         # Warning: in case of bundle, the diff is against bundlebase,
         # not against rev - 1
         # XXX: could use some caching
-        if not self.bundle(rev):
+        if not self.inbundle(rev):
             return revlog.revlog._chunk(self, rev)
-        self.bundlefile.seek(self.start(rev))
-        return self.bundlefile.read(self.length(rev))
+        self.bundle.seek(self.start(rev))
+        return self.bundle.read(self.length(rev))
 
     def revdiff(self, rev1, rev2):
         """return or calculate a delta between two revisions"""
-        if self.bundle(rev1) and self.bundle(rev2):
+        if self.inbundle(rev1) and self.inbundle(rev2):
             # hot path for bundle
             revb = self.rev(self.bundlebase(rev2))
             if revb == rev1:
                 return self._chunk(rev2)
-        elif not self.bundle(rev1) and not self.bundle(rev2):
+        elif not self.inbundle(rev1) and not self.inbundle(rev2):
             return revlog.revlog.revdiff(self, rev1, rev2)
 
         return mdiff.textdiff(self.revision(self.node(rev1)),
@@ -107,7 +110,7 @@
         iter_node = node
         rev = self.rev(iter_node)
         # reconstruct the revision if it is from a changegroup
-        while self.bundle(rev):
+        while self.inbundle(rev):
             if self._cache and self._cache[0] == iter_node:
                 text = self._cache[2]
                 break
@@ -139,20 +142,20 @@
         raise NotImplementedError
 
 class bundlechangelog(bundlerevlog, changelog.changelog):
-    def __init__(self, opener, bundlefile):
+    def __init__(self, opener, bundle):
         changelog.changelog.__init__(self, opener)
-        bundlerevlog.__init__(self, opener, self.indexfile, bundlefile)
+        bundlerevlog.__init__(self, opener, self.indexfile, bundle)
 
 class bundlemanifest(bundlerevlog, manifest.manifest):
-    def __init__(self, opener, bundlefile, linkmapper):
+    def __init__(self, opener, bundle, linkmapper):
         manifest.manifest.__init__(self, opener)
-        bundlerevlog.__init__(self, opener, self.indexfile, bundlefile,
+        bundlerevlog.__init__(self, opener, self.indexfile, bundle,
                               linkmapper)
 
 class bundlefilelog(bundlerevlog, filelog.filelog):
-    def __init__(self, opener, path, bundlefile, linkmapper):
+    def __init__(self, opener, path, bundle, linkmapper):
         filelog.filelog.__init__(self, opener, path)
-        bundlerevlog.__init__(self, opener, self.indexfile, bundlefile,
+        bundlerevlog.__init__(self, opener, self.indexfile, bundle,
                               linkmapper)
 
 class bundlerepository(localrepo.localrepository):
@@ -171,9 +174,9 @@
             self._url = 'bundle:' + bundlename
 
         self.tempfile = None
-        self.bundlefile = open(bundlename, "rb")
-        b = changegroup.readbundle(self.bundlefile, bundlename)
-        if b.compressed():
+        f = open(bundlename, "rb")
+        self.bundle = changegroup.readbundle(f, bundlename)
+        if self.bundle.compressed():
             fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
                                             suffix=".hg10un", dir=self.path)
             self.tempfile = temp
@@ -182,31 +185,30 @@
             try:
                 fptemp.write("HG10UN")
                 while 1:
-                    chunk = b.read(2**18)
+                    chunk = self.bundle.read(2**18)
                     if not chunk:
                         break
                     fptemp.write(chunk)
             finally:
                 fptemp.close()
-                self.bundlefile.close()
 
-            self.bundlefile = open(self.tempfile, "rb")
-            self.bundlefile.seek(6)
+            f = open(self.tempfile, "rb")
+            self.bundle = changegroup.readbundle(f, bundlename)
 
         # dict with the mapping 'filename' -> position in the bundle
         self.bundlefilespos = {}
 
     @util.propertycache
     def changelog(self):
-        c = bundlechangelog(self.sopener, self.bundlefile)
-        self.manstart = self.bundlefile.tell()
+        c = bundlechangelog(self.sopener, self.bundle)
+        self.manstart = self.bundle.tell()
         return c
 
     @util.propertycache
     def manifest(self):
-        self.bundlefile.seek(self.manstart)
-        m = bundlemanifest(self.sopener, self.bundlefile, self.changelog.rev)
-        self.filestart = self.bundlefile.tell()
+        self.bundle.seek(self.manstart)
+        m = bundlemanifest(self.sopener, self.bundle, self.changelog.rev)
+        self.filestart = self.bundle.tell()
         return m
 
     @util.propertycache
@@ -224,33 +226,32 @@
 
     def file(self, f):
         if not self.bundlefilespos:
-            self.bundlefile.seek(self.filestart)
+            self.bundle.seek(self.filestart)
             while 1:
-                chunk = changegroup.getchunk(self.bundlefile)
+                chunk = self.bundle.chunk()
                 if not chunk:
                     break
-                self.bundlefilespos[chunk] = self.bundlefile.tell()
-                for c in changegroup.chunkiter(self.bundlefile):
-                    pass
+                self.bundlefilespos[chunk] = self.bundle.tell()
+                while 1:
+                    c = self.bundle.chunk()
+                    if not c:
+                        break
 
         if f[0] == '/':
             f = f[1:]
         if f in self.bundlefilespos:
-            self.bundlefile.seek(self.bundlefilespos[f])
-            return bundlefilelog(self.sopener, f, self.bundlefile,
+            self.bundle.seek(self.bundlefilespos[f])
+            return bundlefilelog(self.sopener, f, self.bundle,
                                  self.changelog.rev)
         else:
             return filelog.filelog(self.sopener, f)
 
     def close(self):
         """Close assigned bundle file immediately."""
-        self.bundlefile.close()
+        self.bundle.close()
 
     def __del__(self):
-        bundlefile = getattr(self, 'bundlefile', None)
-        if bundlefile and not bundlefile.closed:
-            bundlefile.close()
-        tempfile = getattr(self, 'tempfile', None)
+        del self.bundle
         if tempfile is not None:
             os.unlink(tempfile)
         if self._tempparent:
--- a/mercurial/changegroup.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/changegroup.py	Tue Sep 21 01:55:53 2010 -0300
@@ -24,17 +24,6 @@
                           % (len(d), l - 4))
     return d
 
-def chunkiter(source, progress=None):
-    """iterate through the chunks in source, yielding a sequence of chunks
-    (strings)"""
-    while 1:
-        c = getchunk(source)
-        if not c:
-            break
-        elif progress is not None:
-            progress()
-        yield c
-
 def chunkheader(length):
     """return a changegroup chunk header (string)"""
     return struct.pack(">l", length + 4)
@@ -94,15 +83,18 @@
         # parse the changegroup data, otherwise we will block
         # in case of sshrepo because we don't know the end of the stream
 
-        # an empty chunkiter is the end of the changegroup
-        # a changegroup has at least 2 chunkiters (changelog and manifest).
-        # after that, an empty chunkiter is the end of the changegroup
+        # an empty chunkgroup is the end of the changegroup
+        # a changegroup has at least 2 chunkgroups (changelog and manifest).
+        # after that, an empty chunkgroup is the end of the changegroup
         empty = False
         count = 0
         while not empty or count <= 2:
             empty = True
             count += 1
-            for chunk in chunkiter(cg):
+            while 1:
+                chunk = getchunk(cg)
+                if not chunk:
+                    break
                 empty = False
                 fh.write(z.compress(chunkheader(len(chunk))))
                 pos = 0
@@ -136,16 +128,63 @@
                 yield zd.decompress(chunk)
     else:
         raise util.Abort("unknown bundle compression '%s'" % alg)
-    return generator(fh)
+    return util.chunkbuffer(generator(fh))
 
 class unbundle10(object):
     def __init__(self, fh, alg):
-        self._stream = util.chunkbuffer(decompressor(fh, alg))
+        self._stream = decompressor(fh, alg)
         self._type = alg
+        self.callback = None
     def compressed(self):
         return self._type != 'UN'
     def read(self, l):
         return self._stream.read(l)
+    def seek(self, pos):
+        return self._stream.seek(pos)
+    def tell(self):
+        return self._stream.tell()
+    def close(self):
+        return self._stream.close()
+
+    def chunklength(self):
+        d = self.read(4)
+        if not d:
+            return 0
+        l = max(0, struct.unpack(">l", d)[0] - 4)
+        if l and self.callback:
+            self.callback()
+        return l
+
+    def chunk(self):
+        """return the next chunk from changegroup 'source' as a string"""
+        l = self.chunklength()
+        d = self.read(l)
+        if len(d) < l:
+            raise util.Abort(_("premature EOF reading chunk"
+                               " (got %d bytes, expected %d)")
+                             % (len(d), l))
+        return d
+
+    def parsechunk(self):
+        l = self.chunklength()
+        if not l:
+            return {}
+        h = self.read(80)
+        node, p1, p2, cs = struct.unpack("20s20s20s20s", h)
+        data = self.read(l - 80)
+        return dict(node=node, p1=p1, p2=p2, cs=cs, data=data)
+
+class headerlessfixup(object):
+    def __init__(self, fh, h):
+        self._h = h
+        self._fh = fh
+    def read(self, n):
+        if self._h:
+            d, self._h = self._h[:n], self._h[n:]
+            if len(d) < n:
+                d += self._fh.read(n - len(d))
+            return d
+        return self._fh.read(n)
 
 def readbundle(fh, fname):
     header = fh.read(6)
@@ -153,12 +192,7 @@
     if not fname:
         fname = "stream"
         if not header.startswith('HG') and header.startswith('\0'):
-            # headerless bundle, clean things up
-            def fixup(f, h):
-                yield h
-                for x in f:
-                    yield x
-            fh = fixup(fh, header)
+            fh = headerlessfixup(fh, header)
             header = "HG10UN"
 
     magic, version, alg = header[0:2], header[2:4], header[4:6]
--- a/mercurial/cmdutil.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/cmdutil.py	Tue Sep 21 01:55:53 2010 -0300
@@ -422,7 +422,7 @@
             return
 
         # check for overwrites
-        exists = os.path.exists(target)
+        exists = os.path.lexists(target)
         if not after and exists or after and state in 'mn':
             if not opts['force']:
                 ui.warn(_('%s: not overwriting - file exists\n') %
--- a/mercurial/commands.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/commands.py	Tue Sep 21 01:55:53 2010 -0300
@@ -199,7 +199,7 @@
     prefix = cmdutil.make_filename(repo, prefix, node)
     matchfn = cmdutil.match(repo, [], opts)
     archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
-                     matchfn, prefix)
+                     matchfn, prefix, subrepos=opts.get('subrepos'))
 
 def backout(ui, repo, node=None, rev=None, **opts):
     '''reverse effect of earlier changeset
@@ -3963,7 +3963,7 @@
            _('revision to distribute'), _('REV')),
           ('t', 'type', '',
            _('type of distribution to create'), _('TYPE')),
-         ] + walkopts,
+         ] + subrepoopts + walkopts,
          _('[OPTION]... DEST')),
     "backout":
         (backout,
--- a/mercurial/context.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/context.py	Tue Sep 21 01:55:53 2010 -0300
@@ -825,7 +825,7 @@
         wlock = self._repo.wlock()
         try:
             for f in list:
-                if unlink and os.path.exists(self._repo.wjoin(f)):
+                if unlink and os.path.lexists(self._repo.wjoin(f)):
                     self._repo.ui.warn(_("%s still exists!\n") % f)
                 elif self._repo.dirstate[f] == 'a':
                     self._repo.dirstate.forget(f)
@@ -853,7 +853,7 @@
 
     def copy(self, source, dest):
         p = self._repo.wjoin(dest)
-        if not (os.path.exists(p) or os.path.islink(p)):
+        if not os.path.lexists(p):
             self._repo.ui.warn(_("%s does not exist!\n") % dest)
         elif not (os.path.isfile(p) or os.path.islink(p)):
             self._repo.ui.warn(_("copy failed: %s is not a file or a "
--- a/mercurial/dirstate.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/dirstate.py	Tue Sep 21 01:55:53 2010 -0300
@@ -362,7 +362,7 @@
         norm_path = os.path.normcase(path)
         fold_path = self._foldmap.get(norm_path, None)
         if fold_path is None:
-            if knownpath or not os.path.exists(os.path.join(self._root, path)):
+            if knownpath or not os.path.lexists(os.path.join(self._root, path)):
                 fold_path = path
             else:
                 fold_path = self._foldmap.setdefault(norm_path,
--- a/mercurial/localrepo.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/localrepo.py	Tue Sep 21 01:55:53 2010 -0300
@@ -1543,7 +1543,7 @@
             if msng_cl_lst:
                 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source)
 
-        return util.chunkbuffer(gengroup())
+        return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN')
 
     def changegroup(self, basenodes, source):
         # to avoid a race we use changegroupsubset() (issue1320)
@@ -1621,7 +1621,7 @@
             if nodes:
                 self.hook('outgoing', node=hex(nodes[0]), source=source)
 
-        return util.chunkbuffer(gengroup())
+        return changegroup.unbundle10(util.chunkbuffer(gengroup()), 'UN')
 
     def addchangegroup(self, source, srctype, url, emptyok=False, lock=None):
         """Add the changegroup returned by source.read() to this repo.
@@ -1671,8 +1671,10 @@
                                      total=self.total)
                     self.count += 1
             pr = prog()
-            chunkiter = changegroup.chunkiter(source, progress=pr)
-            if cl.addgroup(chunkiter, csmap, trp) is None and not emptyok:
+            source.callback = pr
+
+            if (cl.addgroup(source, csmap, trp) is None
+                and not emptyok):
                 raise util.Abort(_("received changelog group is empty"))
             clend = len(cl)
             changesets = clend - clstart
@@ -1686,12 +1688,11 @@
             pr.step = _('manifests')
             pr.count = 1
             pr.total = changesets # manifests <= changesets
-            chunkiter = changegroup.chunkiter(source, progress=pr)
             # no need to check for empty manifest group here:
             # 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
-            self.manifest.addgroup(chunkiter, revmap, trp)
+            self.manifest.addgroup(source, revmap, trp)
             self.ui.progress(_('manifests'), None)
 
             needfiles = {}
@@ -1709,16 +1710,17 @@
             pr.step = 'files'
             pr.count = 1
             pr.total = efiles
+            source.callback = None
+
             while 1:
-                f = changegroup.getchunk(source)
+                f = source.chunk()
                 if not f:
                     break
                 self.ui.debug("adding %s revisions\n" % f)
                 pr()
                 fl = self.file(f)
                 o = len(fl)
-                chunkiter = changegroup.chunkiter(source)
-                if fl.addgroup(chunkiter, revmap, trp) is None:
+                if fl.addgroup(source, revmap, trp) is None:
                     raise util.Abort(_("received file revlog group is empty"))
                 revisions += len(fl) - o
                 files += 1
--- a/mercurial/patch.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/patch.py	Tue Sep 21 01:55:53 2010 -0300
@@ -25,7 +25,7 @@
 
 def copyfile(src, dst, basedir):
     abssrc, absdst = [util.canonpath(basedir, basedir, x) for x in [src, dst]]
-    if os.path.exists(absdst):
+    if os.path.lexists(absdst):
         raise util.Abort(_("cannot create %s: destination already exists") %
                          dst)
 
@@ -923,7 +923,7 @@
     if afile == bfile:
         goodb = gooda
     else:
-        goodb = not nullb and os.path.exists(bfile)
+        goodb = not nullb and os.path.lexists(bfile)
     createfunc = hunk.createfile
     missing = not goodb and not gooda and not createfunc()
 
--- a/mercurial/revlog.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/revlog.py	Tue Sep 21 01:55:53 2010 -0300
@@ -1269,7 +1269,7 @@
 
         yield changegroup.closechunk()
 
-    def addgroup(self, revs, linkmapper, transaction):
+    def addgroup(self, bundle, linkmapper, transaction):
         """
         add a delta group
 
@@ -1301,16 +1301,22 @@
         try:
             # loop through our set of deltas
             chain = None
-            for chunk in revs:
-                node, p1, p2, cs = struct.unpack("20s20s20s20s", chunk[:80])
+            while 1:
+                chunkdata = bundle.parsechunk()
+                if not chunkdata:
+                    break
+                node = chunkdata['node']
+                p1 = chunkdata['p1']
+                p2 = chunkdata['p2']
+                cs = chunkdata['cs']
+                delta = chunkdata['data']
+
                 link = linkmapper(cs)
                 if (node in self.nodemap and
                     (not self.flags(self.rev(node)) & REVIDX_PUNCHED_FLAG)):
                     # this can happen if two branches make the same change
                     chain = node
                     continue
-                delta = buffer(chunk, 80)
-                del chunk
 
                 for p in (p1, p2):
                     if not p in self.nodemap:
--- a/mercurial/revset.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/revset.py	Tue Sep 21 01:55:53 2010 -0300
@@ -276,7 +276,10 @@
     return l
 
 def grep(repo, subset, x):
-    gr = re.compile(getstring(x, _("grep wants a string")))
+    try:
+        gr = re.compile(getstring(x, _("grep wants a string")))
+    except re.error, e:
+        raise error.ParseError(_('invalid match pattern: %s') % e)
     l = []
     for r in subset:
         c = repo[r]
@@ -559,9 +562,9 @@
     elif op == 'func':
         f = getstring(x[1], _("not a symbol"))
         wa, ta = optimize(x[2], small)
-        if f in "grep date user author keyword branch file":
+        if f in "grep date user author keyword branch file outgoing":
             w = 10 # slow
-        elif f in "modifies adds removes outgoing":
+        elif f in "modifies adds removes":
             w = 30 # slower
         elif f == "contains":
             w = 100 # very slow
--- a/mercurial/sshserver.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/sshserver.py	Tue Sep 21 01:55:53 2010 -0300
@@ -6,7 +6,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import util, hook, wireproto
+import util, hook, wireproto, changegroup
 import os, sys
 
 class sshserver(object):
@@ -130,7 +130,8 @@
             return
 
         self.sendresponse("")
-        r = self.repo.addchangegroup(self.fin, 'serve', self._client(),
+        cg = changegroup.unbundle10(self.fin, "UN")
+        r = self.repo.addchangegroup(cg, 'serve', self._client(),
                                      lock=self.lock)
         return str(r)
 
--- a/mercurial/subrepo.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/subrepo.py	Tue Sep 21 01:55:53 2010 -0300
@@ -270,6 +270,27 @@
     def incoming(self, ui, source, opts):
         return 1
 
+    def files(self):
+        """return filename iterator"""
+        raise NotImplementedError
+
+    def filedata(self, name):
+        """return file data"""
+        raise NotImplementedError
+
+    def fileflags(self, name):
+        """return file flags"""
+        return ''
+
+    def archive(self, archiver, prefix):
+        for name in self.files():
+            flags = self.fileflags(name)
+            mode = 'x' in flags and 0755 or 0644
+            symlink = 'l' in flags
+            archiver.addfile(os.path.join(prefix, self._path, name),
+                             mode, symlink, self.filedata(name))
+
+
 class hgsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
         self._path = path
@@ -329,6 +350,15 @@
             self._repo.ui.warn(_("warning: %s in %s\n")
                                % (inst, relpath(self)))
 
+    def archive(self, archiver, prefix):
+        abstractsubrepo.archive(self, archiver, prefix)
+
+        rev = self._state[1]
+        ctx = self._repo[rev]
+        for subpath in ctx.substate:
+            s = subrepo(ctx, subpath)
+            s.archive(archiver, os.path.join(prefix, self._path))
+
     def dirty(self):
         r = self._state[1]
         if r == '':
@@ -406,6 +436,21 @@
     def incoming(self, ui, source, opts):
         return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts)
 
+    def files(self):
+        rev = self._state[1]
+        ctx = self._repo[rev]
+        return ctx.manifest()
+
+    def filedata(self, name):
+        rev = self._state[1]
+        return self._repo[rev][name].data()
+
+    def fileflags(self, name):
+        rev = self._state[1]
+        ctx = self._repo[rev]
+        return ctx.flags(name)
+
+
 class svnsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
         self._path = path
@@ -508,6 +553,15 @@
         # push is a no-op for SVN
         return True
 
+    def files(self):
+        output = self._svncommand(['list'])
+        # This works because svn forbids \n in filenames.
+        return output.splitlines()
+
+    def filedata(self, name):
+        return self._svncommand(['cat'], name)
+
+
 types = {
     'hg': hgsubrepo,
     'svn': svnsubrepo,
--- a/mercurial/templates/static/style-gitweb.css	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/templates/static/style-gitweb.css	Tue Sep 21 01:55:53 2010 -0300
@@ -33,6 +33,7 @@
 tr.dark, .parity1 { background-color:#f6f6f0; }
 tr.dark:hover, .parity1:hover { background-color:#edece6; }
 td { padding:2px 5px; font-size:12px; vertical-align:top; }
+td.closed { background-color: #99f; }
 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
 td.indexlinks { white-space: nowrap; }
 td.indexlinks a {
--- a/mercurial/templates/static/style-monoblue.css	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/templates/static/style-monoblue.css	Tue Sep 21 01:55:53 2010 -0300
@@ -204,6 +204,9 @@
 table tr td.nowrap {
   white-space: nowrap;
 }
+table tr td.closed { 
+  background-color: #99f; 
+}
 /*
 table tr.parity0:hover,
 table tr.parity1:hover {
--- a/mercurial/util.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/util.py	Tue Sep 21 01:55:53 2010 -0300
@@ -644,7 +644,7 @@
             l = l + 1
         name = name[l:]
 
-    if not os.path.exists(os.path.join(root, name)):
+    if not os.path.lexists(os.path.join(root, name)):
         return None
 
     seps = os.sep
--- a/mercurial/wireproto.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/mercurial/wireproto.py	Tue Sep 21 01:55:53 2010 -0300
@@ -102,14 +102,15 @@
     def changegroup(self, nodes, kind):
         n = encodelist(nodes)
         f = self._callstream("changegroup", roots=n)
-        return self._decompress(f)
+        return changegroupmod.unbundle10(self._decompress(f), 'UN')
 
     def changegroupsubset(self, bases, heads, kind):
         self.requirecap('changegroupsubset', _('look up remote changes'))
         bases = encodelist(bases)
         heads = encodelist(heads)
-        return self._decompress(self._callstream("changegroupsubset",
-                                                 bases=bases, heads=heads))
+        f = self._callstream("changegroupsubset",
+                             bases=bases, heads=heads)
+        return changegroupmod.unbundle10(self._decompress(f), 'UN')
 
     def unbundle(self, cg, heads, source):
         '''Send cg (a readable file-like object representing the
--- a/tests/run-tests.py	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/run-tests.py	Tue Sep 21 01:55:53 2010 -0300
@@ -503,6 +503,9 @@
 
     def rematch(el, l):
         try:
+            # hack to deal with graphlog, which looks like bogus regexes
+            if el.startswith('|'):
+                el = '\\' + el
             return re.match(el, l)
         except re.error:
             # el is an invalid regex
--- a/tests/test-abort-checkin.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-abort-checkin.t	Tue Sep 21 01:55:53 2010 -0300
@@ -31,5 +31,3 @@
   rollback completed
   abort: no commits allowed
   [255]
-
-  $ exit 0
--- a/tests/test-acl.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-acl.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1734,5 +1734,3 @@
   acl: "unlikelytoexist" not defined in [acl.groups]
   error: pretxnchangegroup.acl hook failed: group 'unlikelytoexist' is undefined
   abort: group 'unlikelytoexist' is undefined
-
-  $ true
--- a/tests/test-addremove-similar.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-addremove-similar.t	Tue Sep 21 01:55:53 2010 -0300
@@ -98,5 +98,3 @@
   $ hg addremove -s80
   adding c
   recording removal of d/a as rename to c (100% similar)
-
-  $ true
--- a/tests/test-alias.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-alias.t	Tue Sep 21 01:55:53 2010 -0300
@@ -198,5 +198,3 @@
   
   use "hg -v help rt" to show global options
   [255]
-
-  $ exit 0
--- a/tests/test-archive.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-archive.t	Tue Sep 21 01:55:53 2010 -0300
@@ -219,5 +219,17 @@
   $ hg archive ../test-empty
   abort: no working directory: please specify a revision
   [255]
+old file -- date clamped to 1980
 
-  $ exit 0
+  $ touch -d 1975-01-01 old
+  $ hg add old
+  $ hg commit -m old
+  $ hg archive ../old.zip
+  $ unzip -l ../old.zip
+  Archive:  ../old.zip
+  \s*Length.*
+  .*-----.*
+  .*147.*80.*00:00.*old/.hg_archival.txt
+  .*0.*80.*00:00.*old/old
+  .*-----.*
+  \s*147\s+2 files
--- a/tests/test-audit-path.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-audit-path.t	Tue Sep 21 01:55:53 2010 -0300
@@ -80,5 +80,3 @@
   $ hg update -Cr4
   abort: No such file or directory: .*/test-audit-path.t/target//tmp/test
   [255]
-
-  $ exit 0
--- a/tests/test-backout.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-backout.t	Tue Sep 21 01:55:53 2010 -0300
@@ -3,7 +3,7 @@
   $ hg init basic
   $ cd basic
 
-# should complain
+should complain
 
   $ hg backout
   abort: please specify a revision to backout
@@ -12,7 +12,7 @@
   abort: please specify just one revision
   [255]
 
-# basic operation
+basic operation
 
   $ echo a > a
   $ hg commit -d '0 0' -A -m a
@@ -26,7 +26,7 @@
   $ cat a
   a
 
-# file that was removed is recreated
+file that was removed is recreated
 
   $ cd ..
   $ hg init remove
@@ -45,7 +45,7 @@
   $ cat a
   content
 
-# backout of backout is as if nothing happened
+backout of backout is as if nothing happened
 
   $ hg backout -d '3 0' --merge tip
   removing a
@@ -53,7 +53,7 @@
   $ cat a 2>/dev/null || echo cat: a: No such file or directory
   cat: a: No such file or directory
 
-# across branch
+across branch
 
   $ cd ..
   $ hg init branch
@@ -83,7 +83,7 @@
   abort: cannot backout change on a different branch
   [255]
 
-# backout with merge
+backout with merge
 
   $ cd ..
   $ hg init merge
@@ -119,7 +119,7 @@
   line 2
   line 3
 
-# backout should not back out subsequent changesets
+backout should not back out subsequent changesets
 
   $ hg init onecs
   $ cd onecs
@@ -167,25 +167,25 @@
   (branch merge, don't forget to commit)
   $ hg commit -d '4 0' -A -m d
 
-# backout of merge should fail
+backout of merge should fail
 
   $ hg backout 4
   abort: cannot backout a merge changeset without --parent
   [255]
 
-# backout of merge with bad parent should fail
+backout of merge with bad parent should fail
 
   $ hg backout --parent 0 4
   abort: cb9a9f314b8b is not a parent of b2f3bb92043e
   [255]
 
-# backout of non-merge with parent should fail
+backout of non-merge with parent should fail
 
   $ hg backout --parent 0 3
   abort: cannot use --parent on non-merge changeset
   [255]
 
-# backout with valid parent should be ok
+backout with valid parent should be ok
 
   $ hg backout -d '5 0' --parent 2 4
   removing d
@@ -202,7 +202,7 @@
 
   $ cd ..
 
-# named branches
+named branches
 
   $ hg init named_branches
   $ cd named_branches
@@ -259,5 +259,3 @@
   $ hg st -A
   C default
   C file1
-
-  $ exit 0
--- a/tests/test-bookmarks-pushpull.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-bookmarks-pushpull.t	Tue Sep 21 01:55:53 2010 -0300
@@ -64,4 +64,3 @@
   $ hg pull -B anotherbadname ../a
   abort: remote bookmark anotherbadname not found!
   [255]
-  $ true
--- a/tests/test-bookmarks.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-bookmarks.t	Tue Sep 21 01:55:53 2010 -0300
@@ -187,5 +187,3 @@
   $ hg bookmark ' '
   abort: bookmark names cannot consist entirely of whitespace
   [255]
-
-  $ true
--- a/tests/test-commit-unresolved.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-commit-unresolved.t	Tue Sep 21 01:55:53 2010 -0300
@@ -45,5 +45,3 @@
 
   $ hg resolve -m A
   $ hg commit -m "Merged"
-
-  $ exit 0
--- a/tests/test-commit.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-commit.t	Tue Sep 21 01:55:53 2010 -0300
@@ -265,6 +265,3 @@
   HG: removed removed
   abort: empty commit message
   [255]
-  $ cd ..
-
-  $ exit 0
--- a/tests/test-committer.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-committer.t	Tue Sep 21 01:55:53 2010 -0300
@@ -61,5 +61,3 @@
   rollback completed
   abort: empty username!
   [255]
-
-  $ true
--- a/tests/test-convert-hg-startrev.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-convert-hg-startrev.t	Tue Sep 21 01:55:53 2010 -0300
@@ -3,6 +3,8 @@
   > [extensions]
   > graphlog =
   > convert =
+  > [convert]
+  > hg.saverev = yes
   > EOF
 
   $ glog()
@@ -98,12 +100,12 @@
 Check copy preservation
 
   $ hg log --follow --copies e
-  changeset:   2:d67b1d48a835
+  changeset:   2:79818a521a40
   user:        test
   date:        Thu Jan 01 00:00:04 1970 +0000
   summary:     4: merge 2 and 3, copy d from b
   
-  changeset:   1:462c431cf47d
+  changeset:   1:3e6201832cce
   user:        test
   date:        Thu Jan 01 00:00:02 1970 +0000
   summary:     2: copy e from a, change b
@@ -111,7 +113,7 @@
 Check copy removal on missing parent
 
   $ hg log --follow --copies d
-  changeset:   2:d67b1d48a835
+  changeset:   2:79818a521a40
   user:        test
   date:        Thu Jan 01 00:00:04 1970 +0000
   summary:     4: merge 2 and 3, copy d from b
--- a/tests/test-convert-svn-sink	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-convert-svn-sink	Tue Sep 21 01:55:53 2010 -0300
@@ -29,6 +29,7 @@
 echo a > a/a
 mkdir -p a/d1/d2
 echo b > a/d1/d2/b
+ln -s a/missing a/link
 echo % add
 hg --cwd a ci -d '0 0' -A -m 'add a file'
 
@@ -43,6 +44,7 @@
 cmp a/a a-hg-wc/a && echo same || echo different
 
 hg --cwd a mv a b
+hg --cwd a mv link newlink
 echo % rename
 hg --cwd a ci -d '2 0' -m 'rename a file'
 hg --cwd a tip -q
--- a/tests/test-convert-svn-sink.out	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-convert-svn-sink.out	Tue Sep 21 01:55:53 2010 -0300
@@ -1,8 +1,9 @@
 % add
 adding a
 adding d1/d2/b
+adding link
 % modify
-1:e0e2b8a9156b
+1:8231f652da37
 assuming destination a-hg
 initializing svn repository 'a-hg'
 initializing svn working copy 'a-hg-wc'
@@ -17,6 +18,7 @@
  2 1 test d1
  2 1 test d1/d2
  2 1 test d1/d2/b
+ 2 1 test link
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -42,6 +44,8 @@
    action="A">/d1/d2</path>
 <path
    action="A">/d1/d2/b</path>
+<path
+   action="A">/link</path>
 </paths>
 <msg>add a file</msg>
 </logentry>
@@ -49,13 +53,15 @@
 a:
 a
 d1
+link
 
 a-hg-wc:
 a
 d1
+link
 same
 % rename
-2:eb5169441d43
+2:a67e26ccec09
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -68,6 +74,7 @@
  3 1 test d1
  3 1 test d1/d2
  3 1 test d1/d2/b
+ 3 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -81,6 +88,12 @@
    copyfrom-path="/a"
    copyfrom-rev="2"
    action="A">/b</path>
+<path
+   copyfrom-path="/link"
+   copyfrom-rev="2"
+   action="A">/newlink</path>
+<path
+   action="D">/link</path>
 </paths>
 <msg>rename a file</msg>
 </logentry>
@@ -88,12 +101,14 @@
 a:
 b
 d1
+newlink
 
 a-hg-wc:
 b
 d1
+newlink
 % copy
-3:60effef6ab48
+3:0cf087b9ab02
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -107,6 +122,7 @@
  4 1 test d1
  4 1 test d1/d2
  4 1 test d1/d2/b
+ 4 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -126,13 +142,15 @@
 b
 c
 d1
+newlink
 
 a-hg-wc:
 b
 c
 d1
+newlink
 % remove
-4:87bbe3013fb6
+4:07b2e34a5b17
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -145,6 +163,7 @@
  5 1 test d1
  5 1 test d1/d2
  5 1 test d1/d2/b
+ 5 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
@@ -161,12 +180,14 @@
 a:
 c
 d1
+newlink
 
 a-hg-wc:
 c
 d1
+newlink
 % executable
-5:ff42e473c340
+5:31093672760b
 assuming destination a-hg
 initializing svn working copy 'a-hg-wc'
 scanning source...
@@ -179,6 +200,7 @@
  6 1 test d1
  6 1 test d1/d2
  6 1 test d1/d2/b
+ 6 3 test newlink
 <?xml version="1.0"?>
 <log>
 <logentry
--- a/tests/test-copy2.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-copy2.t	Tue Sep 21 01:55:53 2010 -0300
@@ -100,5 +100,3 @@
   $ hg st -AC foo
   M foo
     bar
-
-  $ exit 0
--- a/tests/test-debugcomplete.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-debugcomplete.t	Tue Sep 21 01:55:53 2010 -0300
@@ -195,7 +195,7 @@
   summary: remote
   update: clean, check, date, rev
   addremove: similarity, include, exclude, dry-run
-  archive: no-decode, prefix, rev, type, include, exclude
+  archive: no-decode, prefix, rev, type, subrepos, include, exclude
   backout: merge, parent, rev, include, exclude, message, logfile, date, user
   bisect: reset, good, bad, skip, command, noupdate
   branch: force, clean
@@ -247,5 +247,3 @@
   unbundle: update
   verify: 
   version: 
-
-  $ exit 0
--- a/tests/test-diffdir.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-diffdir.t	Tue Sep 21 01:55:53 2010 -0300
@@ -38,5 +38,3 @@
   $ hg diff -r tip -r ""
   abort: 00changelog.i@: ambiguous identifier!
   [255]
-
-  $ true
--- a/tests/test-dispatch.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-dispatch.t	Tue Sep 21 01:55:53 2010 -0300
@@ -64,5 +64,3 @@
   abort: There is no Mercurial repository here (.hg not found)!
   [255]
 
-  $ exit 0
-
--- a/tests/test-dumprevlog.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-dumprevlog.t	Tue Sep 21 01:55:53 2010 -0300
@@ -105,5 +105,3 @@
   no changes found
   [1]
 
-  $ exit 0
-
--- a/tests/test-empty-dir.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-empty-dir.t	Tue Sep 21 01:55:53 2010 -0300
@@ -21,5 +21,3 @@
   $ test -d sub || echo "sub not present"
   sub not present
 
-  $ true
-
--- a/tests/test-empty-group.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-empty-group.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,3 @@
-#
 #  A          B
 #
 #  3  4       3
@@ -15,7 +14,6 @@
 #
 # (plus we test a failure where outgoing
 # wrongly reported the number of csets)
-#
 
   $ hg init a
   $ cd a
@@ -40,9 +38,6 @@
   (branch merge, don't forget to commit)
   $ hg ci -A -m m1
 
-#hg log
-#hg debugindex .hg/store/00manifest.i
-
   $ hg update -C 1
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge 2
@@ -51,9 +46,6 @@
   $ hg ci -A -m m2
   created new head
 
-#hg log
-#hg debugindex .hg/store/00manifest.i
-
   $ cd ..
 
   $ hg clone -r 3 a b
@@ -135,4 +127,3 @@
   adding file changes
   added 1 changesets with 0 changes to 0 files (+1 heads)
   (run 'hg heads' to see heads, 'hg merge' to merge)
-
--- a/tests/test-extdiff.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-extdiff.t	Tue Sep 21 01:55:53 2010 -0300
@@ -135,8 +135,9 @@
 
   $ chmod +x 'diff tool.py'
 
-# will change to /tmp/extdiff.TMP and populate directories a.TMP and a
-# and start tool
+will change to /tmp/extdiff.TMP and populate directories a.TMP and a
+and start tool
+
   $ hg extdiff -p "`pwd`/diff tool.py"
   [1]
 
@@ -170,5 +171,3 @@
   diffing this a.8a5febb7f867/a a.34eed99112ab/a
   [1]
 
-  $ true
-
--- a/tests/test-extension.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-extension.t	Tue Sep 21 01:55:53 2010 -0300
@@ -318,6 +318,3 @@
   $ hg --config extensions.path=./path.py help foo > /dev/null
   hg: unknown command 'foo'
   [255]
-
-  $ exit 0
-
--- a/tests/test-extra-filelog-entry.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-extra-filelog-entry.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# test for issue351
+test for issue351
 
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "mq=" >> $HGRCPATH
--- a/tests/test-hardlinks-safety.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-hardlinks-safety.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,5 +1,5 @@
+some implementations of cp can't create hardlinks
 
-# some implementations of cp can't create hardlinks
   $ cat > cp.py <<EOF
   > from mercurial import util
   > import sys
--- a/tests/test-help.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-help.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-#!/bin/sh
+Short help:
 
   $ hg
   Mercurial Distributed SCM
--- a/tests/test-hgweb.out	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-hgweb.out	Tue Sep 21 01:55:53 2010 -0300
@@ -276,6 +276,7 @@
 tr.dark, .parity1 { background-color:#f6f6f0; }
 tr.dark:hover, .parity1:hover { background-color:#edece6; }
 td { padding:2px 5px; font-size:12px; vertical-align:top; }
+td.closed { background-color: #99f; }
 td.link { padding:2px 5px; font-family:sans-serif; font-size:10px; }
 td.indexlinks { white-space: nowrap; }
 td.indexlinks a {
--- a/tests/test-hook.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-hook.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,6 +1,6 @@
   $ cp "$TESTDIR"/printenv.py .
 
-# commit hooks can see env vars
+commit hooks can see env vars
 
   $ hg init a
   $ cd a
@@ -27,14 +27,14 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd ../b
 
-# changegroup hooks can see env vars
+changegroup hooks can see env vars
 
   $ echo '[hooks]' > .hg/hgrc
   $ echo 'prechangegroup = python ../printenv.py prechangegroup' >> .hg/hgrc
   $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
   $ echo 'incoming = python ../printenv.py incoming' >> .hg/hgrc
 
-# pretxncommit and commit hooks can see both parents of merge
+pretxncommit and commit hooks can see both parents of merge
 
   $ cd ../a
   $ echo b >> a
@@ -65,7 +65,7 @@
   commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd 
   commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd 
 
-# test generic hooks
+test generic hooks
 
   $ hg id
   pre-identify hook: HG_ARGS=id HG_OPTS={'tags': None, 'rev': '', 'num': None, 'branch': None, 'id': None} HG_PATS=[] 
@@ -91,7 +91,7 @@
   added 3 changesets with 2 changes to 2 files
   (run 'hg update' to get a working copy)
 
-# tag hooks can see env vars
+tag hooks can see env vars
 
   $ cd ../a
   $ echo 'pretag = python ../printenv.py pretag' >> .hg/hgrc
@@ -108,7 +108,7 @@
   pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la 
   tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la 
 
-# pretag hook can forbid tagging
+pretag hook can forbid tagging
 
   $ echo 'pretag.forbid = python ../printenv.py pretag.forbid 1' >> .hg/hgrc
   $ hg tag -d '4 0' fa
@@ -122,8 +122,8 @@
   abort: pretag.forbid hook exited with status 1
   [255]
 
-# pretxncommit hook can see changeset, can roll back txn, changeset
-# no more there after
+pretxncommit hook can see changeset, can roll back txn, changeset no
+more there after
 
   $ echo 'pretxncommit.forbid0 = hg tip -q' >> .hg/hgrc
   $ echo 'pretxncommit.forbid1 = python ../printenv.py pretxncommit.forbid 1' >> .hg/hgrc
@@ -144,7 +144,7 @@
   $ hg -q tip
   4:539e4b31b6dc
 
-# precommit hook can prevent commit
+precommit hook can prevent commit
 
   $ echo 'precommit.forbid = python ../printenv.py precommit.forbid 1' >> .hg/hgrc
   $ hg commit -m 'fail' -d '4 0'
@@ -155,14 +155,14 @@
   $ hg -q tip
   4:539e4b31b6dc
 
-# preupdate hook can prevent update
+preupdate hook can prevent update
 
   $ echo 'preupdate = python ../printenv.py preupdate' >> .hg/hgrc
   $ hg update 1
   preupdate hook: HG_PARENT1=ab228980c14d 
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
 
-# update hook
+update hook
 
   $ echo 'update = python ../printenv.py update' >> .hg/hgrc
   $ hg update
@@ -170,7 +170,7 @@
   update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc 
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-# prechangegroup hook can prevent incoming changes
+prechangegroup hook can prevent incoming changes
 
   $ cd ../b
   $ hg -q tip
@@ -184,8 +184,8 @@
   abort: prechangegroup.forbid hook exited with status 1
   [255]
 
-# pretxnchangegroup hook can see incoming changes, can roll back txn,
-# incoming changes no longer there after
+pretxnchangegroup hook can see incoming changes, can roll back txn,
+incoming changes no longer there after
 
   $ echo '[hooks]' > .hg/hgrc
   $ echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc
@@ -206,7 +206,7 @@
   $ hg -q tip
   3:07f3376c1e65
 
-# outgoing hooks can see env vars
+outgoing hooks can see env vars
 
   $ rm .hg/hgrc
   $ echo '[hooks]' > ../a/.hg/hgrc
@@ -225,7 +225,7 @@
   $ hg rollback
   rolling back to revision 3 (undo pull)
 
-# preoutgoing hook can prevent outgoing changes
+preoutgoing hook can prevent outgoing changes
 
   $ echo 'preoutgoing.forbid = python ../printenv.py preoutgoing.forbid 1' >> ../a/.hg/hgrc
   $ hg pull ../a
@@ -236,7 +236,7 @@
   abort: preoutgoing.forbid hook exited with status 1
   [255]
 
-# outgoing hooks work for local clones
+outgoing hooks work for local clones
 
   $ cd ..
   $ echo '[hooks]' > a/.hg/hgrc
@@ -249,7 +249,7 @@
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm -rf c
 
-# preoutgoing hook can prevent outgoing changes for local clones
+preoutgoing hook can prevent outgoing changes for local clones
 
   $ echo 'preoutgoing.forbid = python ../printenv.py preoutgoing.forbid 1' >> a/.hg/hgrc
   $ hg clone a zzz
@@ -296,7 +296,7 @@
   >     unreachable = 1
   > EOF
 
-# test python hooks
+test python hooks
 
   $ PYTHONPATH="`pwd`:$PYTHONPATH"
   $ export PYTHONPATH
@@ -385,7 +385,7 @@
   added 1 changesets with 1 changes to 1 files
   (run 'hg update' to get a working copy)
 
-# make sure --traceback works
+make sure --traceback works
 
   $ echo '[hooks]' > .hg/hgrc
   $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
@@ -422,7 +422,7 @@
   $ hg showconfig hooks
   hooks.commit.auto=<function autohook at .*>
 
-# test python hook configured with python:[file]:[hook] syntax
+test python hook configured with python:[file]:[hook] syntax
 
   $ cd ..
   $ mkdir d
@@ -446,7 +446,7 @@
 
   $ cd ../../b
 
-# make sure --traceback works on hook import failure
+make sure --traceback works on hook import failure
 
   $ cat > importfail.py <<EOF
   > import somebogusmodule
@@ -467,7 +467,7 @@
   ImportError: No module named hgext_importfail
   Traceback (most recent call last):
 
-# commit and update hooks should run after command completion (issue 1827)
+commit and update hooks should run after command completion (issue 1827)
 
   $ echo '[hooks]' > .hg/hgrc
   $ echo 'commit = hg id' >> .hg/hgrc
@@ -479,4 +479,3 @@
   cb9a9f314b8b
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-  $ exit 0
--- a/tests/test-identify.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-identify.t	Tue Sep 21 01:55:53 2010 -0300
@@ -67,5 +67,3 @@
   $ hg id -t http://localhost:$HGPORT1/
   abort: can't query remote revision number, branch, or tags
   [255]
-
-  $ true # ends with util.Abort -> returns 255
--- a/tests/test-init.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-init.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# This test tries to exercise the ssh functionality with a dummy script
+This test tries to exercise the ssh functionality with a dummy script
 
   $ cat <<EOF > dummyssh
   > import sys
--- a/tests/test-install.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-install.t	Tue Sep 21 01:55:53 2010 -0300
@@ -20,5 +20,3 @@
    (specify a username in your configuration file)
   1 problems detected, please check your install!
   [1]
-
-  $ true
--- a/tests/test-issue1089.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue1089.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue1089
+http://mercurial.selenic.com/bts/issue1089
 
   $ hg init
   $ mkdir a
--- a/tests/test-issue1175.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue1175.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue1175
+http://mercurial.selenic.com/bts/issue1175
 
   $ hg init
   $ touch a
--- a/tests/test-issue1306.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue1306.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue1306
+http://mercurial.selenic.com/bts/issue1306
 
 Initialize remote repo with branches:
 
--- a/tests/test-issue1438.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue1438.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue1438
+http://mercurial.selenic.com/bts/issue1438
 
   $ "$TESTDIR/hghave" symlink || exit 80
 
--- a/tests/test-issue2137.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue2137.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,12 +1,12 @@
-# http://mercurial.selenic.com/bts/issue2137
+http://mercurial.selenic.com/bts/issue2137
 
 Setup:
 
-# create a little extension that has 3 side-effects:
-#   1) ensure changelog data is not inlined
-#   2) make revlog to use lazyparser
-#   3) test that repo.lookup() works
-# 1 and 2 are preconditions for the bug; 3 is the bug.
+create a little extension that has 3 side-effects:
+1) ensure changelog data is not inlined
+2) make revlog to use lazyparser
+3) test that repo.lookup() works
+1 and 2 are preconditions for the bug; 3 is the bug.
 
   $ cat > commitwrapper.py <<EOF
   > from mercurial import extensions, node, revlog
@@ -39,7 +39,6 @@
   adding a
   new tip: 553596fad57b
 
-
 Test that new changesets are visible to repo.lookup():
 
   $ echo a >> a
@@ -53,4 +52,3 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     one more commit to demonstrate the bug
   
-
--- a/tests/test-issue322.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue322.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue322
+http://mercurial.selenic.com/bts/issue322
 
 File replaced with directory:
 
@@ -57,5 +57,3 @@
   abort: directory 'b' already in dirstate
   [255]
 
-  $ exit 0
-
--- a/tests/test-issue433.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue433.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue433
+http://mercurial.selenic.com/bts/issue433
 
   $ hg init
   $ echo a > a
@@ -8,6 +8,3 @@
   $ hg parents -r 0 doesnotexist
   abort: 'doesnotexist' not found in manifest!
   [255]
-
-  $ true
-
--- a/tests/test-issue436.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue436.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue436
+http://mercurial.selenic.com/bts/issue436
 
   $ hg init
   $ hg -v log -v
--- a/tests/test-issue522.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue522.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,10 +1,10 @@
-# http://mercurial.selenic.com/bts/issue522
+http://mercurial.selenic.com/bts/issue522
 
-# In the merge below, the file "foo" has the same contents in both
-# parents, but if we look at the file-level history, we'll notice that
-# the version in p1 is an ancestor of the version in p2.  This test
-# makes sure that we'll use the version from p2 in the manifest of the
-# merge revision.
+In the merge below, the file "foo" has the same contents in both
+parents, but if we look at the file-level history, we'll notice that
+the version in p1 is an ancestor of the version in p2. This test makes
+sure that we'll use the version from p2 in the manifest of the merge
+revision.
 
   $ hg init
 
--- a/tests/test-issue612.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue612.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue612
+http://mercurial.selenic.com/bts/issue612
 
   $ hg init
   $ mkdir src
--- a/tests/test-issue619.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue619.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue619
+http://mercurial.selenic.com/bts/issue619
 
   $ hg init
   $ echo a > a
@@ -27,5 +27,3 @@
   abort: merging with a working directory ancestor has no effect
   [255]
 
-  $ true
-
--- a/tests/test-issue660.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue660.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue660
+http://mercurial.selenic.com/bts/issue660
 
   $ hg init
   $ echo a > a
--- a/tests/test-issue672.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue672.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue672
+http://mercurial.selenic.com/bts/issue672
 
 # 0-2-4
 #  \ \ \
--- a/tests/test-issue842.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-issue842.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# http://mercurial.selenic.com/bts/issue842
+http://mercurial.selenic.com/bts/issue842
 
   $ hg init
   $ echo foo > a
--- a/tests/test-journal-exists.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-journal-exists.t	Tue Sep 21 01:55:53 2010 -0300
@@ -32,5 +32,3 @@
 
   $ if test -f foo/.hg/store/journal; then echo 'journal exists :-('; fi
 
-  $ exit 0
-
--- a/tests/test-log.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-log.t	Tue Sep 21 01:55:53 2010 -0300
@@ -862,7 +862,6 @@
 #      \     /
 #         o
 #
-
 # Where "o" is a revision containing "foo" and
 # "x" is a revision without "foo"
 
@@ -1020,5 +1019,3 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     add foo, related
   
-
-  $ exit 0
--- a/tests/test-manifest.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-manifest.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,5 +1,5 @@
-# Source bundle was generated with the following script.
-#
+Source bundle was generated with the following script:
+
 # hg init
 # echo a > a
 # ln -s a l
@@ -12,12 +12,10 @@
   $ hg init
   $ hg -q pull "$TESTDIR/test-manifest.hg"
 
-
 The next call is expected to return nothing:
 
   $ hg manifest
 
-
   $ hg co
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
@@ -65,7 +63,3 @@
   $ hg manifest -r tip tip
   abort: please specify just one revision
   [255]
-
-
-  $ true
-
--- a/tests/test-merge-commit.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-merge-commit.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# Check that renames are correctly saved by a commit after a merge
+Check that renames are correctly saved by a commit after a merge
 
 Test with the merge on 3 having the rename on the local parent
 
--- a/tests/test-merge-internal-tools-pattern.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-merge-internal-tools-pattern.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,5 +1,5 @@
-# Make sure that the internal merge tools (internal:fail, internal:local, and
-# internal:other) are used when matched by a merge-pattern in hgrc
+Make sure that the internal merge tools (internal:fail, internal:local, and
+internal:other) are used when matched by a merge-pattern in hgrc
 
 Make sure HGMERGE doesn't interfere with the test:
 
--- a/tests/test-merge-prompt.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-merge-prompt.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,10 +1,9 @@
-# Test for
-#
-#   b5605d88dc27: Make ui.prompt repeat on "unrecognized response" again
-#                 (issue897)
-#
-#   840e2b315c1f: Fix misleading error and prompts during update/merge
-#                 (issue556)
+Test for
+b5605d88dc27: Make ui.prompt repeat on "unrecognized response" again
+ (issue897)
+
+840e2b315c1f: Fix misleading error and prompts during update/merge
+ (issue556)
 
   $ status() {
   >     [ $? -ne 0 ] && echo "failed."
--- a/tests/test-merge9.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-merge9.t	Tue Sep 21 01:55:53 2010 -0300
@@ -90,5 +90,3 @@
   $ hg resolve -l
   U bar
   R baz
-
-  $ true
--- a/tests/test-mq-git	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-# Test the plumbing of mq.git option
-# Automatic upgrade itself is tested elsewhere.
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-echo "[diff]" >> $HGRCPATH
-echo "nodates=1" >> $HGRCPATH
-
-hg init repo-auto
-cd repo-auto
-echo '% git=auto: regular patch creation'
-echo a > a
-hg add a
-hg qnew -d '0 0' -f adda
-cat .hg/patches/adda
-echo '% git=auto: git patch creation with copy'
-hg cp a b
-hg qnew -d '0 0' -f copy
-cat .hg/patches/copy
-echo '% git=auto: git patch when using --git'
-echo regular > regular
-hg add regular
-hg qnew -d '0 0' --git -f git
-cat .hg/patches/git
-echo '% git=auto: regular patch after qrefresh without --git'
-hg qrefresh -d '0 0'
-cat .hg/patches/git
-cd ..
-
-hg init repo-keep
-cd repo-keep
-echo '[mq]' > .hg/hgrc
-echo 'git = KEEP' >> .hg/hgrc
-echo '% git=keep: git patch with --git'
-echo a > a
-hg add a
-hg qnew -d '0 0' -f --git git
-cat .hg/patches/git
-echo '% git=keep: git patch after qrefresh without --git'
-echo a >> a
-hg qrefresh -d '0 0'
-cat .hg/patches/git
-cd ..
-
-hg init repo-yes
-cd repo-yes
-echo '[mq]' > .hg/hgrc
-echo 'git = yes' >> .hg/hgrc
-echo '% git=yes: git patch'
-echo a > a
-hg add a
-hg qnew -d '0 0' -f git
-cat .hg/patches/git
-echo '% git=yes: git patch after qrefresh'
-echo a >> a
-hg qrefresh -d '0 0'
-cat .hg/patches/git
-cd ..
-
-hg init repo-no
-cd repo-no
-echo '[diff]' > .hg/hgrc
-echo 'git = True' >> .hg/hgrc
-echo '[mq]' > .hg/hgrc
-echo 'git = False' >> .hg/hgrc
-echo '% git=no: regular patch with copy'
-echo a > a
-hg add a
-hg qnew -d '0 0' -f adda
-hg cp a b
-hg qnew -d '0 0' -f regular
-cat .hg/patches/regular
-echo '% git=no: regular patch after qrefresh with copy'
-hg cp a c
-hg qrefresh -d '0 0'
-cat .hg/patches/regular
-cd ..
--- a/tests/test-mq-git.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-% git=auto: regular patch creation
-# HG changeset patch
-# Parent 0000000000000000000000000000000000000000
-# Date 0 0
-
-diff -r 000000000000 -r ef8dafc9fa4c a
---- /dev/null
-+++ b/a
-@@ -0,0 +1,1 @@
-+a
-% git=auto: git patch creation with copy
-# HG changeset patch
-# Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
-# Date 0 0
-
-diff --git a/a b/b
-copy from a
-copy to b
-% git=auto: git patch when using --git
-# HG changeset patch
-# Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
-# Date 0 0
-
-diff --git a/regular b/regular
-new file mode 100644
---- /dev/null
-+++ b/regular
-@@ -0,0 +1,1 @@
-+regular
-% git=auto: regular patch after qrefresh without --git
-# HG changeset patch
-# Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
-# Date 0 0
-
-diff -r 99586d5f048c regular
---- /dev/null
-+++ b/regular
-@@ -0,0 +1,1 @@
-+regular
-% git=keep: git patch with --git
-# HG changeset patch
-# Parent 0000000000000000000000000000000000000000
-# Date 0 0
-
-diff --git a/a b/a
-new file mode 100644
---- /dev/null
-+++ b/a
-@@ -0,0 +1,1 @@
-+a
-% git=keep: git patch after qrefresh without --git
-# HG changeset patch
-# Parent 0000000000000000000000000000000000000000
-# Date 0 0
-
-diff --git a/a b/a
-new file mode 100644
---- /dev/null
-+++ b/a
-@@ -0,0 +1,2 @@
-+a
-+a
-% git=yes: git patch
-# HG changeset patch
-# Parent 0000000000000000000000000000000000000000
-# Date 0 0
-
-diff --git a/a b/a
-new file mode 100644
---- /dev/null
-+++ b/a
-@@ -0,0 +1,1 @@
-+a
-% git=yes: git patch after qrefresh
-# HG changeset patch
-# Parent 0000000000000000000000000000000000000000
-# Date 0 0
-
-diff --git a/a b/a
-new file mode 100644
---- /dev/null
-+++ b/a
-@@ -0,0 +1,2 @@
-+a
-+a
-% git=no: regular patch with copy
-# HG changeset patch
-# Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
-# Date 0 0
-
-diff -r ef8dafc9fa4c -r a70404f79ba3 b
---- /dev/null
-+++ b/b
-@@ -0,0 +1,1 @@
-+a
-% git=no: regular patch after qrefresh with copy
-# HG changeset patch
-# Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
-# Date 0 0
-
-diff -r ef8dafc9fa4c b
---- /dev/null
-+++ b/b
-@@ -0,0 +1,1 @@
-+a
-diff -r ef8dafc9fa4c c
---- /dev/null
-+++ b/c
-@@ -0,0 +1,1 @@
-+a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-git.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,210 @@
+# Test the plumbing of mq.git option
+# Automatic upgrade itself is tested elsewhere.
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+  $ echo "[diff]" >> $HGRCPATH
+  $ echo "nodates=1" >> $HGRCPATH
+
+  $ hg init repo-auto
+  $ cd repo-auto
+
+git=auto: regular patch creation:
+
+  $ echo a > a
+  $ hg add a
+  $ hg qnew -d '0 0' -f adda
+
+  $ cat .hg/patches/adda
+  # HG changeset patch
+  # Parent 0000000000000000000000000000000000000000
+  # Date 0 0
+  
+  diff -r 000000000000 -r ef8dafc9fa4c a
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,1 @@
+  +a
+
+git=auto: git patch creation with copy:
+
+  $ hg cp a b
+  $ hg qnew -d '0 0' -f copy
+
+  $ cat .hg/patches/copy
+  # HG changeset patch
+  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
+  # Date 0 0
+  
+  diff --git a/a b/b
+  copy from a
+  copy to b
+
+git=auto: git patch when using --git:
+
+  $ echo regular > regular
+  $ hg add regular
+  $ hg qnew -d '0 0' --git -f git
+
+  $ cat .hg/patches/git
+  # HG changeset patch
+  # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
+  # Date 0 0
+  
+  diff --git a/regular b/regular
+  new file mode 100644
+  --- /dev/null
+  +++ b/regular
+  @@ -0,0 +1,1 @@
+  +regular
+
+git=auto: regular patch after qrefresh without --git:
+
+  $ hg qrefresh -d '0 0'
+
+  $ cat .hg/patches/git
+  # HG changeset patch
+  # Parent 99586d5f048c399e20f81cee41fbb3809c0e735d
+  # Date 0 0
+  
+  diff -r 99586d5f048c regular
+  --- /dev/null
+  +++ b/regular
+  @@ -0,0 +1,1 @@
+  +regular
+
+  $ cd ..
+
+  $ hg init repo-keep
+  $ cd repo-keep
+  $ echo '[mq]' > .hg/hgrc
+  $ echo 'git = KEEP' >> .hg/hgrc
+
+git=keep: git patch with --git:
+
+  $ echo a > a
+  $ hg add a
+  $ hg qnew -d '0 0' -f --git git
+
+  $ cat .hg/patches/git
+  # HG changeset patch
+  # Parent 0000000000000000000000000000000000000000
+  # Date 0 0
+  
+  diff --git a/a b/a
+  new file mode 100644
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,1 @@
+  +a
+
+git=keep: git patch after qrefresh without --git:
+
+  $ echo a >> a
+  $ hg qrefresh -d '0 0'
+
+  $ cat .hg/patches/git
+  # HG changeset patch
+  # Parent 0000000000000000000000000000000000000000
+  # Date 0 0
+  
+  diff --git a/a b/a
+  new file mode 100644
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,2 @@
+  +a
+  +a
+  $ cd ..
+
+  $ hg init repo-yes
+  $ cd repo-yes
+  $ echo '[mq]' > .hg/hgrc
+  $ echo 'git = yes' >> .hg/hgrc
+
+git=yes: git patch:
+
+  $ echo a > a
+  $ hg add a
+  $ hg qnew -d '0 0' -f git
+
+  $ cat .hg/patches/git
+  # HG changeset patch
+  # Parent 0000000000000000000000000000000000000000
+  # Date 0 0
+  
+  diff --git a/a b/a
+  new file mode 100644
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,1 @@
+  +a
+
+git=yes: git patch after qrefresh:
+
+  $ echo a >> a
+  $ hg qrefresh -d '0 0'
+
+  $ cat .hg/patches/git
+  # HG changeset patch
+  # Parent 0000000000000000000000000000000000000000
+  # Date 0 0
+  
+  diff --git a/a b/a
+  new file mode 100644
+  --- /dev/null
+  +++ b/a
+  @@ -0,0 +1,2 @@
+  +a
+  +a
+  $ cd ..
+
+  $ hg init repo-no
+  $ cd repo-no
+  $ echo '[diff]' > .hg/hgrc
+  $ echo 'git = True' >> .hg/hgrc
+  $ echo '[mq]' > .hg/hgrc
+  $ echo 'git = False' >> .hg/hgrc
+
+git=no: regular patch with copy:
+
+  $ echo a > a
+  $ hg add a
+  $ hg qnew -d '0 0' -f adda
+  $ hg cp a b
+  $ hg qnew -d '0 0' -f regular
+
+  $ cat .hg/patches/regular
+  # HG changeset patch
+  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
+  # Date 0 0
+  
+  diff -r ef8dafc9fa4c -r a70404f79ba3 b
+  --- /dev/null
+  +++ b/b
+  @@ -0,0 +1,1 @@
+  +a
+
+git=no: regular patch after qrefresh with copy:
+
+  $ hg cp a c
+  $ hg qrefresh -d '0 0'
+
+  $ cat .hg/patches/regular
+  # HG changeset patch
+  # Parent ef8dafc9fa4caff80f6e243eb0171bcd60c455b4
+  # Date 0 0
+  
+  diff -r ef8dafc9fa4c b
+  --- /dev/null
+  +++ b/b
+  @@ -0,0 +1,1 @@
+  +a
+  diff -r ef8dafc9fa4c c
+  --- /dev/null
+  +++ b/c
+  @@ -0,0 +1,1 @@
+  +a
+
+  $ cd ..
+
--- a/tests/test-mq-merge	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-# Test issue 529 - mq aborts when merging patch deleting files
-
-checkundo()
-{
-    if [ -f .hg/store/undo ]; then
-	echo ".hg/store/undo still exists after $1"
-    fi
-}
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq =" >> $HGRCPATH
-echo "[mq]" >> $HGRCPATH
-echo "git = keep" >> $HGRCPATH
-
-# Commit two dummy files in "init" changeset
-hg init t
-cd t
-echo a > a
-echo b > b
-hg ci -Am init
-hg tag -l init
-
-# Create a patch removing a
-hg qnew rm_a
-hg rm a
-hg qrefresh -m "rm a"
-
-# Save the patch queue so we can merge it later
-hg qsave -c -e 2>&1 | grep -v '^copy'
-checkundo qsave
-
-# Update b and commit in an "update" changeset
-hg up -C init
-echo b >> b
-hg st
-hg ci -m update
-
-# Here, qpush used to abort with :
-# The system cannot find the file specified => a
-hg manifest
-hg qpush -a -m 2>&1 | grep -v '^merging'
-checkundo 'qpush -m'
-hg manifest
-
-# ensure status is correct after merge
-hg qpop -a
-cd ..
-
-# Classic MQ merge sequence *with an explicit named queue*
-echo
-echo % init t2
-hg init t2
-cd t2
-echo '[diff]' > .hg/hgrc
-echo 'nodates = 1' >> .hg/hgrc
-echo a > a
-hg ci -Am init
-echo b > a
-hg ci -m changea
-hg up -C 0
-hg cp a aa
-echo c >> a
-hg qnew --git -f -e patcha
-echo d >> a
-hg qnew -d '0 0' -f -e patcha2
-echo % create the reference queue
-hg qsave -c -e -n refqueue 2> /dev/null
-hg up -C 1
-echo % merge
-HGMERGE=internal:other hg qpush -a -m -n refqueue 2>&1 | \
-    sed 's/merging with queue at.*refqueue/merging with queue at refqueue/'
-echo % check patcha is still a git patch
-cat .hg/patches/patcha
-echo % check patcha2 is still a regular patch
-grep git .hg/patches/patcha2 && echo 'git patch found!'
-cd ..
-
--- a/tests/test-mq-merge.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-adding a
-adding b
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-M b
-created new head
-a
-b
-applying rm_a
-now at: rm_a
-b
-popping rm_a
-popping .hg.patches.merge.marker
-patch queue now empty
-
-% init t2
-adding a
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% create the reference queue
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-% merge
-merging with queue at refqueue
-applying patcha
-patching file a
-Hunk #1 FAILED at 0
-1 out of 1 hunks FAILED -- saving rejects to file a.rej
-patch failed, unable to continue (try -v)
-patch failed, rejects left in working dir
-patch didn't work out, merging patcha
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-0 files updated, 2 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-applying patcha2
-now at: patcha2
-% check patcha is still a git patch
-# HG changeset patch
-# Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
-
-diff --git a/a b/a
---- a/a
-+++ b/a
-@@ -1,1 +1,2 @@
--b
-+a
-+c
-diff --git a/a b/aa
-copy from a
-copy to aa
---- a/a
-+++ b/aa
-@@ -1,1 +1,1 @@
--b
-+a
-% check patcha2 is still a regular patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-merge.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,153 @@
+# Test issue 529 - mq aborts when merging patch deleting files
+
+  $ checkundo()
+  > {
+  >     if [ -f .hg/store/undo ]; then
+  >         echo ".hg/store/undo still exists"
+  >     fi
+  > }
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq =" >> $HGRCPATH
+  $ echo "[mq]" >> $HGRCPATH
+  $ echo "git = keep" >> $HGRCPATH
+
+Commit two dummy files in "init" changeset:
+
+  $ hg init t
+  $ cd t
+  $ echo a > a
+  $ echo b > b
+  $ hg ci -Am init
+  adding a
+  adding b
+  $ hg tag -l init
+
+Create a patch removing a:
+
+  $ hg qnew rm_a
+  $ hg rm a
+  $ hg qrefresh -m "rm a"
+
+Save the patch queue so we can merge it later:
+
+  $ hg qsave -c -e
+  copy .*/t/.hg/patches to .*/t/.hg/patches.1
+  $ checkundo
+
+Update b and commit in an "update" changeset:
+
+  $ hg up -C init
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo b >> b
+  $ hg st
+  M b
+  $ hg ci -m update
+  created new head
+
+# Here, qpush used to abort with :
+# The system cannot find the file specified => a
+  $ hg manifest
+  a
+  b
+
+  $ hg qpush -a -m
+  merging with queue at: .*/t/.hg/patches.1
+  applying rm_a
+  now at: rm_a
+
+  $ checkundo
+  $ hg manifest
+  b
+
+Ensure status is correct after merge:
+
+  $ hg qpop -a
+  popping rm_a
+  popping .hg.patches.merge.marker
+  patch queue now empty
+
+  $ cd ..
+
+Classic MQ merge sequence *with an explicit named queue*:
+
+  $ hg init t2
+  $ cd t2
+  $ echo '[diff]' > .hg/hgrc
+  $ echo 'nodates = 1' >> .hg/hgrc
+  $ echo a > a
+  $ hg ci -Am init
+  adding a
+  $ echo b > a
+  $ hg ci -m changea
+  $ hg up -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg cp a aa
+  $ echo c >> a
+  $ hg qnew --git -f -e patcha
+  $ echo d >> a
+  $ hg qnew -d '0 0' -f -e patcha2
+
+Create the reference queue:
+
+  $ hg qsave -c -e -n refqueue
+  copy .*/t2/.hg/patches to .*/t2/.hg/refqueue
+  $ hg up -C 1
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+Merge:
+
+  $ HGMERGE=internal:other hg qpush -a -m -n refqueue
+  merging with queue at: .*/t2/.hg/refqueue
+  applying patcha
+  patching file a
+  Hunk #1 FAILED at 0
+  1 out of 1 hunks FAILED -- saving rejects to file a.rej
+  patch failed, unable to continue (try -v)
+  patch failed, rejects left in working dir
+  patch didn't work out, merging patcha
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  0 files updated, 2 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  applying patcha2
+  now at: patcha2
+
+Check patcha is still a git patch:
+
+  $ cat .hg/patches/patcha
+  # HG changeset patch
+  # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
+  
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,2 @@
+  -b
+  +a
+  +c
+  diff --git a/a b/aa
+  copy from a
+  copy to aa
+  --- a/a
+  +++ b/aa
+  @@ -1,1 +1,1 @@
+  -b
+  +a
+
+Check patcha2 is still a regular patch:
+
+  $ cat .hg/patches/patcha2
+  # HG changeset patch
+  # Parent ........................................
+  # Date 0 0
+  
+  diff -r ............ -r ............ a
+  --- a/a
+  +++ b/a
+  @@ -1,2 +1,3 @@
+   a
+   c
+  +d
+
+  $ cd ..
+
--- a/tests/test-mq-missingfiles	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-#!/bin/sh
-
-# Test issue835:
-# qpush fails immediately when patching a missing file, but
-# remaining added files are still created empty which will
-# trick a future qrefresh.
-
-cat > writelines.py <<EOF
-import sys
-path = sys.argv[1]
-args = sys.argv[2:]
-assert (len(args) % 2) == 0
-
-f = file(path, 'wb')
-for i in xrange(len(args)/2):
-   count, s = args[2*i:2*i+2]
-   count = int(count)
-   s = s.decode('string_escape')
-   f.write(s*count)
-f.close()
-
-EOF
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-
-hg init normal
-cd normal
-python ../writelines.py b 10 'a\n'
-hg ci -Am addb
-echo a > a
-python ../writelines.py b 2 'b\n' 10 'a\n' 2 'c\n'
-echo c > c
-hg add a c
-hg qnew -f changeb
-hg qpop
-hg rm b
-hg ci -Am rmb
-echo % push patch with missing target
-hg qpush
-echo % display added files
-cat a
-cat c
-echo % display rejections
-cat b.rej
-cd ..
-
-
-echo "[diff]" >> $HGRCPATH
-echo "git=1" >> $HGRCPATH
-
-hg init git
-cd git
-python ../writelines.py b 1 '\x00'
-hg ci -Am addb
-echo a > a
-python ../writelines.py b 1 '\x01' 1 '\x00'
-echo c > c
-hg add a c
-hg qnew -f changeb
-hg qpop
-hg rm b
-hg ci -Am rmb
-echo % push git patch with missing target
-hg qpush 2>&1 | sed -e 's/b:.*/b: No such file or directory/'
-hg st
-echo % display added files
-cat a
-cat c
-echo % display rejections
-cat b.rej
-cd ..
-
-echo % test push creating directory during git copy or rename
-hg init missingdir
-cd missingdir
-echo a > a
-hg ci -Am adda
-mkdir d
-hg copy a d/a2
-hg mv a d/a
-hg qnew -g -f patch
-hg qpop
-hg qpush
-cd ..
--- a/tests/test-mq-missingfiles.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-adding b
-popping changeb
-patch queue now empty
-% push patch with missing target
-applying changeb
-unable to find 'b' for patching
-2 out of 2 hunks FAILED -- saving rejects to file b.rej
-patch failed, unable to continue (try -v)
-patch failed, rejects left in working dir
-errors during apply, please fix and refresh changeb
-% display added files
-a
-c
-% display rejections
---- b
-+++ b
-@@ -1,3 +1,5 @@
-+b
-+b
- a
- a
- a
-@@ -8,3 +10,5 @@
- a
- a
- a
-+c
-+c
-adding b
-popping changeb
-patch queue now empty
-% push git patch with missing target
-applying changeb
-unable to find 'b' for patching
-1 out of 1 hunks FAILED -- saving rejects to file b.rej
-patch failed, unable to continue (try -v)
-b: No such file or directory
-patch failed, rejects left in working dir
-errors during apply, please fix and refresh changeb
-? b.rej
-% display added files
-a
-c
-% display rejections
---- b
-+++ b
-GIT binary patch
-literal 2
-Jc${No0000400IC2
-
-% test push creating directory during git copy or rename
-adding a
-popping patch
-patch queue now empty
-applying patch
-now at: patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-missingfiles.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,150 @@
+
+# Test issue835:
+# qpush fails immediately when patching a missing file, but
+# remaining added files are still created empty which will
+# trick a future qrefresh.
+
+  $ cat > writelines.py <<EOF
+  > import sys
+  > path = sys.argv[1]
+  > args = sys.argv[2:]
+  > assert (len(args) % 2) == 0
+  > 
+  > f = file(path, 'wb')
+  > for i in xrange(len(args)/2):
+  >    count, s = args[2*i:2*i+2]
+  >    count = int(count)
+  >    s = s.decode('string_escape')
+  >    f.write(s*count)
+  > f.close()
+  > EOF
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+
+  $ hg init normal
+  $ cd normal
+  $ python ../writelines.py b 10 'a\n'
+  $ hg ci -Am addb
+  adding b
+  $ echo a > a
+  $ python ../writelines.py b 2 'b\n' 10 'a\n' 2 'c\n'
+  $ echo c > c
+  $ hg add a c
+  $ hg qnew -f changeb
+  $ hg qpop
+  popping changeb
+  patch queue now empty
+  $ hg rm b
+  $ hg ci -Am rmb
+
+Push patch with missing target:
+
+  $ hg qpush
+  applying changeb
+  unable to find 'b' for patching
+  2 out of 2 hunks FAILED -- saving rejects to file b.rej
+  patch failed, unable to continue (try -v)
+  patch failed, rejects left in working dir
+  errors during apply, please fix and refresh changeb
+  [2]
+
+Display added files:
+
+  $ cat a
+  a
+  $ cat c
+  c
+
+Display rejections:
+
+  $ cat b.rej
+  --- b
+  +++ b
+  @@ -1,3 +1,5 @@
+  +b
+  +b
+   a
+   a
+   a
+  @@ -8,3 +10,5 @@
+   a
+   a
+   a
+  +c
+  +c
+
+  $ cd ..
+
+
+  $ echo "[diff]" >> $HGRCPATH
+  $ echo "git=1" >> $HGRCPATH
+
+  $ hg init git
+  $ cd git
+  $ python ../writelines.py b 1 '\x00'
+  $ hg ci -Am addb
+  adding b
+  $ echo a > a
+  $ python ../writelines.py b 1 '\x01' 1 '\x00'
+  $ echo c > c
+  $ hg add a c
+  $ hg qnew -f changeb
+  $ hg qpop
+  popping changeb
+  patch queue now empty
+  $ hg rm b
+  $ hg ci -Am rmb
+
+Push git patch with missing target:
+
+  $ hg qpush
+  applying changeb
+  unable to find 'b' for patching
+  1 out of 1 hunks FAILED -- saving rejects to file b.rej
+  patch failed, unable to continue (try -v)
+  b: No such file or directory
+  patch failed, rejects left in working dir
+  errors during apply, please fix and refresh changeb
+  [2]
+  $ hg st
+  ? b.rej
+
+Display added files:
+
+  $ cat a
+  a
+  $ cat c
+  c
+
+Display rejections:
+
+  $ cat b.rej
+  --- b
+  +++ b
+  GIT binary patch
+  literal 2
+  Jc${No0000400IC2
+  
+  $ cd ..
+
+Test push creating directory during git copy or rename:
+
+  $ hg init missingdir
+  $ cd missingdir
+  $ echo a > a
+  $ hg ci -Am adda
+  adding a
+  $ mkdir d
+  $ hg copy a d/a2
+  $ hg mv a d/a
+  $ hg qnew -g -f patch
+  $ hg qpop
+  popping patch
+  patch queue now empty
+  $ hg qpush
+  applying patch
+  now at: patch
+
+  $ cd ..
+
--- a/tests/test-mq-pull-from-bundle	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#!/bin/sh
-
-cat <<EOF >> $HGRCPATH
-[extensions]
-mq=
-[defaults]
-log = --template "{rev}: {desc}\\n"
-heads = --template "{rev}: {desc}\\n"
-incoming = --template "{rev}: {desc}\\n"
-EOF
-
-echo "====== Setup main"
-hg init base
-cd base
-echo "One" > one
-hg add
-hg ci -m "main: one added."
-echo "++" >> one
-hg ci -m "main: one updated."
-
-echo "====== Bundle main"
-hg bundle --base=null ../main.hg
-cd ..
-
-echo "====== Incoming to fresh repo"
-hg init fresh
-echo ">> hg -R fresh incoming main.hg"
-hg -R fresh incoming main.hg
-echo ">> hg -R fresh incoming bundle:fresh+main.hg"
-hg -R fresh incoming bundle:fresh+main.hg
-
-
-echo "====== Setup queue"
-cd base
-hg qinit -c
-hg qnew -m "patch: two added." two.patch
-echo two > two
-hg add
-hg qrefresh
-hg qcommit -m "queue: two.patch added."
-hg qpop -a
-
-echo "====== Bundle queue"
-hg -R .hg/patches bundle --base=null ../queue.hgq
-cd ..
-
-
-echo "====== Clone base"
-hg clone base copy
-cd copy
-hg qinit -c
-
-echo "====== Incoming queue bundle"
-echo ">> hg -R .hg/patches incoming ../queue.hgq"
-hg -R .hg/patches incoming ../queue.hgq
-
-echo "====== Pull queue bundle"
-echo ">> hg -R .hg/patches pull --update ../queue.hgq"
-hg -R .hg/patches pull --update ../queue.hgq
-echo ">> hg -R .hg/patches heads"
-hg -R .hg/patches heads
-echo ">> hg -R .hg/patches log"
-hg -R .hg/patches log
-echo ">> hg qseries"
-hg qseries
-cd ..
-
-
-echo "====== Clone base again"
-hg clone base copy2
-cd copy2
-hg qinit -c
-
-echo "====== Unbundle queue bundle"
-echo ">> hg -R .hg/patches unbundle --update ../queue.hgq"
-hg -R .hg/patches unbundle --update ../queue.hgq
-echo ">> hg -R .hg/patches heads"
-hg -R .hg/patches heads
-echo ">> hg -R .hg/patches log"
-hg -R .hg/patches log
-echo ">> hg qseries"
-hg qseries
-cd ..
--- a/tests/test-mq-pull-from-bundle.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-====== Setup main
-adding one
-====== Bundle main
-2 changesets found
-====== Incoming to fresh repo
->> hg -R fresh incoming main.hg
-comparing with main.hg
-0: main: one added.
-1: main: one updated.
->> hg -R fresh incoming bundle:fresh+main.hg
-comparing with bundle:fresh+main.hg
-0: main: one added.
-1: main: one updated.
-====== Setup queue
-adding two
-popping two.patch
-patch queue now empty
-====== Bundle queue
-1 changesets found
-====== Clone base
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-====== Incoming queue bundle
->> hg -R .hg/patches incoming ../queue.hgq
-comparing with ../queue.hgq
-0: queue: two.patch added.
-====== Pull queue bundle
->> hg -R .hg/patches pull --update ../queue.hgq
-pulling from ../queue.hgq
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 3 changes to 3 files
-merging series
-2 files updated, 1 files merged, 0 files removed, 0 files unresolved
->> hg -R .hg/patches heads
-0: queue: two.patch added.
->> hg -R .hg/patches log
-0: queue: two.patch added.
->> hg qseries
-two.patch
-====== Clone base again
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-====== Unbundle queue bundle
->> hg -R .hg/patches unbundle --update ../queue.hgq
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 3 changes to 3 files
-merging series
-2 files updated, 1 files merged, 0 files removed, 0 files unresolved
->> hg -R .hg/patches heads
-0: queue: two.patch added.
->> hg -R .hg/patches log
-0: queue: two.patch added.
->> hg qseries
-two.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-pull-from-bundle.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,131 @@
+  $ cat <<EOF >> $HGRCPATH
+  > [extensions]
+  > mq=
+  > [alias]
+  > tlog = log --template "{rev}: {desc}\\n"
+  > theads = heads --template "{rev}: {desc}\\n"
+  > tincoming = incoming --template "{rev}: {desc}\\n"
+  > EOF
+
+Setup main:
+
+  $ hg init base
+  $ cd base
+  $ echo "One" > one
+  $ hg add
+  adding one
+  $ hg ci -m "main: one added"
+  $ echo "++" >> one
+  $ hg ci -m "main: one updated"
+
+Bundle main:
+
+  $ hg bundle --base=null ../main.hg
+  2 changesets found
+
+  $ cd ..
+
+Incoming to fresh repo:
+
+  $ hg init fresh
+
+  $ hg -R fresh tincoming main.hg
+  comparing with main.hg
+  0: main: one added
+  1: main: one updated
+
+  $ hg -R fresh tincoming bundle:fresh+main.hg
+  comparing with bundle:fresh+main.hg
+  0: main: one added
+  1: main: one updated
+
+
+Setup queue:
+
+  $ cd base
+  $ hg qinit -c
+  $ hg qnew -m "patch: two added" two.patch
+  $ echo two > two
+  $ hg add
+  adding two
+  $ hg qrefresh
+  $ hg qcommit -m "queue: two.patch added"
+  $ hg qpop -a
+  popping two.patch
+  patch queue now empty
+
+Bundle queue:
+
+  $ hg -R .hg/patches bundle --base=null ../queue.hgq
+  1 changesets found
+
+  $ cd ..
+
+
+Clone base:
+
+  $ hg clone base copy
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd copy
+  $ hg qinit -c
+
+Incoming queue bundle:
+
+  $ hg -R .hg/patches tincoming ../queue.hgq
+  comparing with ../queue.hgq
+  0: queue: two.patch added
+
+Pull queue bundle:
+
+  $ hg -R .hg/patches pull --update ../queue.hgq
+  pulling from ../queue.hgq
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 3 changes to 3 files
+  merging series
+  2 files updated, 1 files merged, 0 files removed, 0 files unresolved
+
+  $ hg -R .hg/patches theads
+  0: queue: two.patch added
+
+  $ hg -R .hg/patches tlog
+  0: queue: two.patch added
+
+  $ hg qseries
+  two.patch
+
+  $ cd ..
+
+
+Clone base again:
+
+  $ hg clone base copy2
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd copy2
+  $ hg qinit -c
+
+Unbundle queue bundle:
+
+  $ hg -R .hg/patches unbundle --update ../queue.hgq
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 3 changes to 3 files
+  merging series
+  2 files updated, 1 files merged, 0 files removed, 0 files unresolved
+
+  $ hg -R .hg/patches theads
+  0: queue: two.patch added
+
+  $ hg -R .hg/patches tlog
+  0: queue: two.patch added
+
+  $ hg qseries
+  two.patch
+
+  $ cd ..
+
--- a/tests/test-mq-qdelete	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-
-hg init a
-cd a
-
-echo 'base' > base
-hg ci -Ambase -d '1 0'
-
-hg qnew -d '1 0' a
-hg qnew -d '1 0' b
-hg qnew -d '1 0' c
-
-hg qdel
-
-hg qdel c
-hg qpop
-hg qdel c
-hg qseries
-ls .hg/patches
-hg qpop
-hg qdel -k 1
-ls .hg/patches
-hg qdel -r a
-hg qapplied
-hg log --template '{rev} {desc}\n'
-
-hg qnew d
-hg qnew e
-hg qnew f
-
-hg qdel -r e
-hg qdel -r qbase:e
-hg qapplied
-hg log --template '{rev} {desc}\n'
-
-cd ..
-hg init b
-cd b
-
-echo 'base' > base
-hg ci -Ambase -d '1 0'
-
-hg qfinish
-hg qfinish -a
-
-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 qfinish 0
-hg qfinish b
-
-hg qpop
-hg qfinish -a c
-hg qpush
-
-hg qfinish qbase:b
-hg qapplied
-hg log --template '{rev} {desc}\n'
-
-hg qfinish -a c
-hg qapplied
-hg log --template '{rev} {desc}\n'
-ls .hg/patches
--- a/tests/test-mq-qdelete.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-adding base
-abort: qdelete requires at least one revision or patch name
-abort: cannot delete applied patch c
-popping c
-now at: b
-a
-b
-a
-b
-series
-status
-popping b
-now at: a
-a
-b
-series
-status
-patch a finalized without changeset message
-1 [mq]: a
-0 base
-abort: cannot delete revision 3 above applied patches
-patch d finalized without changeset message
-patch e finalized without changeset message
-f
-4 [mq]: f
-3 [mq]: e
-2 [mq]: d
-1 [mq]: a
-0 base
-adding base
-abort: no revisions specified
-no patches applied
-abort: revision 0 is not managed
-abort: cannot delete revision 2 above applied patches
-popping c
-now at: b
-abort: unknown revision 'c'!
-applying c
-patch c is empty
-now at: c
-patch a finalized without changeset message
-patch b finalized without changeset message
-c
-3 imported patch c
-2 [mq]: b
-1 [mq]: a
-0 base
-patch c finalized without changeset message
-3 imported patch c
-2 [mq]: b
-1 [mq]: a
-0 base
-series
-status
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-qdelete.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,150 @@
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+
+  $ hg init a
+  $ cd a
+
+  $ echo 'base' > base
+  $ 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 qdel
+  abort: qdelete requires at least one revision or patch name
+  [255]
+
+  $ hg qdel c
+  abort: cannot delete applied patch c
+  [255]
+
+  $ hg qpop
+  popping c
+  now at: b
+
+  $ hg qdel c
+
+  $ hg qseries
+  a
+  b
+
+  $ ls .hg/patches
+  a
+  b
+  series
+  status
+
+  $ hg qpop
+  popping b
+  now at: a
+
+  $ hg qdel -k 1
+
+  $ ls .hg/patches
+  a
+  b
+  series
+  status
+
+  $ hg qdel -r a
+  patch a finalized without changeset message
+
+  $ hg qapplied
+
+  $ hg log --template '{rev} {desc}\n'
+  1 [mq]: a
+  0 base
+
+  $ hg qnew d
+  $ hg qnew e
+  $ hg qnew f
+
+  $ hg qdel -r e
+  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 qapplied
+  f
+
+  $ hg log --template '{rev} {desc}\n'
+  4 [mq]: f
+  3 [mq]: e
+  2 [mq]: d
+  1 [mq]: a
+  0 base
+
+  $ cd ..
+
+  $ hg init b
+  $ cd b
+
+  $ echo 'base' > base
+  $ hg ci -Ambase -d '1 0'
+  adding base
+
+  $ hg qfinish
+  abort: no revisions specified
+  [255]
+
+  $ 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 qfinish 0
+  abort: revision 0 is not managed
+  [255]
+
+  $ hg qfinish b
+  abort: cannot delete revision 2 above applied patches
+  [255]
+
+  $ hg qpop
+  popping c
+  now at: b
+
+  $ hg qfinish -a c
+  abort: unknown revision 'c'!
+  [255]
+
+  $ hg qpush
+  applying c
+  patch c is empty
+  now at: c
+
+  $ hg qfinish qbase:b
+  patch a finalized without changeset message
+  patch b finalized without changeset message
+
+  $ hg qapplied
+  c
+
+  $ hg log --template '{rev} {desc}\n'
+  3 imported patch c
+  2 [mq]: b
+  1 [mq]: a
+  0 base
+
+  $ hg qfinish -a c
+  patch c finalized without changeset message
+
+  $ hg qapplied
+
+  $ hg log --template '{rev} {desc}\n'
+  3 imported patch c
+  2 [mq]: b
+  1 [mq]: a
+  0 base
+
+  $ ls .hg/patches
+  series
+  status
+
--- a/tests/test-mq-qdiff	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-echo "[mq]" >> $HGRCPATH
-echo "git=keep" >> $HGRCPATH
-
-echo % init
-hg init a
-cd a
-
-echo % commit
-echo 'base' > base
-hg ci -Ambase -d '1 0'
-
-echo % qnew mqbase
-hg qnew -mmqbase mqbase
-
-echo % qrefresh
-echo 'patched' > base
-hg qrefresh
-
-echo % qdiff
-hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qdiff dirname
-hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qdiff filename
-hg qdiff --nodates base
-
-echo % revert
-hg revert -a
-
-echo % qpop
-hg qpop
-
-echo % qdelete mqbase
-hg qdelete mqbase
-
-echo % commit 2
-printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
-hg ci -Amlines -d '2 0'
-
-echo % qnew 2
-hg qnew -mmqbase2 mqbase2
-printf '\n\n1\n2\n3\n4\nhello  world\n     goodbye world\n7\n8\n9\n' > lines
-
-echo % qdiff -U 1
-hg qdiff --nodates -U 1
-
-echo % qdiff -b
-hg qdiff --nodates -b
-
-echo % qdiff -U 1 -B
-hg qdiff --nodates -U 1 -B
-
-echo % qdiff -w
-hg qdiff --nodates -w
-
-echo % qdiff --reverse
-hg qdiff --nodates --reverse
-
-echo % qdiff preserve existing git flag
-hg qrefresh --git
-echo a >> lines
-hg qdiff
-
-echo % qdiff --stat
-hg qdiff --stat
--- a/tests/test-mq-qdiff.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-% init
-% commit
-adding base
-% qnew mqbase
-% qrefresh
-% qdiff
-diff -r 67e992f2c4f3 base
---- a/base
-+++ b/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qdiff dirname
-diff -r 67e992f2c4f3 base
---- a/base
-+++ b/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qdiff filename
-diff -r 67e992f2c4f3 base
---- a/base
-+++ b/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% revert
-% qpop
-popping mqbase
-patch queue now empty
-% qdelete mqbase
-% commit 2
-adding lines
-% qnew 2
-% qdiff -U 1
-diff -r 35fb829491c1 lines
---- a/lines
-+++ b/lines
-@@ -1,1 +1,3 @@
-+
-+
- 1
-@@ -4,4 +6,4 @@
- 4
--hello world
--goodbye world
-+hello  world
-+     goodbye world
- 7
-% qdiff -b
-diff -r 35fb829491c1 lines
---- a/lines
-+++ b/lines
-@@ -1,9 +1,11 @@
-+
-+
- 1
- 2
- 3
- 4
- hello world
--goodbye world
-+     goodbye world
- 7
- 8
- 9
-% qdiff -U 1 -B
-diff -r 35fb829491c1 lines
---- a/lines
-+++ b/lines
-@@ -4,4 +6,4 @@
- 4
--hello world
--goodbye world
-+hello  world
-+     goodbye world
- 7
-% qdiff -w
-diff -r 35fb829491c1 lines
---- a/lines
-+++ b/lines
-@@ -1,3 +1,5 @@
-+
-+
- 1
- 2
- 3
-% qdiff --reverse
-diff -r 35fb829491c1 lines
---- a/lines
-+++ b/lines
-@@ -1,11 +1,9 @@
--
--
- 1
- 2
- 3
- 4
--hello  world
--     goodbye world
-+hello world
-+goodbye world
- 7
- 8
- 9
-% qdiff preserve existing git flag
-diff --git a/lines b/lines
---- a/lines
-+++ b/lines
-@@ -1,9 +1,12 @@
-+
-+
- 1
- 2
- 3
- 4
--hello world
--goodbye world
-+hello  world
-+     goodbye world
- 7
- 8
- 9
-+a
-% qdiff --stat
- lines |  7 +++++--
- 1 files changed, 5 insertions(+), 2 deletions(-)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-qdiff.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,166 @@
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+  $ echo "[mq]" >> $HGRCPATH
+  $ echo "git=keep" >> $HGRCPATH
+
+  $ hg init a
+  $ cd a
+
+  $ echo 'base' > base
+  $ hg ci -Ambase
+  adding base
+
+  $ hg qnew -mmqbase mqbase
+
+  $ echo 'patched' > base
+  $ hg qrefresh
+
+qdiff:
+
+  $ hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/"
+  diff -r d20a80d4def3 base
+  --- a/base	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+qdiff dirname:
+
+  $ hg qdiff --nodates .
+  diff -r d20a80d4def3 base
+  --- a/base
+  +++ b/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+qdiff filename:
+
+  $ hg qdiff --nodates base
+  diff -r d20a80d4def3 base
+  --- a/base
+  +++ b/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ hg revert -a
+
+  $ hg qpop
+  popping mqbase
+  patch queue now empty
+
+  $ hg qdelete mqbase
+
+  $ printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
+  $ hg ci -Amlines -d '2 0'
+  adding lines
+
+  $ hg qnew -mmqbase2 mqbase2
+  $ printf '\n\n1\n2\n3\n4\nhello  world\n     goodbye world\n7\n8\n9\n' > lines
+
+  $ hg qdiff --nodates -U 1
+  diff -r b0c220e1cf43 lines
+  --- a/lines
+  +++ b/lines
+  @@ -1,1 +1,3 @@
+  +
+  +
+   1
+  @@ -4,4 +6,4 @@
+   4
+  -hello world
+  -goodbye world
+  +hello  world
+  +     goodbye world
+   7
+
+  $ hg qdiff --nodates -b
+  diff -r b0c220e1cf43 lines
+  --- a/lines
+  +++ b/lines
+  @@ -1,9 +1,11 @@
+  +
+  +
+   1
+   2
+   3
+   4
+   hello world
+  -goodbye world
+  +     goodbye world
+   7
+   8
+   9
+
+  $ hg qdiff --nodates -U 1 -B
+  diff -r b0c220e1cf43 lines
+  --- a/lines
+  +++ b/lines
+  @@ -4,4 +6,4 @@
+   4
+  -hello world
+  -goodbye world
+  +hello  world
+  +     goodbye world
+   7
+
+  $ hg qdiff --nodates -w
+  diff -r b0c220e1cf43 lines
+  --- a/lines
+  +++ b/lines
+  @@ -1,3 +1,5 @@
+  +
+  +
+   1
+   2
+   3
+
+  $ hg qdiff --nodates --reverse
+  diff -r b0c220e1cf43 lines
+  --- a/lines
+  +++ b/lines
+  @@ -1,11 +1,9 @@
+  -
+  -
+   1
+   2
+   3
+   4
+  -hello  world
+  -     goodbye world
+  +hello world
+  +goodbye world
+   7
+   8
+   9
+
+qdiff preserve existing git flag:
+
+  $ hg qrefresh --git
+  $ echo a >> lines
+  $ hg qdiff
+  diff --git a/lines b/lines
+  --- a/lines
+  +++ b/lines
+  @@ -1,9 +1,12 @@
+  +
+  +
+   1
+   2
+   3
+   4
+  -hello world
+  -goodbye world
+  +hello  world
+  +     goodbye world
+   7
+   8
+   9
+  +a
+
+  $ hg qdiff --stat
+   lines |  7 +++++--
+   1 files changed, 5 insertions(+), 2 deletions(-)
+
--- a/tests/test-mq-qfold	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-echo "[mq]" >> $HGRCPATH
-echo "git=keep" >> $HGRCPATH
-
-filterdiff()
-{
-    grep -v diff | \
-	sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-	-e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-}
-
-filterpatch()
-{
-    sed -e "s/\(# Parent \).*/\1/"
-}
-
-echo '% init'
-hg init repo
-cd repo
-echo a > a
-hg ci -Am adda
-echo a >> a
-hg qnew -f p1
-echo b >> a
-hg qnew -f p2
-echo c >> a
-hg qnew -f p3
-echo '% fold in the middle of the queue'
-hg qpop p1
-hg qdiff | filterdiff
-hg qfold p2
-grep git .hg/patches/p1 && echo 'git patch found!'
-hg qser
-hg qdiff | filterdiff
-echo '% fold with local changes'
-echo d >> a
-hg qfold p3
-hg diff -c . | filterdiff
-hg revert -a --no-backup
-
-echo '% fold git patch into a regular patch, expect git patch'
-echo a >> a
-hg qnew -f regular
-hg cp a aa
-hg qnew --git -f git
-hg qpop
-hg qfold git
-cat .hg/patches/regular | filterpatch
-hg qpop
-hg qdel regular
-
-echo '% fold regular patch into a git patch, expect git patch'
-hg cp a aa
-hg qnew --git -f git
-echo b >> aa
-hg qnew -f regular
-hg qpop
-hg qfold regular
-cat .hg/patches/git | filterpatch
-
-cd ..
-
-
--- a/tests/test-mq-qfold.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-% init
-adding a
-% fold in the middle of the queue
-popping p3
-popping p2
-now at: p1
---- a/a
-+++ b/a
-@@ -1,1 +1,2 @@
- a
-+a
-p1
-p3
---- a/a
-+++ b/a
-@@ -1,1 +1,3 @@
- a
-+a
-+b
-% fold with local changes
-abort: local changes found, refresh first
---- a/a
-+++ b/a
-@@ -1,1 +1,3 @@
- a
-+a
-+b
-reverting a
-% fold git patch into a regular patch, expect git patch
-popping git
-now at: regular
-# HG changeset patch
-# Parent 
-
-diff --git a/a b/a
---- a/a
-+++ b/a
-@@ -1,3 +1,4 @@
- a
- a
- b
-+a
-diff --git a/a b/aa
-copy from a
-copy to aa
---- a/a
-+++ b/aa
-@@ -1,3 +1,4 @@
- a
- a
- b
-+a
-popping regular
-now at: p1
-% fold regular patch into a git patch, expect git patch
-popping regular
-now at: git
-# HG changeset patch
-# Parent 
-
-diff --git a/a b/aa
-copy from a
-copy to aa
---- a/a
-+++ b/aa
-@@ -1,3 +1,4 @@
- a
- a
- b
-+b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-qfold.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,144 @@
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+  $ echo "[mq]" >> $HGRCPATH
+  $ echo "git=keep" >> $HGRCPATH
+  $ echo "[diff]" >> $HGRCPATH
+  $ echo "nodates=1" >> $HGRCPATH
+
+init:
+
+  $ hg init repo
+  $ cd repo
+  $ echo a > a
+  $ hg ci -Am adda
+  adding a
+  $ echo a >> a
+  $ hg qnew -f p1
+  $ echo b >> a
+  $ hg qnew -f p2
+  $ echo c >> a
+  $ hg qnew -f p3
+
+Fold in the middle of the queue:
+
+  $ hg qpop p1
+  popping p3
+  popping p2
+  now at: p1
+
+  $ hg qdiff
+  diff -r 07f494440405 a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,2 @@
+   a
+  +a
+
+  $ hg qfold p2
+  $ grep git .hg/patches/p1 && echo 'git patch found!'
+  [1]
+
+  $ hg qser
+  p1
+  p3
+
+  $ hg qdiff
+  diff -r 07f494440405 a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,3 @@
+   a
+  +a
+  +b
+
+Fold with local changes:
+
+  $ echo d >> a
+  $ hg qfold p3
+  abort: local changes found, refresh first
+  [255]
+
+  $ hg diff -c .
+  diff -r 07f494440405 -r ............ a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,3 @@
+   a
+  +a
+  +b
+
+  $ hg revert -a --no-backup
+  reverting a
+
+Fold git patch into a regular patch, expect git patch:
+
+  $ echo a >> a
+  $ hg qnew -f regular
+  $ hg cp a aa
+  $ hg qnew --git -f git
+
+  $ hg qpop
+  popping git
+  now at: regular
+
+  $ hg qfold git
+
+  $ cat .hg/patches/regular
+  # HG changeset patch
+  # Parent ........................................
+  
+  diff --git a/a b/a
+  --- a/a
+  +++ b/a
+  @@ -1,3 +1,4 @@
+   a
+   a
+   b
+  +a
+  diff --git a/a b/aa
+  copy from a
+  copy to aa
+  --- a/a
+  +++ b/aa
+  @@ -1,3 +1,4 @@
+   a
+   a
+   b
+  +a
+
+  $ hg qpop
+  popping regular
+  now at: p1
+
+  $ hg qdel regular
+
+Fold regular patch into a git patch, expect git patch:
+
+  $ hg cp a aa
+  $ hg qnew --git -f git
+  $ echo b >> aa
+  $ hg qnew -f regular
+
+  $ hg qpop
+  popping regular
+  now at: git
+
+  $ hg qfold regular
+
+  $ cat .hg/patches/git
+  # HG changeset patch
+  # Parent ........................................
+  
+  diff --git a/a b/aa
+  copy from a
+  copy to aa
+  --- a/a
+  +++ b/aa
+  @@ -1,3 +1,4 @@
+   a
+   a
+   b
+  +b
+
+  $ cd ..
+
--- a/tests/test-mq-qgoto	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-
-hg init a
-cd a
-echo a > a
-hg ci -Ama
-
-hg qnew a.patch
-echo a >> a
-hg qrefresh
-
-hg qnew b.patch
-echo b > b
-hg add b
-hg qrefresh
-
-hg qnew c.patch
-echo c > c
-hg add c
-hg qrefresh
-
-hg qgoto a.patch
-hg qgoto c.patch
-hg qgoto b.patch
-
-echo
-echo % Using index
-hg qgoto 0
-hg qgoto 2
-
-echo
-echo % No warnings when using index
-hg qnew bug314159
-echo d >> c
-hg qrefresh
-hg qnew bug141421
-echo e >> c
-hg qrefresh
-hg qgoto 1
-hg qgoto 3
-
-echo
-echo % Detect ambiguous non-index
-hg qgoto 14
-
-exit 0
--- a/tests/test-mq-qgoto.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-adding a
-popping c.patch
-popping b.patch
-now at: a.patch
-applying b.patch
-applying c.patch
-now at: c.patch
-popping c.patch
-now at: b.patch
-
-% Using index
-popping b.patch
-now at: a.patch
-applying b.patch
-applying c.patch
-now at: c.patch
-
-% No warnings when using index
-popping bug141421
-popping bug314159
-popping c.patch
-now at: b.patch
-applying c.patch
-applying bug314159
-now at: bug314159
-
-% Detect ambiguous non-index
-patch name "14" is ambiguous:
-  bug314159
-  bug141421
-abort: patch 14 not in series
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-qgoto.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,77 @@
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+
+  $ hg init a
+  $ cd a
+  $ echo a > a
+  $ hg ci -Ama
+  adding a
+
+  $ hg qnew a.patch
+  $ echo a >> a
+  $ hg qrefresh
+
+  $ hg qnew b.patch
+  $ echo b > b
+  $ hg add b
+  $ hg qrefresh
+
+  $ hg qnew c.patch
+  $ echo c > c
+  $ hg add c
+  $ hg qrefresh
+
+  $ hg qgoto a.patch
+  popping c.patch
+  popping b.patch
+  now at: a.patch
+
+  $ hg qgoto c.patch
+  applying b.patch
+  applying c.patch
+  now at: c.patch
+
+  $ hg qgoto b.patch
+  popping c.patch
+  now at: b.patch
+
+Using index:
+
+  $ hg qgoto 0
+  popping b.patch
+  now at: a.patch
+
+  $ hg qgoto 2
+  applying b.patch
+  applying c.patch
+  now at: c.patch
+
+No warnings when using index:
+
+  $ hg qnew bug314159
+  $ echo d >> c
+  $ hg qrefresh
+  $ hg qnew bug141421
+  $ echo e >> c
+  $ hg qrefresh
+
+  $ hg qgoto 1
+  popping bug141421
+  popping bug314159
+  popping c.patch
+  now at: b.patch
+
+  $ hg qgoto 3
+  applying c.patch
+  applying bug314159
+  now at: bug314159
+
+Detect ambiguous non-index:
+
+  $ hg qgoto 14
+  patch name "14" is ambiguous:
+    bug314159
+    bug141421
+  abort: patch 14 not in series
+  [255]
+
--- a/tests/test-mq-qqueue	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-
-hg init foo
-cd foo
-echo a > a
-hg ci -qAm a
-
-echo %% default queue
-hg qqueue
-
-echo b > a
-hg qnew -fgDU somestuff
-
-echo %% applied patches in default queue
-hg qap
-
-echo %% try to change patch \(create succeeds, switch fails\)
-hg qqueue foo --create
-hg qqueue
-
-echo %% empty default queue
-hg qpop
-
-echo %% switch queue
-hg qqueue foo
-hg qqueue
-
-echo %% list queues, quiet
-hg qqueue --quiet
-
-echo %% fail creating queue with already existing name
-hg qqueue --create foo
-hg qqueue
-
-echo %% create new queue for rename
-hg qqueue --create bar
-hg qqueue
-
-echo %% rename queue, same name
-hg qqueue --rename bar
-
-echo %% rename queue to existing
-hg qqueue --rename foo
-
-echo %% rename queue
-hg qqueue --rename buz
-hg qqueue
-
-echo %% switch back to previous queue
-hg qqueue foo
-hg qqueue --delete buz
-hg qqueue
-
-echo %% create queue for purge
-hg qqueue --create purge-me
-hg qqueue
-
-echo %% create patch for purge
-hg qnew patch-purge-me
-ls -1d .hg/patches-purge-me 2>/dev/null || true
-hg qpop -a
-
-echo %% purge queue
-hg qqueue foo
-hg qqueue --purge purge-me
-hg qqueue
-ls -1d .hg/patches-purge-me 2>/dev/null || true
-
-echo %% unapplied patches
-hg qun
-echo c > a
-hg qnew -fgDU otherstuff
-
-echo %% fail switching back
-hg qqueue patches
-
-echo %% fail deleting current
-hg qqueue foo --delete
-
-echo %% switch back and delete foo
-hg qpop -a
-hg qqueue patches
-hg qqueue foo --delete
-hg qqueue
-
-echo %% tricky cases
-hg qqueue store --create
-hg qnew journal
-hg qqueue
-hg qpop -a
-hg qqueue patches
-hg qun
-
-echo %% invalid names
-hg qqueue test/../../bar --create
-hg qqueue . --create
-
-cd ..
--- a/tests/test-mq-qqueue.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-%% default queue
-patches (active)
-%% applied patches in default queue
-somestuff
-%% try to change patch (create succeeds, switch fails)
-abort: patches applied - cannot set new queue active
-foo
-patches (active)
-%% empty default queue
-popping somestuff
-patch queue now empty
-%% switch queue
-foo (active)
-patches
-%% list queues, quiet
-foo
-patches
-%% fail creating queue with already existing name
-abort: queue "foo" already exists
-foo (active)
-patches
-%% create new queue for rename
-bar (active)
-foo
-patches
-%% rename queue, same name
-abort: can't rename "bar" to its current name
-%% rename queue to existing
-abort: queue "foo" already exists
-%% rename queue
-buz (active)
-foo
-patches
-%% switch back to previous queue
-foo (active)
-patches
-%% create queue for purge
-foo
-patches
-purge-me (active)
-%% create patch for purge
-.hg/patches-purge-me
-popping patch-purge-me
-patch queue now empty
-%% purge queue
-foo (active)
-patches
-%% unapplied patches
-%% fail switching back
-abort: patches applied - cannot set new queue active
-%% fail deleting current
-abort: cannot delete currently active queue
-%% switch back and delete foo
-popping otherstuff
-patch queue now empty
-patches (active)
-%% tricky cases
-patches
-store (active)
-popping journal
-patch queue now empty
-somestuff
-%% invalid names
-abort: invalid queue name, may not contain the characters ":\/."
-abort: invalid queue name, may not contain the characters ":\/."
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-qqueue.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,188 @@
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+
+  $ hg init foo
+  $ cd foo
+  $ echo a > a
+  $ hg ci -qAm a
+
+Default queue:
+
+  $ hg qqueue
+  patches (active)
+
+  $ echo b > a
+  $ hg qnew -fgDU somestuff
+
+Applied patches in default queue:
+
+  $ hg qap
+  somestuff
+
+Try to change patch (create succeeds, switch fails):
+
+  $ hg qqueue foo --create
+  abort: patches applied - cannot set new queue active
+  [255]
+
+  $ hg qqueue
+  foo
+  patches (active)
+
+Empty default queue:
+
+  $ hg qpop
+  popping somestuff
+  patch queue now empty
+
+Switch queue:
+
+  $ hg qqueue foo
+  $ hg qqueue
+  foo (active)
+  patches
+
+List queues, quiet:
+
+  $ hg qqueue --quiet
+  foo
+  patches
+
+Fail creating queue with already existing name:
+
+  $ hg qqueue --create foo
+  abort: queue "foo" already exists
+  [255]
+
+  $ hg qqueue
+  foo (active)
+  patches
+
+Create new queue for rename:
+
+  $ hg qqueue --create bar
+
+  $ hg qqueue
+  bar (active)
+  foo
+  patches
+
+Rename queue, same name:
+
+  $ hg qqueue --rename bar
+  abort: can't rename "bar" to its current name
+  [255]
+
+Rename queue to existing:
+
+  $ hg qqueue --rename foo
+  abort: queue "foo" already exists
+  [255]
+
+Rename queue:
+
+  $ hg qqueue --rename buz
+
+  $ hg qqueue
+  buz (active)
+  foo
+  patches
+
+Switch back to previous queue:
+
+  $ hg qqueue foo
+  $ hg qqueue --delete buz
+
+  $ hg qqueue
+  foo (active)
+  patches
+
+Create queue for purge:
+
+  $ hg qqueue --create purge-me
+
+  $ hg qqueue
+  foo
+  patches
+  purge-me (active)
+
+Create patch for purge:
+
+  $ hg qnew patch-purge-me
+
+  $ ls -1d .hg/patches-purge-me 2>/dev/null || true
+  .hg/patches-purge-me
+
+  $ hg qpop -a
+  popping patch-purge-me
+  patch queue now empty
+
+Purge queue:
+
+  $ hg qqueue foo
+  $ hg qqueue --purge purge-me
+
+  $ hg qqueue
+  foo (active)
+  patches
+
+  $ ls -1d .hg/patches-purge-me 2>/dev/null || true
+
+Unapplied patches:
+
+  $ hg qun
+  $ echo c > a
+  $ hg qnew -fgDU otherstuff
+
+Fail switching back:
+
+  $ hg qqueue patches
+  abort: patches applied - cannot set new queue active
+  [255]
+
+Fail deleting current:
+
+  $ hg qqueue foo --delete
+  abort: cannot delete currently active queue
+  [255]
+
+Switch back and delete foo:
+
+  $ hg qpop -a
+  popping otherstuff
+  patch queue now empty
+
+  $ hg qqueue patches
+  $ hg qqueue foo --delete
+  $ hg qqueue
+  patches (active)
+
+Tricky cases:
+
+  $ hg qqueue store --create
+  $ hg qnew journal
+
+  $ hg qqueue
+  patches
+  store (active)
+
+  $ hg qpop -a
+  popping journal
+  patch queue now empty
+
+  $ hg qqueue patches
+  $ hg qun
+  somestuff
+
+Invalid names:
+
+  $ hg qqueue test/../../bar --create
+  abort: invalid queue name, may not contain the characters ":\/."
+  [255]
+
+  $ hg qqueue . --create
+  abort: invalid queue name, may not contain the characters ":\/."
+  [255]
+
+  $ cd ..
+
--- a/tests/test-mq-qrefresh	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-
-catpatch() {
-    cat $1 | sed -e "s/^\(# Parent \).*/\1/"
-}
-
-echo % init
-hg init a
-cd a
-
-echo % commit
-mkdir 1 2
-echo 'base' > 1/base
-echo 'base' > 2/base
-hg ci -Ambase -d '1 0'
-
-echo % qnew mqbase
-hg qnew -mmqbase mqbase
-
-echo % qrefresh
-echo 'patched' > 1/base
-echo 'patched' > 2/base
-hg qrefresh
-
-echo % qdiff
-hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qdiff dirname
-hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % patch file contents
-catpatch .hg/patches/mqbase | \
-sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qrefresh 1
-echo 'patched again' > base
-hg qrefresh 1
-
-echo % qdiff
-hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qdiff dirname
-hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % patch file contents
-catpatch .hg/patches/mqbase | \
-sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qrefresh . in subdir
-( cd 1 ; hg qrefresh . )
-
-echo % qdiff
-hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qdiff dirname
-hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % patch file contents
-catpatch .hg/patches/mqbase | \
-sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qrefresh in hg-root again
-hg qrefresh
-
-echo % qdiff
-hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % qdiff dirname
-hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % patch file contents
-catpatch .hg/patches/mqbase | \
-sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo
-echo % qrefresh --short tests:
-echo 'orphan' > orphanchild
-hg add orphanchild
-
-echo % - add 1/base and 2/base one by one
-hg qrefresh nonexistingfilename # clear patch
-hg qrefresh --short 1/base
-hg qrefresh --short 2/base
-
-echo % -- qdiff output
-hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-
-echo % -- patch file content
-catpatch .hg/patches/mqbase | \
-sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
-hg st
-
-echo % -- diff shows what is not in patch
-hg diff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
-              -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
-              -e "s/^\(diff\).*/\1/"
-echo % - before starting exclusive tests
-sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
-echo % - exclude 2/base
-hg qref -s -X 2/base
-sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
-echo % -- status shows 2/base as dirty
-hg st
-echo % - remove 1/base and add 2/base again but not orphanchild
-hg qref -s -X orphanchild -X 1/base 2/base orphanchild
-sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
-echo % - add 1/base with include filter - and thus remove 2/base from patch
-hg qref -s -I 1/ o* */*
-sed -n '/^diff/s/diff -r [^ ]* //p' .hg/patches/mqbase
-echo
-cd ..
-
-# Test qrefresh --git losing copy metadata
-echo % create test repo
-hg init repo
-cd repo
-echo "[diff]" >> .hg/hgrc
-echo "git=True" >> .hg/hgrc
-echo a > a
-hg ci -Am adda
-hg copy a ab
-echo b >> ab
-hg copy a ac
-echo c >> ac
-echo % capture changes
-hg qnew -f p1
-hg qdiff
-echo % refresh and check changes again
-hg qref
-hg qdiff
-cd ..
-
-# Test issue 1441: qrefresh confused after hg rename
-echo % issue1441 without git patches
-hg init repo-1441
-cd repo-1441
-echo a > a
-hg add a
-hg qnew -f p
-hg mv a b
-hg qrefresh
-hg qdiff --nodates
-cd ..
-
-echo '% issue2025: qrefresh does not honor filtering options when tip != qtip'
-hg init repo-2025
-cd repo-2025
-echo a > a
-echo b > b
-hg ci -qAm addab
-echo a >> a
-echo b >> b
-hg qnew -f patch
-hg up -qC 0
-echo c > c
-hg ci -qAm addc
-hg up -qC 1
-echo '% refresh with tip != qtip'
-hg --config diff.nodates=1 qrefresh -I b 2>&1 \
-    | sed 's/saving bundle.*/saving bundle.../g'
-echo '% status after refresh'
-hg st
-echo '% b after refresh'
-cat b
-echo '% patch file after refresh'
-catpatch .hg/patches/patch
-cd ..
-
-
-echo % issue1441 with git patches
-hg init repo-1441-git
-cd repo-1441-git
-echo "[diff]" >> .hg/hgrc
-echo "git=True" >> .hg/hgrc
-echo a > a
-hg add a
-hg qnew -f p
-hg mv a b
-hg qrefresh
-hg qdiff --nodates
-cd ..
--- a/tests/test-mq-qrefresh.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,295 +0,0 @@
-% init
-% commit
-adding 1/base
-adding 2/base
-% qnew mqbase
-% qrefresh
-% qdiff
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qdiff dirname
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% patch file contents
-# HG changeset patch
-# Parent 
-mqbase
-
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qrefresh 1
-% qdiff
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qdiff dirname
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% patch file contents
-# HG changeset patch
-# Parent 
-mqbase
-
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qrefresh . in subdir
-% qdiff
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qdiff dirname
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% patch file contents
-# HG changeset patch
-# Parent 
-mqbase
-
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qrefresh in hg-root again
-% qdiff
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% qdiff dirname
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-% patch file contents
-# HG changeset patch
-# Parent 
-mqbase
-
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-
-% qrefresh --short tests:
-% - add 1/base and 2/base one by one
-% -- qdiff output
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf orphanchild
---- /dev/null
-+++ b/orphanchild
-@@ -0,0 +1,1 @@
-+orphan
-% -- patch file content
-# HG changeset patch
-# Parent 
-mqbase
-
-diff -r b55ecdccb5cf 1/base
---- a/1/base
-+++ b/1/base
-@@ -1,1 +1,1 @@
--base
-+patched
-diff -r b55ecdccb5cf 2/base
---- a/2/base
-+++ b/2/base
-@@ -1,1 +1,1 @@
--base
-+patched
-A orphanchild
-? base
-% -- diff shows what is not in patch
-diff
---- /dev/null
-+++ b/orphanchild
-@@ -0,0 +1,1 @@
-+orphan
-% - before starting exclusive tests
-1/base
-2/base
-% - exclude 2/base
-1/base
-% -- status shows 2/base as dirty
-M 2/base
-A orphanchild
-? base
-% - remove 1/base and add 2/base again but not orphanchild
-2/base
-% - add 1/base with include filter - and thus remove 2/base from patch
-1/base
-
-% create test repo
-adding a
-% capture changes
-diff --git a/a b/ab
-copy from a
-copy to ab
---- a/a
-+++ b/ab
-@@ -1,1 +1,2 @@
- a
-+b
-diff --git a/a b/ac
-copy from a
-copy to ac
---- a/a
-+++ b/ac
-@@ -1,1 +1,2 @@
- a
-+c
-% refresh and check changes again
-diff --git a/a b/ab
-copy from a
-copy to ab
---- a/a
-+++ b/ab
-@@ -1,1 +1,2 @@
- a
-+b
-diff --git a/a b/ac
-copy from a
-copy to ac
---- a/a
-+++ b/ac
-@@ -1,1 +1,2 @@
- a
-+c
-% issue1441 without git patches
-diff -r 000000000000 b
---- /dev/null
-+++ b/b
-@@ -0,0 +1,1 @@
-+a
-% issue2025: qrefresh does not honor filtering options when tip != qtip
-% refresh with tip != qtip
-% status after refresh
-M a
-% b after refresh
-b
-b
-% patch file after refresh
-# HG changeset patch
-# Parent 
-
-diff -r 1a60229be7ac b
---- a/b
-+++ b/b
-@@ -1,1 +1,2 @@
- b
-+b
-% issue1441 with git patches
-diff --git a/b b/b
-new file mode 100644
---- /dev/null
-+++ b/b
-@@ -0,0 +1,1 @@
-+a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-qrefresh.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,488 @@
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+  $ echo "[diff]" >> $HGRCPATH
+  $ echo "nodates=1" >> $HGRCPATH
+
+  $ hg init a
+  $ cd a
+
+  $ mkdir 1 2
+  $ echo 'base' > 1/base
+  $ echo 'base' > 2/base
+  $ hg ci -Ambase
+  adding 1/base
+  adding 2/base
+
+  $ hg qnew -mmqbase mqbase
+
+  $ echo 'patched' > 1/base
+  $ echo 'patched' > 2/base
+  $ hg qrefresh
+
+  $ hg qdiff
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ hg qdiff .
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ echo 'patched again' > base
+  $ hg qrefresh 1
+
+  $ hg qdiff
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ hg qdiff .
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+qrefresh . in subdir:
+
+  $ ( cd 1 ; hg qrefresh . )
+
+  $ hg qdiff
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ hg qdiff .
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+qrefresh in hg-root again:
+
+  $ hg qrefresh
+
+  $ hg qdiff
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ hg qdiff .
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+
+qrefresh --short tests:
+
+  $ echo 'orphan' > orphanchild
+  $ hg add orphanchild
+  $ hg qrefresh nonexistingfilename # clear patch
+  $ hg qrefresh --short 1/base
+  $ hg qrefresh --short 2/base
+
+  $ hg qdiff
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 orphanchild
+  --- /dev/null
+  +++ b/orphanchild
+  @@ -0,0 +1,1 @@
+  +orphan
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ hg st
+  A orphanchild
+  ? base
+
+diff shows what is not in patch:
+
+  $ hg diff
+  diff -r ............ orphanchild
+  --- /dev/null
+  +++ b/orphanchild
+  @@ -0,0 +1,1 @@
+  +orphan
+
+Before starting exclusive tests:
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+Exclude 2/base:
+
+  $ hg qref -s -X 2/base
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+status shows 2/base as dirty:
+
+  $ hg status
+  M 2/base
+  A orphanchild
+  ? base
+
+Remove 1/base and add 2/base again but not orphanchild:
+
+  $ hg qref -s -X orphanchild -X 1/base 2/base orphanchild
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 2/base
+  --- a/2/base
+  +++ b/2/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+Add 1/base with include filter - and thus remove 2/base from patch:
+
+  $ hg qref -s -I 1/ o* */*
+
+  $ cat .hg/patches/mqbase
+  # HG changeset patch
+  # Parent e7af5904b465cd1f4f3cf6b26fe14e8db6f63eaa
+  mqbase
+  
+  diff -r e7af5904b465 1/base
+  --- a/1/base
+  +++ b/1/base
+  @@ -1,1 +1,1 @@
+  -base
+  +patched
+
+  $ cd ..
+
+
+Test qrefresh --git losing copy metadata:
+
+  $ hg init repo
+  $ cd repo
+
+  $ echo "[diff]" >> .hg/hgrc
+  $ echo "git=True" >> .hg/hgrc
+  $ echo a > a
+
+  $ hg ci -Am adda
+  adding a
+  $ hg copy a ab
+  $ echo b >> ab
+  $ hg copy a ac
+  $ echo c >> ac
+
+Capture changes:
+
+  $ hg qnew -f p1
+
+  $ hg qdiff
+  diff --git a/a b/ab
+  copy from a
+  copy to ab
+  --- a/a
+  +++ b/ab
+  @@ -1,1 +1,2 @@
+   a
+  +b
+  diff --git a/a b/ac
+  copy from a
+  copy to ac
+  --- a/a
+  +++ b/ac
+  @@ -1,1 +1,2 @@
+   a
+  +c
+
+Refresh and check changes again:
+
+  $ hg qrefresh
+
+  $ hg qdiff
+  diff --git a/a b/ab
+  copy from a
+  copy to ab
+  --- a/a
+  +++ b/ab
+  @@ -1,1 +1,2 @@
+   a
+  +b
+  diff --git a/a b/ac
+  copy from a
+  copy to ac
+  --- a/a
+  +++ b/ac
+  @@ -1,1 +1,2 @@
+   a
+  +c
+
+  $ cd ..
+
+
+Test issue 1441: qrefresh confused after hg rename:
+
+  $ hg init repo-1441
+  $ cd repo-1441
+  $ echo a > a
+  $ hg add a
+  $ hg qnew -f p
+  $ hg mv a b
+  $ hg qrefresh
+
+  $ hg qdiff
+  diff -r 000000000000 b
+  --- /dev/null
+  +++ b/b
+  @@ -0,0 +1,1 @@
+  +a
+
+  $ cd ..
+
+
+Issue2025: qrefresh does not honor filtering options when tip != qtip:
+
+  $ hg init repo-2025
+  $ cd repo-2025
+  $ echo a > a
+  $ echo b > b
+  $ hg ci -qAm addab
+  $ echo a >> a
+  $ echo b >> b
+  $ hg qnew -f patch
+  $ hg up -qC 0
+  $ echo c > c
+  $ hg ci -qAm addc
+  $ hg up -qC 1
+
+refresh with tip != qtip:
+
+  $ hg --config diff.nodates=1 qrefresh -I b
+
+  $ hg st
+  M a
+
+  $ cat b
+  b
+  b
+
+  $ cat .hg/patches/patch
+  # HG changeset patch
+  # Parent 1a60229be7ac3e4a7f647508e99b87bef1f03593
+  
+  diff -r 1a60229be7ac b
+  --- a/b
+  +++ b/b
+  @@ -1,1 +1,2 @@
+   b
+  +b
+
+  $ cd ..
+
+
+Issue1441 with git patches:
+
+  $ hg init repo-1441-git
+  $ cd repo-1441-git
+
+  $ echo "[diff]" >> .hg/hgrc
+  $ echo "git=True" >> .hg/hgrc
+
+  $ echo a > a
+  $ hg add a
+  $ hg qnew -f p
+  $ hg mv a b
+  $ hg qrefresh
+
+  $ hg qdiff --nodates
+  diff --git a/b b/b
+  new file mode 100644
+  --- /dev/null
+  +++ b/b
+  @@ -0,0 +1,1 @@
+  +a
+
+  $ cd ..
+
--- a/tests/test-mq-qrename	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-
-hg init a
-cd a
-
-echo 'base' > base
-hg ci -Ambase -d '1 0'
-
-hg qnew -mmqbase mqbase
-hg qrename mqbase renamed
-mkdir .hg/patches/foo
-hg qrename renamed foo
-hg qseries
-ls .hg/patches/foo
-mkdir .hg/patches/bar
-hg qrename foo/renamed bar
-hg qseries
-ls .hg/patches/bar
-hg qrename bar/renamed baz
-hg qseries
-ls .hg/patches/baz
-hg qrename baz new/dir
-hg qseries
-ls .hg/patches/new/dir
-cd ..
-
-echo % test patch being renamed before committed
-hg init b
-cd b
-hg qinit -c
-hg qnew x
-hg qrename y
-hg qcommit -m rename
-cd ..
-
-
--- a/tests/test-mq-qrename.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-adding base
-foo/renamed
-renamed
-bar/renamed
-renamed
-baz
-.hg/patches/baz
-new/dir
-.hg/patches/new/dir
-% test patch being renamed before committed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-qrename.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,62 @@
+
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+
+  $ hg init a
+  $ cd a
+
+  $ echo 'base' > base
+  $ hg ci -Ambase
+  adding base
+
+  $ hg qnew -mmqbase mqbase
+
+  $ hg qrename mqbase renamed
+  $ mkdir .hg/patches/foo
+  $ hg qrename renamed foo
+
+  $ hg qseries
+  foo/renamed
+
+  $ ls .hg/patches/foo
+  renamed
+
+  $ mkdir .hg/patches/bar
+  $ hg qrename foo/renamed bar
+
+  $ hg qseries
+  bar/renamed
+
+  $ ls .hg/patches/bar
+  renamed
+
+  $ hg qrename bar/renamed baz
+
+  $ hg qseries
+  baz
+
+  $ ls .hg/patches/baz
+  .hg/patches/baz
+
+  $ hg qrename baz new/dir
+
+  $ hg qseries
+  new/dir
+
+  $ ls .hg/patches/new/dir
+  .hg/patches/new/dir
+
+  $ cd ..
+
+Test patch being renamed before committed:
+
+  $ hg init b
+  $ cd b
+  $ hg qinit -c
+  $ hg qnew x
+  $ hg qrename y
+  $ hg qcommit -m rename
+
+  $ cd ..
+
+
--- a/tests/test-mq-qsave	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "mq=" >> $HGRCPATH
-
-hg init a
-cd a
-
-echo 'base' > base
-hg ci -Ambase -d '1 0'
-
-hg qnew -mmqbase mqbase
-
-hg qsave
-hg qrestore 2
--- a/tests/test-mq-qsave.out	Tue Sep 21 00:25:25 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-adding base
-restoring status: hg patches saved state
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-mq-qsave.t	Tue Sep 21 01:55:53 2010 -0300
@@ -0,0 +1,15 @@
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "mq=" >> $HGRCPATH
+
+  $ hg init
+
+  $ echo 'base' > base
+  $ hg ci -Ambase
+  adding base
+
+  $ hg qnew -mmqbase mqbase
+
+  $ hg qsave
+  $ hg qrestore 2
+  restoring status: hg patches saved state
+
--- a/tests/test-mq-symlinks.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-mq-symlinks.t	Tue Sep 21 01:55:53 2010 -0300
@@ -88,3 +88,33 @@
   C b
   C c
   C s
+
+replace broken symlink with another broken symlink
+
+  $ ln -s linka linka
+  $ hg add linka
+  $ hg qnew link
+  $ hg mv linka linkb
+  $ ln -sf linkb linkb
+  $ hg qnew movelink
+  $ hg qpop
+  popping movelink
+  now at: link
+  $ hg qpush
+  applying movelink
+  now at: movelink
+  $ $TESTDIR/readlink.py linkb
+  linkb -> linkb
+
+check patch does not overwrite untracked symlinks
+
+  $ hg qpop
+  popping movelink
+  now at: link
+  $ ln -s linkbb linkb
+  $ hg qpush
+  applying movelink
+  patch failed, unable to continue (try -v)
+  patch failed, rejects left in working dir
+  errors during apply, please fix and refresh movelink
+  [2]
--- a/tests/test-paths.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-paths.t	Tue Sep 21 01:55:53 2010 -0300
@@ -14,4 +14,3 @@
   comparing with .*/test-paths.t/b
   no changes found
   [1]
-  $ true
--- a/tests/test-pull.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-pull.t	Tue Sep 21 01:55:53 2010 -0300
@@ -73,8 +73,8 @@
 
   $ hg pull -q file:../test
 
-# It's tricky to make file:// URLs working on every platforms
-# with regular shell commands.
+It's tricky to make file:// URLs working on every platform with
+regular shell commands.
 
   $ URL=`python -c "import os; print 'file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
   $ hg pull -q "$URL"
--- a/tests/test-push-validation.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-push-validation.t	Tue Sep 21 01:55:53 2010 -0300
@@ -50,5 +50,3 @@
   abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify
   [255]
 
-  $ true
-
--- a/tests/test-push-warn.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-push-warn.t	Tue Sep 21 01:55:53 2010 -0300
@@ -466,8 +466,8 @@
   $ hg ci -Amb
   adding b
 
-# b is now branch head of B, and a topological head
-# a is now branch head of A, but not a topological head
+b is now branch head of B, and a topological head
+a is now branch head of A, but not a topological head
 
   $ hg clone . inner
   updating to branch B
@@ -479,7 +479,7 @@
   $ hg ci -Amb1
   adding b1
 
-# in the clone b1 is now the head of B
+in the clone b1 is now the head of B
 
   $ cd ..
   $ hg up 0
@@ -488,8 +488,9 @@
   $ hg ci -Ama2
   adding a2
 
-# a2 is now the new branch head of A, and a new topological head
-# it replaces a former inner branch head, so it should at most warn about A, not B
+a2 is now the new branch head of A, and a new topological head 
+it replaces a former inner branch head, so it should at most warn about
+A, not B
 
 glog of local:
 
@@ -542,7 +543,7 @@
   $ hg ci -Amb
   adding b
 
-# b is now branch head of B, and a topological head
+b is now branch head of B, and a topological head
 
   $ hg up 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -550,7 +551,7 @@
   $ hg ci -Ama1
   adding a1
 
-# a1 is now branch head of A, and a topological head
+a1 is now branch head of A, and a topological head
 
   $ hg clone . inner
   updating to branch A
@@ -562,15 +563,15 @@
   $ hg ci -Amb1
   adding b1
 
-# in the clone b1 is now the head of B
+in the clone b1 is now the head of B
 
   $ cd ..
   $ echo a2 >a2
   $ hg ci -Ama2
   adding a2
 
-# a2 is now the new branch head of A, and a topological head
-# it replaces a former topological and branch head, so this should not warn
+a2 is now the new branch head of A, and a topological head
+it replaces a former topological and branch head, so this should not warn
 
 glog of local:
 
@@ -706,6 +707,3 @@
   searching for changes
   no changes found
   [1]
-
-  $ cd ..
-
--- a/tests/test-record.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-record.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,57 +1,10 @@
-#!/bin/sh
+Set up a repo
 
   $ echo "[ui]" >> $HGRCPATH
   $ echo "interactive=true" >> $HGRCPATH
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "record=" >> $HGRCPATH
 
-Help
-
-  $ hg help record
-  hg record [OPTION]... [FILE]...
-  
-  interactively select changes to commit
-  
-      If a list of files is omitted, all changes reported by "hg status" will be
-      candidates for recording.
-  
-      See "hg help dates" for a list of formats valid for -d/--date.
-  
-      You will be prompted for whether to record changes to each modified file,
-      and for files with multiple changes, for each change to use. For each
-      query, the following responses are possible:
-  
-        y - record this change
-        n - skip this change
-  
-        s - skip remaining changes to this file
-        f - record remaining changes to this file
-  
-        d - done, skip remaining changes and files
-        a - record all changes to all remaining files
-        q - quit, recording no changes
-  
-        ? - display help
-  
-      This command is not available when committing a merge.
-  
-  options:
-  
-   -A --addremove            mark new/missing files as added/removed before
-                             committing
-      --close-branch         mark a branch as closed, hiding it from the branch
-                             list
-   -I --include PATTERN [+]  include names matching the given patterns
-   -X --exclude PATTERN [+]  exclude names matching the given patterns
-   -m --message TEXT         use text as commit message
-   -l --logfile FILE         read commit message from file
-   -d --date DATE            record datecode as commit date
-   -u --user USER            record the specified user as committer
-  
-  [+] marked option can be specified multiple times
-  
-  use "hg -v help record" to show global options
-
   $ hg init a
   $ cd a
 
--- a/tests/test-remove-new.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-remove-new.t	Tue Sep 21 01:55:53 2010 -0300
@@ -11,4 +11,3 @@
   removing b
   nothing changed
   [1]
-  $ exit 0
--- a/tests/test-rename-after-merge.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-rename-after-merge.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,5 +1,5 @@
-# Test issue 746: renaming files brought by the
-# second parent of a merge was broken.
+Test issue 746: renaming files brought by the second parent of a merge
+was broken.
 
 Create source repository:
 
@@ -59,9 +59,8 @@
 
   $ cd ..
 
-# Test issue 1476: renaming a first parent file into
-# another first parent file while none of them belong to
-# the second parent was broken
+Test issue 1476: renaming a first parent file into another first
+parent file while none of them belong to the second parent was broken
 
   $ hg init repo1476
   $ cd repo1476
--- a/tests/test-rename.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-rename.t	Tue Sep 21 01:55:53 2010 -0300
@@ -372,6 +372,17 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm d1/ca
 
+attempt to overwrite an existing broken symlink
+
+  $ ln -s ba d1/ca
+  $ hg rename --traceback d1/ba d1/ca
+  d1/ca: not overwriting - file exists
+  $ hg status -C
+  ? d1/ca
+  $ hg update -C
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm d1/ca
+
 replace a symlink with a file
 
   $ ln -s ba d1/ca
--- a/tests/test-requires.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-requires.t	Tue Sep 21 01:55:53 2010 -0300
@@ -12,5 +12,3 @@
   $ hg tip
   abort: requirement 'indoor-pool' not supported!
   [255]
-
-  $ true
--- a/tests/test-revlog-group-emptyiter.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-revlog-group-emptyiter.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,5 @@
-# issue 1678
+issue 1678
+
 setting up base repo
   $ hg init a
   $ cd a
--- a/tests/test-revset.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-revset.t	Tue Sep 21 01:55:53 2010 -0300
@@ -211,6 +211,10 @@
   9
   $ log 'grep("issue\d+")'
   6
+  $ try 'grep("(")' # invalid regular expression
+  ('func', ('symbol', 'grep'), ('string', '('))
+  hg: parse error: invalid match pattern: unbalanced parenthesis
+  [255]
   $ log 'head()'
   0
   1
--- a/tests/test-status-color.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-status-color.t	Tue Sep 21 01:55:53 2010 -0300
@@ -178,7 +178,7 @@
   I ignoreddir/file
   $ cd ..
 
-# check 'status -q' and some combinations
+check 'status -q' and some combinations
 
   $ hg init repo3
   $ cd repo3
@@ -207,9 +207,10 @@
   ! deleted
   ? unknown
 
-# Run status with 2 different flags.
-# Check if result is the same or different.
-# If result is not as expected, raise error
+Run status with 2 different flags.
+Check if result is the same or different.
+If result is not as expected, raise error
+
   $ assert() {
   >     hg status --color=always $1 > ../a
   >     hg status --color=always $2 > ../b
@@ -229,7 +230,7 @@
   >     fi
   > }
 
-# assert flag1 flag2 [0-same | 1-different]
+assert flag1 flag2 [0-same | 1-different]
 
   $ assert "-q" "-mard"      0
   $ assert "-A" "-marduicC"  0
@@ -243,7 +244,8 @@
   $ assert "-r" "-d"         1
   $ cd ..
 
-# test 'resolve -l'
+test 'resolve -l'
+
   $ hg init repo4
   $ cd repo4
   $ echo "file a" > a
--- a/tests/test-status.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-status.t	Tue Sep 21 01:55:53 2010 -0300
@@ -173,7 +173,7 @@
   I ignoreddir/file
   $ cd ..
 
-# check 'status -q' and some combinations
+Check 'status -q' and some combinations
 
   $ hg init repo3
   $ cd repo3
@@ -191,9 +191,9 @@
   $ rm deleted
   $ hg copy modified copied
 
-# Run status with 2 different flags.
-# Check if result is the same or different.
-# If result is not as expected, raise error
+Run status with 2 different flags.
+Check if result is the same or different.
+If result is not as expected, raise error
 
   $ assert() {
   >    hg status $1 > ../a
@@ -214,7 +214,7 @@
   >     fi
   > }
 
-# assert flag1 flag2 [0-same | 1-different]
+Assert flag1 flag2 [0-same | 1-different]
 
   $ assert "-q" "-mard"      0
   $ assert "-A" "-marduicC"  0
--- a/tests/test-subrepo-deep-nested-change.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-subrepo-deep-nested-change.t	Tue Sep 21 01:55:53 2010 -0300
@@ -115,5 +115,3 @@
   path sub2
    source   ../sub2
    revision 53dd3430bcaf5ab4a7c48262bcad6d441f510487
-
-  $ exit 0
--- a/tests/test-subrepo-paths.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-subrepo-paths.t	Tue Sep 21 01:55:53 2010 -0300
@@ -30,5 +30,3 @@
   $ hg debugsub
   abort: bad subrepository pattern in .*/test-subrepo-paths.t/outer/.hg/hgrc:2: invalid group reference
   [255]
-
-  $ exit 0
--- a/tests/test-subrepo-recursion.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-subrepo-recursion.t	Tue Sep 21 01:55:53 2010 -0300
@@ -227,6 +227,26 @@
    z1
   +z2
 
+Test archiving to a directory tree:
+
+  $ hg archive --subrepos ../archive
+  $ find ../archive
+  ../archive
+  ../archive/foo
+  ../archive/foo/bar
+  ../archive/foo/bar/z.txt
+  ../archive/foo/.hgsubstate
+  ../archive/foo/.hgsub
+  ../archive/foo/y.txt
+  ../archive/x.txt
+  ../archive/.hgsubstate
+  ../archive/.hgsub
+  ../archive/.hg_archival.txt
+
+Test archiving to zip file (unzip output is unstable):
+
+  $ hg archive --subrepos ../archive.zip
+
 Clone and test outgoing:
 
   $ cd ..
--- a/tests/test-subrepo-relative-path.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-subrepo-relative-path.t	Tue Sep 21 01:55:53 2010 -0300
@@ -67,5 +67,3 @@
    revision 863c1745b441bd97a8c4a096e87793073f4fb215
 
   $ "$TESTDIR/killdaemons.py"
-
-  $ exit 0
--- a/tests/test-subrepo.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-subrepo.t	Tue Sep 21 01:55:53 2010 -0300
@@ -584,5 +584,3 @@
   $ hg -R repo update
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm -rf repo2 repo
-
-  $ exit 0
--- a/tests/test-tags.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-tags.t	Tue Sep 21 01:55:53 2010 -0300
@@ -368,4 +368,3 @@
   tip                                1:a0b6fe111088
   localtag                           0:bbd179dfa0a7 local
   globaltag                          0:bbd179dfa0a7
-  $ exit 0
--- a/tests/test-update-branches.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-update-branches.t	Tue Sep 21 01:55:53 2010 -0300
@@ -69,8 +69,8 @@
   >     hg stat
   > }    
 
-# Test cases are documented in a table in the update function of merge.py.
-# Cases are run as shown in that table, row by row.
+Test cases are documented in a table in the update function of merge.py.
+Cases are run as shown in that table, row by row.
 
   $ norevtest 'none clean linear' clean 4
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-update-renames.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-update-renames.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,6 +1,6 @@
-# test update logic when there are renames
+Test update logic when there are renames
 
-# update with local changes across a file rename
+Update with local changes across a file rename
 
   $ hg init
 
--- a/tests/test-url-rev.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-url-rev.t	Tue Sep 21 01:55:53 2010 -0300
@@ -1,4 +1,4 @@
-# test basic functionality of url#rev syntax
+Test basic functionality of url#rev syntax
 
   $ hg init repo
   $ cd repo
--- a/tests/test-username-newline.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-username-newline.t	Tue Sep 21 01:55:53 2010 -0300
@@ -23,5 +23,3 @@
   abort: username 'foo\nbar3' contains a newline!
   [255]
 
-  $ true
-
--- a/tests/test-verify.t	Tue Sep 21 00:25:25 2010 +0000
+++ b/tests/test-verify.t	Tue Sep 21 01:55:53 2010 -0300
@@ -99,5 +99,3 @@
   crosschecking files in changesets and manifests
   checking files
   1 files, 1 changesets, 1 total revisions
-
-  $ exit 0