changeset 12293:2ba12ffc1a32

merge with i18n
author Matt Mackall <mpm@selenic.com>
date Tue, 14 Sep 2010 16:21:01 -0500
parents d8707306d667 (diff) 5f1f0ff652a9 (current diff)
children f2f6d838064a
files
diffstat 131 files changed, 5571 insertions(+), 5138 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/win32/mercurial.iss	Mon Sep 13 01:37:56 2010 +0000
+++ b/contrib/win32/mercurial.iss	Tue Sep 14 16:21:01 2010 -0500
@@ -16,10 +16,22 @@
 #pragma message "Detected Version: " + VERSION
 #endif
 
+#ifndef ARCH
+#define ARCH = "x86"
+#endif
+
 [Setup]
 AppCopyright=Copyright 2005-2010 Matt Mackall and others
 AppName=Mercurial
+#if ARCH == "x64"
+AppVerName=Mercurial {#VERSION} (64-bit)
+OutputBaseFilename=Mercurial-{#VERSION}-x64
+ArchitecturesAllowed=x64
+ArchitecturesInstallIn64BitMode=x64
+#else
 AppVerName=Mercurial {#VERSION}
+OutputBaseFilename=Mercurial-{#VERSION}
+#endif
 InfoAfterFile=contrib/win32/postinstall.txt
 LicenseFile=COPYING
 ShowLanguageDialog=yes
@@ -29,7 +41,6 @@
 AppUpdatesURL=http://mercurial.selenic.com/
 AppID={{4B95A5F1-EF59-4B08-BED8-C891C46121B3}
 AppContact=mercurial@selenic.com
-OutputBaseFilename=Mercurial-{#VERSION}
 DefaultDirName={pf}\Mercurial
 SourceDir=..\..
 VersionInfoDescription=Mercurial distributed SCM (version {#VERSION})
@@ -61,18 +72,21 @@
 Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini; Check: CheckFile; AfterInstall: ConcatenateFiles;
 Source: contrib\win32\postinstall.txt; DestDir: {app}; DestName: ReleaseNotes.txt
 Source: dist\hg.exe; DestDir: {app}; AfterInstall: Touch('{app}\hg.exe.local')
+#if ARCH == "x64"
+Source: dist\*.dll; Destdir: {app}
+Source: dist\*.pyd; Destdir: {app}
+#else
 Source: dist\python*.dll; Destdir: {app}; Flags: skipifsourcedoesntexist
-Source: dist\library.zip; DestDir: {app}
-Source: dist\mfc*.dll; DestDir: {app}; Flags: skipifsourcedoesntexist
 Source: dist\msvc*.dll; DestDir: {app}; Flags: skipifsourcedoesntexist
+Source: dist\w9xpopen.exe; DestDir: {app}
+#endif
 Source: dist\Microsoft.VC*.CRT.manifest; DestDir: {app}; Flags: skipifsourcedoesntexist
-Source: dist\Microsoft.VC*.MFC.manifest; DestDir: {app}; Flags: skipifsourcedoesntexist
-Source: dist\w9xpopen.exe; DestDir: {app}
+Source: dist\library.zip; DestDir: {app}
 Source: dist\add_path.exe; DestDir: {app}
 Source: doc\*.html; DestDir: {app}\Docs
 Source: doc\style.css; DestDir: {app}\Docs
 Source: mercurial\help\*.txt; DestDir: {app}\help
-Source: mercurial\locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs
+Source: mercurial\locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs skipifsourcedoesntexist
 Source: mercurial\templates\*.*; DestDir: {app}\Templates; Flags: recursesubdirs createallsubdirs
 Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt
 Source: COPYING; DestDir: {app}; DestName: Copying.txt
@@ -99,6 +113,7 @@
 
 [UninstallDelete]
 Type: files; Name: "{app}\hg.exe.local"
+
 [Code]
 var
   WriteFile: Boolean;
--- a/contrib/win32/win32-build.txt	Mon Sep 13 01:37:56 2010 +0000
+++ b/contrib/win32/win32-build.txt	Tue Sep 14 16:21:01 2010 -0500
@@ -1,13 +1,17 @@
 The standalone Windows installer for Mercurial is built in a somewhat
 jury-rigged fashion.
 
-It has the following prerequisites, at least as I build it:
+It has the following prerequisites. Ensure to take the packages
+matching the mercurial version you want to build (32-bit or 64-bit).
+
+  Python 2.6 for Windows
+      http://www.python.org/download/releases/
 
-  Python for Windows
-      http://www.python.org/ftp/python/2.4.3/python-2.4.3.msi
-
-  MinGW
+  A compiler:
+    either MinGW
       http://www.mingw.org/
+    or Microsoft Visual C++ 2008 SP1 Express Edition
+      http://www.microsoft.com/express/Downloads/Download-2008.aspx
 
   Python for Windows Extensions
       http://sourceforge.net/projects/pywin32/
@@ -15,19 +19,22 @@
   mfc71.dll (just download, don't install; not needed for Python 2.6)
       http://starship.python.net/crew/mhammond/win32/
 
-  Visual C++ 2008 redistributable package (needed for Python 2.6)
-      http://www.microsoft.com/downloads/details.aspx?familyid=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en
+  Visual C++ 2008 SP1 redistributable package (needed for >= Python 2.6 or if you compile with MSVC)
+    for 32-bit:
+      http://www.microsoft.com/downloads/details.aspx?FamilyID=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2
+    for 64-bit:
+      http://www.microsoft.com/downloads/details.aspx?familyid=BA9257CA-337F-4B40-8C14-157CFDFFEE4E
       
   The py2exe distutils extension
       http://sourceforge.net/projects/py2exe/
 
-  GnuWin32 gettext utility
+  GnuWin32 gettext utility (if you want to build translations)
       http://gnuwin32.sourceforge.net/packages/gettext.htm
 
   Inno Setup
       http://www.jrsoftware.org/isdl.php#qsp
 
-      Get and install ispack-5.3.4.exe which includes Inno Setup Processor,
+      Get and install ispack-5.3.10.exe which includes Inno Setup Processor,
       which is necessary to package Mercurial.
 
   ISTool - optional
@@ -45,41 +52,44 @@
 Mercurial repository you want to package, and name the repo
 C:\hg\hg-release.
 
-In a shell, build a standalone copy of the hg.exe program:
+In a shell, build a standalone copy of the hg.exe program.
 
+Building instructions for MinGW:
   python setup.py build -c mingw32
-  python setup.py py2exe -b 1
-
+  python setup.py py2exe -b 2
 Note: the previously suggested combined command of "python setup.py build -c
-mingw32 py2exe -b 1" doesn't work correctly anymore as it doesn't include the
+mingw32 py2exe -b 2" doesn't work correctly anymore as it doesn't include the
 extensions in the mercurial subdirectory.
-
 If you want to create a file named setup.cfg with the contents:
-
 [build]
 compiler=mingw32
+you can skip the first build step.
 
-you can skip the first build step.
+Building instructions with MSVC 2008 SP1 Express Edition:
+  for 32-bit:
+    "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
+    python setup.py py2exe -b 2
+  for 64-bit:
+    "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86_amd64
+    python setup.py py2exe -b 3
 
 Copy add_path.exe into the dist directory that just got created.
 
 If you are using Python up to version 2.5.4, copy mfc71.dll into the dist
 directory that just got created.
 
-If you are using Python 2.6 or later, after installing the Visual C++ 2008
-redistributable package copy into the dist directory that just got created the
-following files:
-  - from the directory starting with
-    Windows/WinSxS/x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8
-    the files named: msvcm90.dll, msvcp90.dll and msvcr90.dll
-  - from the directory starting with
-    Windows/WinSxS/x86_Microsoft.VC90.MFC_1fc8b3b9a1e18e3b_9.0.21022.8
-    the files named: mfc90.dll, mfc90u.dll, mfcm90.dll and mfcm90u.dll
-  - from the directory named Windows/WinSxS/Manifests, the manifest file
-    starting with x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8
-    (rename it to Microsoft.VC90.CRT.manifest) and the manifest file starting
-    with x86_Microsoft.VC90.MFC_1fc8b3b9a1e18e3b_9.0.21022.8 (rename it to
-    Microsoft.VC90.MFC.manifest)
+If you are using Python 2.6 or later, or if you are using MSVC 2008 to compile
+mercurial, you must include the C runtime libraries in the installer. To do so,
+install the Visual C++ 2008 SP1 redistributable package. Then in your
+windows\winsxs folder, locate the folder containing the dlls version 9.0.30729.
+For x86, it should be named like x86_Microsoft.VC90.CRT_(...)_9.0.30729(...).
+For x64, it should be named like amd64_Microsoft.VC90.CRT_(...)_9.0.30729(...).
+Copy the files named msvcm90.dll, msvcp90.dll and msvcr90.dll into the dist
+directory.
+Then in the windows\winsxs\manifests folder, locate the corresponding manifest
+file (x86_Microsoft.VC90.CRT_(...)_9.0.30729(...).manifest for x86,
+amd64_Microsoft.VC90.CRT_(...)_9.0.30729(...).manifest for x64), copy it in the
+dist directory and rename it to Microsoft.VC90.CRT.manifest.
 
 Before building the installer, you have to build Mercurial HTML documentation 
 (or fix mercurial.iss to not reference the doc directory):
@@ -94,21 +104,27 @@
 Otherwise you run the Inno Setup compiler.  Assuming it's in the path
 you should execute:
 
-  iscc contrib\win32\mercurial.iss /DVERSION=foo
+  iscc contrib\win32\mercurial.iss /dVERSION=foo
 
 Where 'foo' is the version number you would like to see in the
 'Add/Remove Applications' tool.  The installer will be placed into
 a directory named Output/ at the root of your repository.
+If the /dVERSION=foo parameter is not given in the command line, the
+installer will retrieve the version information from the __version__.py file.
+
+If you want to build an installer for a 64-bit mercurial, add /dARCH=x64 to
+your command line:
+  iscc contrib\win32\mercurial.iss /dARCH=x64
 
 To automate the steps above you may want to create a batchfile based on the
-following:
+following (MinGW build chain):
 
   echo [build] > setup.cfg
   echo compiler=mingw32 >> setup.cfg
-  python setup.py py2exe -b 1
+  python setup.py py2exe -b 2
   cd doc
   mingw32-make html
   cd ..
-  iscc contrib\win32\mercurial.iss /DVERSION=snapshot
+  iscc contrib\win32\mercurial.iss /dVERSION=snapshot
 
 and run it from the root of the hg repository (c:\hg\hg-release).
--- a/hgext/color.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/hgext/color.py	Tue Sep 14 16:21:01 2010 -0500
@@ -233,7 +233,7 @@
 
     # http://msdn.microsoft.com/en-us/library/ms682088%28VS.85%29.aspx
     w32effects = {
-        'none': 0,
+        'none': -1,
         'black': 0,
         'red': win32c.FOREGROUND_RED,
         'green': win32c.FOREGROUND_GREEN,
@@ -244,7 +244,7 @@
         'white': (win32c.FOREGROUND_RED | win32c.FOREGROUND_GREEN |
                   win32c.FOREGROUND_BLUE),
         'bold': win32c.FOREGROUND_INTENSITY,
-        'black_background': 0,
+        'black_background': 0x100,                  # unused value > 0x0f
         'red_background': win32c.BACKGROUND_RED,
         'green_background': win32c.BACKGROUND_GREEN,
         'yellow_background': win32c.BACKGROUND_RED | win32c.BACKGROUND_GREEN,
@@ -258,6 +258,11 @@
         'inverse': win32c.COMMON_LVB_REVERSE_VIDEO, # double-byte charsets only
     }
 
+    passthrough = set([win32c.FOREGROUND_INTENSITY,
+                       win32c.BACKGROUND_INTENSITY,
+                       win32c.COMMON_LVB_UNDERSCORE,
+                       win32c.COMMON_LVB_REVERSE_VIDEO])
+
     try:
         stdout = win32c.GetStdHandle(win32c.STD_OUTPUT_HANDLE)
         if stdout is None:
@@ -272,13 +277,23 @@
 
     def win32print(text, orig, **opts):
         label = opts.get('label', '')
-        attr = 0
+        attr = origattr
+
+        def mapcolor(val, attr):
+            if val == -1:
+                return origattr
+            elif val in passthrough:
+                return attr | val
+            elif val > 0x0f:
+                return (val & 0x70) | (attr & 0x8f)
+            else:
+                return (val & 0x07) | (attr & 0xf8)
 
         # determine console attributes based on labels
         for l in label.split():
             style = _styles.get(l, '')
             for effect in style.split():
-                attr |= w32effects[effect]
+                attr = mapcolor(w32effects[effect], attr)
 
         # hack to ensure regexp finds data
         if not text.startswith('\033['):
@@ -289,9 +304,8 @@
         while m:
             for sattr in m.group(1).split(';'):
                 if sattr:
-                    val = int(sattr)
-                    attr = val and attr|val or 0
-            stdout.SetConsoleTextAttribute(attr or origattr)
+                    attr = mapcolor(int(sattr), attr)
+            stdout.SetConsoleTextAttribute(attr)
             orig(m.group(2), **opts)
             m = re.match(ansire, m.group(3))
 
--- a/hgext/convert/darcs.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/hgext/convert/darcs.py	Tue Sep 14 16:21:01 2010 -0500
@@ -83,6 +83,8 @@
         shutil.rmtree(self.tmppath, ignore_errors=True)
 
     def xml(self, cmd, **kwargs):
+        # NOTE: darcs is currently encoding agnostic and will print
+        # patch metadata byte-for-byte, even in the XML changelog.
         etree = ElementTree()
         fp = self._run(cmd, **kwargs)
         etree.parse(fp)
@@ -107,8 +109,12 @@
         elt = self.changes[rev]
         date = util.strdate(elt.get('local_date'), '%a %b %d %H:%M:%S %Z %Y')
         desc = elt.findtext('name') + '\n' + elt.findtext('comment', '')
-        return commit(author=elt.get('author'), date=util.datestr(date),
-                      desc=desc.strip(), parents=self.parents[rev])
+        # etree can return unicode objects for name, comment, and author,
+        # so recode() is used to ensure str objects are emitted.
+        return commit(author=self.recode(elt.get('author')),
+                      date=util.datestr(date),
+                      desc=self.recode(desc).strip(),
+                      parents=self.parents[rev])
 
     def pull(self, rev):
         output, status = self.run('pull', self.path, all=True,
--- a/hgext/mq.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/hgext/mq.py	Tue Sep 14 16:21:01 2010 -0500
@@ -685,7 +685,7 @@
                 p1, p2 = repo.dirstate.parents()
                 repo.dirstate.setparents(p1, merge)
 
-            files = patch.updatedir(self.ui, repo, files)
+            files = cmdutil.updatedir(self.ui, repo, files)
             match = cmdutil.matchfiles(repo, files or [])
             n = repo.commit(message, ph.user, ph.date, match=match, force=True)
 
@@ -771,7 +771,7 @@
         if opts.get('rev'):
             if not self.applied:
                 raise util.Abort(_('no patches applied'))
-            revs = cmdutil.revrange(repo, opts['rev'])
+            revs = cmdutil.revrange(repo, opts.get('rev'))
             if len(revs) > 1 and revs[0] > revs[1]:
                 revs.reverse()
             revpatches = self._revpatches(repo, revs)
@@ -1831,9 +1831,9 @@
     """
     q = repo.mq
     try:
-        q.qimport(repo, filename, patchname=opts['name'],
-              existing=opts['existing'], force=opts['force'], rev=opts['rev'],
-              git=opts['git'])
+        q.qimport(repo, filename, patchname=opts.get('name'),
+              existing=opts.get('existing'), force=opts.get('force'),
+              rev=opts.get('rev'), git=opts.get('git'))
     finally:
         q.save_dirty()
 
@@ -1876,7 +1876,7 @@
 
     This command is deprecated. Without -c, it's implied by other relevant
     commands. With -c, use :hg:`init --mq` instead."""
-    return qinit(ui, repo, create=opts['create_repo'])
+    return qinit(ui, repo, create=opts.get('create_repo'))
 
 def clone(ui, source, dest=None, **opts):
     '''clone main and patch repository at same time
@@ -1901,8 +1901,8 @@
     if dest is None:
         dest = hg.defaultdest(source)
     sr = hg.repository(hg.remoteui(ui, opts), ui.expandpath(source))
-    if opts['patches']:
-        patchespath = ui.expandpath(opts['patches'])
+    if opts.get('patches'):
+        patchespath = ui.expandpath(opts.get('patches'))
     else:
         patchespath = patchdir(sr)
     try:
@@ -1925,20 +1925,20 @@
             pass
     ui.note(_('cloning main repository\n'))
     sr, dr = hg.clone(ui, sr.url(), dest,
-                      pull=opts['pull'],
+                      pull=opts.get('pull'),
                       rev=destrev,
                       update=False,
-                      stream=opts['uncompressed'])
+                      stream=opts.get('uncompressed'))
     ui.note(_('cloning patch repository\n'))
-    hg.clone(ui, opts['patches'] or patchdir(sr), patchdir(dr),
-             pull=opts['pull'], update=not opts['noupdate'],
-             stream=opts['uncompressed'])
+    hg.clone(ui, opts.get('patches') or patchdir(sr), patchdir(dr),
+             pull=opts.get('pull'), update=not opts.get('noupdate'),
+             stream=opts.get('uncompressed'))
     if dr.local():
         if qbase:
             ui.note(_('stripping applied patches from destination '
                       'repository\n'))
             dr.mq.strip(dr, [qbase], update=False, backup=None)
-        if not opts['noupdate']:
+        if not opts.get('noupdate'):
             ui.note(_('updating destination repository\n'))
             hg.update(dr, dr.changelog.tip())
 
@@ -1954,7 +1954,7 @@
 
 def series(ui, repo, **opts):
     """print the entire series file"""
-    repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary'])
+    repo.mq.qseries(repo, missing=opts.get('missing'), summary=opts.get('summary'))
     return 0
 
 def top(ui, repo, **opts):
@@ -2021,7 +2021,7 @@
     """
     msg = cmdutil.logmessage(opts)
     def getmsg():
-        return ui.edit(msg, opts['user'] or ui.username())
+        return ui.edit(msg, opts.get('user') or ui.username())
     q = repo.mq
     opts['msg'] = msg
     if opts.get('edit'):
@@ -2054,7 +2054,7 @@
     """
     q = repo.mq
     message = cmdutil.logmessage(opts)
-    if opts['edit']:
+    if opts.get('edit'):
         if not q.applied:
             ui.write(_("no patches applied\n"))
             return 1
@@ -2110,7 +2110,7 @@
     q.check_localchanges(repo)
 
     message = cmdutil.logmessage(opts)
-    if opts['edit']:
+    if opts.get('edit'):
         if message:
             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
 
@@ -2134,7 +2134,7 @@
         (patchsuccess, files, fuzz) = q.patch(repo, pf)
         if not patchsuccess:
             raise util.Abort(_('error folding patch %s') % p)
-        patch.updatedir(ui, repo, files)
+        cmdutil.updatedir(ui, repo, files)
 
     if not message:
         ph = patchheader(q.join(parent), q.plainmode)
@@ -2144,7 +2144,7 @@
             message.extend(msg)
         message = '\n'.join(message)
 
-    if opts['edit']:
+    if opts.get('edit'):
         message = ui.edit(message, user or ui.username())
 
     diffopts = q.patchopts(q.diffopts(), *patches)
@@ -2157,9 +2157,9 @@
     q = repo.mq
     patch = q.lookup(patch)
     if q.isapplied(patch):
-        ret = q.pop(repo, patch, force=opts['force'])
+        ret = q.pop(repo, patch, force=opts.get('force'))
     else:
-        ret = q.push(repo, patch, force=opts['force'])
+        ret = q.push(repo, patch, force=opts.get('force'))
     q.save_dirty()
     return ret
 
@@ -2205,8 +2205,8 @@
     applied = set(p.name for p in q.applied)
     patch = None
     args = list(args)
-    if opts['list']:
-        if args or opts['none']:
+    if opts.get('list'):
+        if args or opts.get('none'):
             raise util.Abort(_('cannot mix -l/--list with options or arguments'))
         for i in xrange(len(q.series)):
             status(i)
@@ -2219,7 +2219,7 @@
         patch = args.pop(0)
     if patch is None:
         raise util.Abort(_('no patch to work with'))
-    if args or opts['none']:
+    if args or opts.get('none'):
         idx = q.find_series(patch)
         if idx is None:
             raise util.Abort(_('no patch named %s') % patch)
@@ -2276,9 +2276,9 @@
     q = repo.mq
     mergeq = None
 
-    if opts['merge']:
-        if opts['name']:
-            newpath = repo.join(opts['name'])
+    if opts.get('merge'):
+        if opts.get('name'):
+            newpath = repo.join(opts.get('name'))
         else:
             newpath, i = lastsavename(q.path)
         if not newpath:
@@ -2286,7 +2286,7 @@
             return 1
         mergeq = queue(ui, repo.join(""), newpath)
         ui.warn(_("merging with queue at: %s\n") % mergeq.path)
-    ret = q.push(repo, patch, force=opts['force'], list=opts['list'],
+    ret = q.push(repo, patch, force=opts.get('force'), list=opts.get('list'),
                  mergeq=mergeq, all=opts.get('all'), move=opts.get('move'))
     return ret
 
@@ -2298,14 +2298,14 @@
     top of the stack.
     """
     localupdate = True
-    if opts['name']:
-        q = queue(ui, repo.join(""), repo.join(opts['name']))
+    if opts.get('name'):
+        q = queue(ui, repo.join(""), repo.join(opts.get('name')))
         ui.warn(_('using patch queue: %s\n') % q.path)
         localupdate = False
     else:
         q = repo.mq
-    ret = q.pop(repo, patch, force=opts['force'], update=localupdate,
-                all=opts['all'])
+    ret = q.pop(repo, patch, force=opts.get('force'), update=localupdate,
+                all=opts.get('all'))
     q.save_dirty()
     return ret
 
@@ -2379,8 +2379,8 @@
     This command is deprecated, use rebase --mq instead."""
     rev = repo.lookup(rev)
     q = repo.mq
-    q.restore(repo, rev, delete=opts['delete'],
-              qupdate=opts['update'])
+    q.restore(repo, rev, delete=opts.get('delete'),
+              qupdate=opts.get('update'))
     q.save_dirty()
     return 0
 
@@ -2394,22 +2394,22 @@
     if ret:
         return ret
     q.save_dirty()
-    if opts['copy']:
+    if opts.get('copy'):
         path = q.path
-        if opts['name']:
-            newpath = os.path.join(q.basepath, opts['name'])
+        if opts.get('name'):
+            newpath = os.path.join(q.basepath, opts.get('name'))
             if os.path.exists(newpath):
                 if not os.path.isdir(newpath):
                     raise util.Abort(_('destination %s exists and is not '
                                        'a directory') % newpath)
-                if not opts['force']:
+                if not opts.get('force'):
                     raise util.Abort(_('destination %s exists, '
                                        'use -f to force') % newpath)
         else:
             newpath = savename(path)
         ui.warn(_("copy %s to %s\n") % (path, newpath))
         util.copyfiles(path, newpath)
-    if opts['empty']:
+    if opts.get('empty'):
         try:
             os.unlink(q.join(q.status_path))
         except:
@@ -2435,13 +2435,13 @@
     the local revision numbers will in general be different after the
     restore.
 
-    Use the --nobackup option to discard the backup bundle once the
+    Use the --no-backup option to discard the backup bundle once the
     operation completes.
     """
     backup = 'all'
-    if opts['backup']:
+    if opts.get('backup'):
         backup = 'strip'
-    elif opts['nobackup']:
+    elif opts.get('no-backup') or opts.get('nobackup'):
         backup = 'none'
 
     cl = repo.changelog
@@ -2479,7 +2479,7 @@
             q.save_dirty()
 
     repo.mq.strip(repo, list(rootnodes), backup=backup, update=update,
-                  force=opts['force'])
+                  force=opts.get('force'))
     return 0
 
 def select(ui, repo, *args, **opts):
@@ -2517,7 +2517,7 @@
 
     q = repo.mq
     guards = q.active()
-    if args or opts['none']:
+    if args or opts.get('none'):
         old_unapplied = q.unapplied(repo)
         old_guarded = [i for i in xrange(len(q.applied)) if
                        not q.pushable(i)[0]]
@@ -2525,7 +2525,7 @@
         q.save_dirty()
         if not args:
             ui.status(_('guards deactivated\n'))
-        if not opts['pop'] and not opts['reapply']:
+        if not opts.get('pop') and not opts.get('reapply'):
             unapplied = q.unapplied(repo)
             guarded = [i for i in xrange(len(q.applied))
                        if not q.pushable(i)[0]]
@@ -2537,7 +2537,7 @@
                 ui.status(_('number of guarded, applied patches has changed '
                             'from %d to %d\n') %
                           (len(old_guarded), len(guarded)))
-    elif opts['series']:
+    elif opts.get('series'):
         guards = {}
         noguards = 0
         for gs in q.series_guards:
@@ -2564,9 +2564,9 @@
                 ui.write(g, '\n')
         else:
             ui.write(_('no active guards\n'))
-    reapply = opts['reapply'] and q.applied and q.appliedname(-1)
+    reapply = opts.get('reapply') and q.applied and q.appliedname(-1)
     popped = False
-    if opts['pop'] or opts['reapply']:
+    if opts.get('pop') or opts.get('reapply'):
         for i in xrange(len(q.applied)):
             pushable, reason = q.pushable(i)
             if not pushable:
@@ -2601,9 +2601,9 @@
     an upstream repository, or if you are about to push your changes
     to upstream.
     """
-    if not opts['applied'] and not revrange:
+    if not opts.get('applied') and not revrange:
         raise util.Abort(_('no revisions specified'))
-    elif opts['applied']:
+    elif opts.get('applied'):
         revrange = ('qbase::qtip',) + revrange
 
     q = repo.mq
@@ -3087,7 +3087,8 @@
           ('b', 'backup', None, _('bundle only changesets with local revision'
                                   ' number greater than REV which are not'
                                   ' descendants of REV (DEPRECATED)')),
-           ('n', 'nobackup', None, _('no backups'))],
+           ('n', 'no-backup', None, _('no backups')),
+           ('', 'nobackup', None, _('no backups (DEPRECATED)'))],
           _('hg strip [-f] [-n] REV...')),
      "qtop": (top, [] + seriesopts, _('hg qtop [-s]')),
     "qunapplied":
--- a/hgext/patchbomb.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/hgext/patchbomb.py	Tue Sep 14 16:21:01 2010 -0500
@@ -394,17 +394,14 @@
 
         if addrs:
             showaddrs.append('%s %s' % (showaddr, ', '.join(addrs)))
-            return mail.addrlistencode(ui, addrs, _charsets,
-                                       opts.get('test'))
+            return mail.addrlistencode(ui, addrs, _charsets, opts.get('test'))
 
         addrs = ui.config('email', opt) or ui.config('patchbomb', opt) or ''
         if not addrs and prpt:
             addrs = prompt(ui, prpt, default)
 
         if addrs:
-            showaddr = '%s %s' % (showaddr, addrs)
-            showaddrs.append(showaddr)
-
+            showaddrs.append('%s %s' % (showaddr, addrs))
         return mail.addrlistencode(ui, [addrs], _charsets, opts.get('test'))
 
     to = getaddrs('to', 'To')
@@ -441,7 +438,7 @@
     sender_addr = email.Utils.parseaddr(sender)[1]
     sender = mail.addressencode(ui, sender, _charsets, opts.get('test'))
     sendmail = None
-    for m, subj, ds in msgs:
+    for i, (m, subj, ds) in enumerate(msgs):
         try:
             m['Message-Id'] = genmsgid(m['X-Mercurial-Node'])
         except TypeError:
@@ -483,6 +480,7 @@
                 fp.close()
         elif mbox:
             ui.status(_('Writing '), subj, ' ...\n')
+            ui.progress(_('writing'), i, item=subj, total=len(msgs))
             fp = open(mbox, 'In-Reply-To' in m and 'ab+' or 'wb+')
             generator = email.Generator.Generator(fp, mangle_from_=True)
             # Should be time.asctime(), but Windows prints 2-characters day
@@ -497,6 +495,7 @@
             if not sendmail:
                 sendmail = mail.connect(ui)
             ui.status(_('Sending '), subj, ' ...\n')
+            ui.progress(_('sending'), i, item=subj, total=len(msgs))
             # Exim does not remove the Bcc field
             del m['Bcc']
             fp = cStringIO.StringIO()
@@ -504,6 +503,9 @@
             generator.flatten(m, 0)
             sendmail(sender, to + bcc + cc, fp.getvalue())
 
+    ui.progress(_('writing'), None)
+    ui.progress(_('sending'), None)
+
 emailopts = [
           ('a', 'attach', None, _('send patches as attachments')),
           ('i', 'inline', None, _('send patches as inline attachments')),
--- a/hgext/record.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/hgext/record.py	Tue Sep 14 16:21:01 2010 -0500
@@ -497,7 +497,7 @@
                     pfiles = {}
                     patch.internalpatch(fp, ui, 1, repo.root, files=pfiles,
                                         eolmode=None)
-                    patch.updatedir(ui, repo, pfiles)
+                    cmdutil.updatedir(ui, repo, pfiles)
                 except patch.PatchError, err:
                     s = str(err)
                     if s:
--- a/hgext/transplant.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/hgext/transplant.py	Tue Sep 14 16:21:01 2010 -0500
@@ -225,7 +225,7 @@
                                      % revlog.hex(node))
                         return None
                 finally:
-                    files = patch.updatedir(self.ui, repo, files)
+                    files = cmdutil.updatedir(self.ui, repo, files)
             except Exception, inst:
                 seriespath = os.path.join(self.path, 'series')
                 if os.path.exists(seriespath):
--- a/mercurial/cmdutil.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/cmdutil.py	Tue Sep 14 16:21:01 2010 -0500
@@ -329,6 +329,49 @@
         finally:
             wlock.release()
 
+def updatedir(ui, repo, patches, similarity=0):
+    '''Update dirstate after patch application according to metadata'''
+    if not patches:
+        return
+    copies = []
+    removes = set()
+    cfiles = patches.keys()
+    cwd = repo.getcwd()
+    if cwd:
+        cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()]
+    for f in patches:
+        gp = patches[f]
+        if not gp:
+            continue
+        if gp.op == 'RENAME':
+            copies.append((gp.oldpath, gp.path))
+            removes.add(gp.oldpath)
+        elif gp.op == 'COPY':
+            copies.append((gp.oldpath, gp.path))
+        elif gp.op == 'DELETE':
+            removes.add(gp.path)
+
+    wctx = repo[None]
+    for src, dst in copies:
+        wctx.copy(src, dst)
+    if (not similarity) and removes:
+        wctx.remove(sorted(removes), True)
+
+    for f in patches:
+        gp = patches[f]
+        if gp and gp.mode:
+            islink, isexec = gp.mode
+            dst = repo.wjoin(gp.path)
+            # patch won't create empty files
+            if gp.op == 'ADD' and not os.path.exists(dst):
+                flags = (isexec and 'x' or '') + (islink and 'l' or '')
+                repo.wwrite(gp.path, '', flags)
+            util.set_flags(dst, islink, isexec)
+    addremove(repo, cfiles, similarity=similarity)
+    files = patches.keys()
+    files.extend([r for r in removes if r not in files])
+    return sorted(files)
+
 def copy(ui, repo, pats, opts, rename=False):
     # called with the repo lock held
     #
@@ -1237,6 +1280,35 @@
                 yield change(rev)
     return iterate()
 
+def add(ui, repo, match, dryrun, listsubrepos, prefix):
+    join = lambda f: os.path.join(prefix, f)
+    bad = []
+    oldbad = match.bad
+    match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
+    names = []
+    wctx = repo[None]
+    for f in repo.walk(match):
+        exact = match.exact(f)
+        if exact or f not in repo.dirstate:
+            names.append(f)
+            if ui.verbose or not exact:
+                ui.status(_('adding %s\n') % match.rel(join(f)))
+
+    if listsubrepos:
+        for subpath in wctx.substate:
+            sub = wctx.sub(subpath)
+            try:
+                submatch = matchmod.narrowmatcher(subpath, match)
+                bad.extend(sub.add(ui, submatch, dryrun, prefix))
+            except error.LookupError:
+                ui.status(_("skipping missing subrepository: %s\n")
+                               % join(subpath))
+
+    if not dryrun:
+        rejected = wctx.add(names, prefix)
+        bad.extend(f for f in rejected if f in match.files())
+    return bad
+
 def commit(ui, repo, commitfunc, pats, opts):
     '''commit the specified files or all outstanding changes'''
     date = opts.get('date')
--- a/mercurial/commands.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/commands.py	Tue Sep 14 16:21:01 2010 -0500
@@ -9,7 +9,7 @@
 from lock import release
 from i18n import _, gettext
 import os, re, sys, difflib, time, tempfile
-import hg, util, revlog, bundlerepo, extensions, copies, error
+import hg, util, revlog, extensions, copies, error
 import patch, help, mdiff, url, encoding, templatekw, discovery
 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
 import merge as mergemod
@@ -46,22 +46,10 @@
     Returns 0 if all files are successfully added.
     """
 
-    bad = []
-    names = []
     m = cmdutil.match(repo, pats, opts)
-    oldbad = m.bad
-    m.bad = lambda x, y: bad.append(x) or oldbad(x, y)
-
-    for f in repo.walk(m):
-        exact = m.exact(f)
-        if exact or f not in repo.dirstate:
-            names.append(f)
-            if ui.verbose or not exact:
-                ui.status(_('adding %s\n') % m.rel(f))
-    if not opts.get('dry_run'):
-        rejected = repo[None].add(names)
-        bad += [f for f in rejected if f in m.files()]
-    return bad and 1 or 0
+    rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'),
+                           opts.get('subrepos'), prefix="")
+    return rejected and 1 or 0
 
 def addremove(ui, repo, *pats, **opts):
     """add all new files, delete all missing files
@@ -2301,8 +2289,8 @@
                 patch.patch(tmpname, ui, strip=strip, cwd=repo.root,
                             files=files, eolmode=None)
             finally:
-                files = patch.updatedir(ui, repo, files,
-                                        similarity=sim / 100.0)
+                files = cmdutil.updatedir(ui, repo, files,
+                                          similarity=sim / 100.0)
             if not opts.get('no_commit'):
                 if opts.get('exact'):
                     m = None
@@ -2369,66 +2357,16 @@
 
     Returns 0 if there are incoming changes, 1 otherwise.
     """
-    limit = cmdutil.loglimit(opts)
-    source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
-    other = hg.repository(hg.remoteui(repo, opts), source)
-    ui.status(_('comparing with %s\n') % url.hidepassword(source))
-    revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
-    if revs:
-        revs = [other.lookup(rev) for rev in revs]
-
-    tmp = discovery.findcommonincoming(repo, other, heads=revs,
-                                       force=opts.get('force'))
-    common, incoming, rheads = tmp
-    if not incoming:
-        try:
-            os.unlink(opts["bundle"])
-        except:
-            pass
-        ui.status(_("no changes found\n"))
-        return 1
-
-    cleanup = None
-    try:
-        fname = opts["bundle"]
-        if fname or not other.local():
-            # create a bundle (uncompressed if other repo is not local)
-
-            if revs is None and other.capable('changegroupsubset'):
-                revs = rheads
-
-            if revs is None:
-                cg = other.changegroup(incoming, "incoming")
-            else:
-                cg = other.changegroupsubset(incoming, revs, 'incoming')
-            bundletype = other.local() and "HG10BZ" or "HG10UN"
-            fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
-            # keep written bundle?
-            if opts["bundle"]:
-                cleanup = None
-            if not other.local():
-                # use the created uncompressed bundlerepo
-                other = bundlerepo.bundlerepository(ui, repo.root, fname)
-
-        o = other.changelog.nodesbetween(incoming, revs)[0]
-        if opts.get('newest_first'):
-            o.reverse()
-        displayer = cmdutil.show_changeset(ui, other, opts)
-        count = 0
-        for n in o:
-            if limit is not None and count >= limit:
-                break
-            parents = [p for p in other.changelog.parents(n) if p != nullid]
-            if opts.get('no_merges') and len(parents) == 2:
-                continue
-            count += 1
-            displayer.show(other[n])
-        displayer.close()
-    finally:
-        if hasattr(other, 'close'):
-            other.close()
-        if cleanup:
-            os.unlink(cleanup)
+    if opts.get('bundle') and opts.get('subrepos'):
+        raise util.Abort(_('cannot combine --bundle and --subrepos'))
+
+    ret = hg.incoming(ui, repo, source, opts)
+    if opts.get('subrepos'):
+        ctx = repo[None]
+        for subpath in sorted(ctx.substate):
+            sub = ctx.sub(subpath)
+            ret = min(ret, sub.incoming(ui, source, opts))
+    return ret
 
 def init(ui, dest=".", **opts):
     """create a new repository in the given directory
@@ -2684,33 +2622,13 @@
 
     Returns 0 if there are outgoing changes, 1 otherwise.
     """
-    limit = cmdutil.loglimit(opts)
-    dest = ui.expandpath(dest or 'default-push', dest or 'default')
-    dest, branches = hg.parseurl(dest, opts.get('branch'))
-    revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
-    if revs:
-        revs = [repo.lookup(rev) for rev in revs]
-
-    other = hg.repository(hg.remoteui(repo, opts), dest)
-    ui.status(_('comparing with %s\n') % url.hidepassword(dest))
-    o = discovery.findoutgoing(repo, other, force=opts.get('force'))
-    if not o:
-        ui.status(_("no changes found\n"))
-        return 1
-    o = repo.changelog.nodesbetween(o, revs)[0]
-    if opts.get('newest_first'):
-        o.reverse()
-    displayer = cmdutil.show_changeset(ui, repo, opts)
-    count = 0
-    for n in o:
-        if limit is not None and count >= limit:
-            break
-        parents = [p for p in repo.changelog.parents(n) if p != nullid]
-        if opts.get('no_merges') and len(parents) == 2:
-            continue
-        count += 1
-        displayer.show(repo[n])
-    displayer.close()
+    ret = hg.outgoing(ui, repo, dest, opts)
+    if opts.get('subrepos'):
+        ctx = repo[None]
+        for subpath in sorted(ctx.substate):
+            sub = ctx.sub(subpath)
+            ret = min(ret, sub.outgoing(ui, dest, opts))
+    return ret
 
 def parents(ui, repo, file_=None, **opts):
     """show the parents of the working directory or revision
@@ -4014,7 +3932,8 @@
 ]
 
 table = {
-    "^add": (add, walkopts + dryrunopts, _('[OPTION]... [FILE]...')),
+    "^add": (add, walkopts + subrepoopts + dryrunopts,
+             _('[OPTION]... [FILE]...')),
     "addremove":
         (addremove, similarityopts + walkopts + dryrunopts,
          _('[OPTION]... [FILE]...')),
@@ -4281,7 +4200,7 @@
            _('a remote changeset intended to be added'), _('REV')),
           ('b', 'branch', [],
            _('a specific branch you would like to pull'), _('BRANCH')),
-         ] + logopts + remoteopts,
+         ] + logopts + remoteopts + subrepoopts,
          _('[-p] [-n] [-M] [-f] [-r REV]...'
            ' [--bundle FILENAME] [SOURCE]')),
     "^init":
@@ -4348,7 +4267,7 @@
           ('n', 'newest-first', None, _('show newest record first')),
           ('b', 'branch', [],
            _('a specific branch you would like to push'), _('BRANCH')),
-         ] + logopts + remoteopts,
+         ] + logopts + remoteopts + subrepoopts,
          _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
     "parents":
         (parents,
--- a/mercurial/context.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/context.py	Tue Sep 14 16:21:01 2010 -0500
@@ -769,7 +769,8 @@
                 self.modified() or self.added() or self.removed() or
                 (missing and self.deleted()))
 
-    def add(self, list):
+    def add(self, list, prefix=""):
+        join = lambda f: os.path.join(prefix, f)
         wlock = self._repo.wlock()
         ui, ds = self._repo.ui, self._repo.dirstate
         try:
@@ -779,7 +780,7 @@
                 try:
                     st = os.lstat(p)
                 except:
-                    ui.warn(_("%s does not exist!\n") % f)
+                    ui.warn(_("%s does not exist!\n") % join(f))
                     rejected.append(f)
                     continue
                 if st.st_size > 10000000:
@@ -787,13 +788,13 @@
                               "to manage this file\n"
                               "(use 'hg revert %s' to cancel the "
                               "pending addition)\n")
-                              % (f, 3 * st.st_size // 1000000, f))
+                              % (f, 3 * st.st_size // 1000000, join(f)))
                 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
                     ui.warn(_("%s not added: only files and symlinks "
-                              "supported currently\n") % f)
+                              "supported currently\n") % join(f))
                     rejected.append(p)
                 elif ds[f] in 'amn':
-                    ui.warn(_("%s already tracked!\n") % f)
+                    ui.warn(_("%s already tracked!\n") % join(f))
                 elif ds[f] == 'r':
                     ds.normallookup(f)
                 else:
--- a/mercurial/dispatch.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/dispatch.py	Tue Sep 14 16:21:01 2010 -0500
@@ -24,7 +24,7 @@
     except util.Abort, inst:
         sys.stderr.write(_("abort: %s\n") % inst)
         if inst.hint:
-            sys.stderr.write(_("(%s)\n") % inst.hint)
+            sys.stderr.write("(%s)\n" % inst.hint)
         return -1
     except error.ParseError, inst:
         if len(inst.args) > 1:
--- a/mercurial/hg.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/hg.py	Tue Sep 14 16:21:01 2010 -0500
@@ -8,8 +8,10 @@
 
 from i18n import _
 from lock import release
+from node import hex, nullid, nullrev, short
 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo
 import lock, util, extensions, error, encoding, node
+import cmdutil, discovery, url, changegroup
 import merge as mergemod
 import verify as verifymod
 import errno, os, shutil
@@ -406,6 +408,97 @@
         repo.ui.status(_("(branch merge, don't forget to commit)\n"))
     return stats[3] > 0
 
+def incoming(ui, repo, source, opts):
+    limit = cmdutil.loglimit(opts)
+    source, branches = parseurl(ui.expandpath(source), opts.get('branch'))
+    other = repository(remoteui(repo, opts), source)
+    ui.status(_('comparing with %s\n') % url.hidepassword(source))
+    revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev'))
+    if revs:
+        revs = [other.lookup(rev) for rev in revs]
+
+    tmp = discovery.findcommonincoming(repo, other, heads=revs,
+                                       force=opts.get('force'))
+    common, incoming, rheads = tmp
+    if not incoming:
+        try:
+            os.unlink(opts["bundle"])
+        except:
+            pass
+        ui.status(_("no changes found\n"))
+        return 1
+
+    cleanup = None
+    try:
+        fname = opts["bundle"]
+        if fname or not other.local():
+            # create a bundle (uncompressed if other repo is not local)
+
+            if revs is None and other.capable('changegroupsubset'):
+                revs = rheads
+
+            if revs is None:
+                cg = other.changegroup(incoming, "incoming")
+            else:
+                cg = other.changegroupsubset(incoming, revs, 'incoming')
+            bundletype = other.local() and "HG10BZ" or "HG10UN"
+            fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
+            # keep written bundle?
+            if opts["bundle"]:
+                cleanup = None
+            if not other.local():
+                # use the created uncompressed bundlerepo
+                other = bundlerepo.bundlerepository(ui, repo.root, fname)
+
+        o = other.changelog.nodesbetween(incoming, revs)[0]
+        if opts.get('newest_first'):
+            o.reverse()
+        displayer = cmdutil.show_changeset(ui, other, opts)
+        count = 0
+        for n in o:
+            if limit is not None and count >= limit:
+                break
+            parents = [p for p in other.changelog.parents(n) if p != nullid]
+            if opts.get('no_merges') and len(parents) == 2:
+                continue
+            count += 1
+            displayer.show(other[n])
+        displayer.close()
+    finally:
+        if hasattr(other, 'close'):
+            other.close()
+        if cleanup:
+            os.unlink(cleanup)
+
+def outgoing(ui, repo, dest, opts):
+    limit = cmdutil.loglimit(opts)
+    dest = ui.expandpath(dest or 'default-push', dest or 'default')
+    dest, branches = parseurl(dest, opts.get('branch'))
+    revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev'))
+    if revs:
+        revs = [repo.lookup(rev) for rev in revs]
+
+    other = repository(remoteui(repo, opts), dest)
+    ui.status(_('comparing with %s\n') % url.hidepassword(dest))
+    o = discovery.findoutgoing(repo, other, force=opts.get('force'))
+    if not o:
+        ui.status(_("no changes found\n"))
+        return 1
+    o = repo.changelog.nodesbetween(o, revs)[0]
+    if opts.get('newest_first'):
+        o.reverse()
+    displayer = cmdutil.show_changeset(ui, repo, opts)
+    count = 0
+    for n in o:
+        if limit is not None and count >= limit:
+            break
+        parents = [p for p in repo.changelog.parents(n) if p != nullid]
+        if opts.get('no_merges') and len(parents) == 2:
+            continue
+        count += 1
+        displayer.show(repo[n])
+    displayer.close()
+
 def revert(repo, node, choose):
     """revert changes to revision in node without updating dirstate"""
     return mergemod.update(repo, node, False, True, choose)[3] > 0
--- a/mercurial/match.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/match.py	Tue Sep 14 16:21:01 2010 -0500
@@ -129,9 +129,18 @@
     ['b.txt']
     >>> m2.exact('b.txt')
     True
+    >>> m2.rel('b.txt')
+    'b.txt'
+    >>> def bad(f, msg):
+    ...     print "%s: %s" % (f, msg)
+    >>> m1.bad = bad
+    >>> m2.bad('x.txt', 'No such file')
+    sub/x.txt: No such file
     """
 
     def __init__(self, path, matcher):
+        self._root = matcher._root
+        self._cwd = matcher._cwd
         self._path = path
         self._matcher = matcher
 
@@ -141,6 +150,9 @@
         self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn)
         self._fmap = set(self._files)
 
+    def bad(self, f, msg):
+        self._matcher.bad(self._path + "/" + f, msg)
+
 def patkind(pat):
     return _patsplit(pat, None)[0]
 
--- a/mercurial/merge.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/merge.py	Tue Sep 14 16:21:01 2010 -0500
@@ -433,7 +433,7 @@
     the parent rev to the target rev (linear, on the same named
     branch, or on another named branch).
 
-    This logic is tested by test-update-branches.
+    This logic is tested by test-update-branches.t.
 
     -c  -C  dirty  rev  |  linear   same  cross
      n   n    n     n   |    ok     (1)     x
--- a/mercurial/patch.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/patch.py	Tue Sep 14 16:21:01 2010 -0500
@@ -11,7 +11,7 @@
 
 from i18n import _
 from node import hex, nullid, short
-import base85, cmdutil, mdiff, util, diffhelpers, copies, encoding
+import base85, mdiff, util, diffhelpers, copies, encoding
 
 gitre = re.compile('diff --git a/(.*) b/(.*)')
 
@@ -444,8 +444,8 @@
 
     def writelines(self, fname, lines):
         # Ensure supplied data ends in fname, being a regular file or
-        # a symlink. updatedir() will -too magically- take care of
-        # setting it to the proper type afterwards.
+        # a symlink. cmdutil.updatedir will -too magically- take care
+        # of setting it to the proper type afterwards.
         islink = os.path.islink(fname)
         if islink:
             fp = cStringIO.StringIO()
@@ -1129,8 +1129,8 @@
     read in binary mode. Otherwise, line endings are ignored when
     patching then normalized according to 'eolmode'.
 
-    Callers probably want to call 'updatedir' after this to apply
-    certain categories of changes not done by this function.
+    Callers probably want to call 'cmdutil.updatedir' after this to
+    apply certain categories of changes not done by this function.
     """
     return _applydiff(
         ui, fp, patchfile, copyfile,
@@ -1196,49 +1196,6 @@
         return -1
     return err
 
-def updatedir(ui, repo, patches, similarity=0):
-    '''Update dirstate after patch application according to metadata'''
-    if not patches:
-        return
-    copies = []
-    removes = set()
-    cfiles = patches.keys()
-    cwd = repo.getcwd()
-    if cwd:
-        cfiles = [util.pathto(repo.root, cwd, f) for f in patches.keys()]
-    for f in patches:
-        gp = patches[f]
-        if not gp:
-            continue
-        if gp.op == 'RENAME':
-            copies.append((gp.oldpath, gp.path))
-            removes.add(gp.oldpath)
-        elif gp.op == 'COPY':
-            copies.append((gp.oldpath, gp.path))
-        elif gp.op == 'DELETE':
-            removes.add(gp.path)
-
-    wctx = repo[None]
-    for src, dst in copies:
-        wctx.copy(src, dst)
-    if (not similarity) and removes:
-        wctx.remove(sorted(removes), True)
-
-    for f in patches:
-        gp = patches[f]
-        if gp and gp.mode:
-            islink, isexec = gp.mode
-            dst = repo.wjoin(gp.path)
-            # patch won't create empty files
-            if gp.op == 'ADD' and not os.path.exists(dst):
-                flags = (isexec and 'x' or '') + (islink and 'l' or '')
-                repo.wwrite(gp.path, '', flags)
-            util.set_flags(dst, islink, isexec)
-    cmdutil.addremove(repo, cfiles, similarity=similarity)
-    files = patches.keys()
-    files.extend([r for r in removes if r not in files])
-    return sorted(files)
-
 def externalpatch(patcher, args, patchname, ui, strip, cwd, files):
     """use <patcher> to apply <patchname> to the working directory.
     returns whether patch was applied with fuzz factor."""
--- a/mercurial/subrepo.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/mercurial/subrepo.py	Tue Sep 14 16:21:01 2010 -0500
@@ -255,6 +255,8 @@
         """
         raise NotImplementedError
 
+    def add(self, ui, match, dryrun, prefix):
+        return []
 
     def status(self, rev2, **opts):
         return [], [], [], [], [], [], []
@@ -262,6 +264,12 @@
     def diff(self, diffopts, node2, match, prefix, **opts):
         pass
 
+    def outgoing(self, ui, dest, opts):
+        return 1
+
+    def incoming(self, ui, source, opts):
+        return 1
+
 class hgsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
         self._path = path
@@ -291,6 +299,10 @@
                 addpathconfig('default-push', defpushpath)
             fp.close()
 
+    def add(self, ui, match, dryrun, prefix):
+        return cmdutil.add(ui, self._repo, match, dryrun, True,
+                           os.path.join(prefix, self._path))
+
     def status(self, rev2, **opts):
         try:
             rev1 = self._state[1]
@@ -388,6 +400,12 @@
         other = hg.repository(self._repo.ui, dsturl)
         return self._repo.push(other, force)
 
+    def outgoing(self, ui, dest, opts):
+        return hg.outgoing(ui, self._repo, _abssource(self._repo, True), opts)
+
+    def incoming(self, ui, source, opts):
+        return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts)
+
 class svnsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
         self._path = path
--- a/tests/get-with-headers.py	Mon Sep 13 01:37:56 2010 +0000
+++ b/tests/get-with-headers.py	Tue Sep 14 16:21:01 2010 -0500
@@ -17,6 +17,8 @@
     sys.argv.remove('--twice')
     twice = True
 
+reasons = {'Not modified': 'Not Modified'} # python 2.4
+
 tag = None
 def request(host, path, show):
 
@@ -28,7 +30,7 @@
     conn = httplib.HTTPConnection(host)
     conn.request("GET", path, None, headers)
     response = conn.getresponse()
-    print response.status, response.reason
+    print response.status, reasons.get(response.reason, response.reason)
     for h in [h.lower() for h in show]:
         if response.getheader(h, None) is not None:
             print "%s: %s" % (h, response.getheader(h))
--- a/tests/test-clone-update-order	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-#!/bin/sh
-
-echo
-echo % prepare repo a
-mkdir a
-cd a
-hg init
-echo foo > bar
-hg commit -Am default
-hg up -r null
-hg branch mine
-echo hello > world
-hg commit -Am hello
-hg up -r null
-hg branch other
-echo good > bye
-hg commit -Am other
-hg up -r mine
-
-echo % test -U -u
-hg clone -U -u . .#other ../b -r 0 -r 1 -r 2 -b other
-
-echo % test -U
-hg clone -U .#other ../b -r 0 -r 1 -r 2 -b other
-rm -rf ../b
-
-echo % test -u .
-hg clone -u . .#other ../b -r 0 -r 1 -r 2 -b other
-rm -rf ../b
-
-echo % test -u 0
-hg clone -u 0 .#other ../b -r 0 -r 1 -r 2 -b other
-rm -rf ../b
-
-echo % test -u 1
-hg clone -u 1 .#other ../b -r 0 -r 1 -r 2 -b other
-rm -rf ../b
-
-echo % test -u 2
-hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other
-rm -rf ../b
-
-echo % test -r 0
-hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other
-rm -rf ../b
-
-echo % test -r mine ... mine is ignored
-hg clone -u 2 .#other ../b -r mine -r 0 -r 1 -r 2 -b other
-rm -rf ../b
-
-echo % test -b default
-hg clone .#other ../b -b default -b mine
-rm -rf ../b
-
-echo % test #other
-hg clone .#other ../b
-rm -rf ../b
-
-echo % test tip
-hg clone -U . ../c -r 1 -r 2 > /dev/null
-hg clone ../c ../b
-rm -rf ../b ../c
-cd ..
-
-rm -rf a
-exit 0
--- a/tests/test-clone-update-order.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-
-% prepare repo a
-adding bar
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch mine
-adding world
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch other
-adding bye
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-% test -U -u
-abort: cannot specify both --noupdate and --updaterev
-% test -U
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 3 files (+2 heads)
-% test -u .
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 3 files (+2 heads)
-updating to branch mine
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test -u 0
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 3 files (+2 heads)
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test -u 1
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 3 files (+2 heads)
-updating to branch mine
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test -u 2
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 3 files (+2 heads)
-updating to branch other
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test -r 0
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 3 files (+2 heads)
-updating to branch other
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test -r mine ... mine is ignored
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 3 files (+2 heads)
-updating to branch other
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test -b default
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 3 files (+2 heads)
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-updating to branch other
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test tip
-updating to branch other
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-clone-update-order.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,110 @@
+  $ hg init
+  $ echo foo > bar
+  $ hg commit -Am default
+  adding bar
+  $ hg up -r null
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch mine
+  marked working directory as branch mine
+  $ echo hello > world
+  $ hg commit -Am hello
+  adding world
+  $ hg up -r null
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch other
+  marked working directory as branch other
+  $ echo good > bye
+  $ hg commit -Am other
+  adding bye
+  $ hg up -r mine
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg clone -U -u . .#other ../b -r 0 -r 1 -r 2 -b other
+  abort: cannot specify both --noupdate and --updaterev
+
+  $ hg clone -U .#other ../b -r 0 -r 1 -r 2 -b other
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files (+2 heads)
+  $ rm -rf ../b
+
+  $ hg clone -u . .#other ../b -r 0 -r 1 -r 2 -b other
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files (+2 heads)
+  updating to branch mine
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm -rf ../b
+
+  $ hg clone -u 0 .#other ../b -r 0 -r 1 -r 2 -b other
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files (+2 heads)
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm -rf ../b
+
+  $ hg clone -u 1 .#other ../b -r 0 -r 1 -r 2 -b other
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files (+2 heads)
+  updating to branch mine
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm -rf ../b
+
+  $ hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files (+2 heads)
+  updating to branch other
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm -rf ../b
+
+Test -r mine ... mine is ignored:
+
+  $ hg clone -u 2 .#other ../b -r mine -r 0 -r 1 -r 2 -b other
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files (+2 heads)
+  updating to branch other
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm -rf ../b
+
+  $ hg clone .#other ../b -b default -b mine
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 3 files (+2 heads)
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm -rf ../b
+
+  $ hg clone .#other ../b
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch other
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm -rf ../b
+
+  $ hg clone -U . ../c -r 1 -r 2 > /dev/null
+  $ hg clone ../c ../b
+  updating to branch other
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm -rf ../b ../c
+
--- a/tests/test-command-template	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-#!/bin/sh
-
-hg init a
-cd a
-echo a > a
-hg add a
-echo line 1 > b
-echo line 2 >> b
-hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
-hg add b
-echo other 1 > c
-echo other 2 >> c
-echo >> c
-echo other 3 >> c
-hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
-hg add c
-hg commit -m 'no person' -d '1200000 0' -u 'other@place'
-echo c >> c
-hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
-echo foo > .hg/branch
-hg commit -m 'new branch' -d '1400000 0' -u 'person'
-hg co -q 3
-echo other 4 >> d
-hg add d
-hg commit -m 'new head' -d '1500000 0' -u 'person'
-hg merge -q foo
-hg commit -m 'merge' -d '1500001 0' -u 'person'
-# second branch starting at nullrev
-hg update null
-echo second > second
-hg add second
-hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
-echo third > third
-hg add third
-hg mv second fourth
-hg commit -m third -d "2020-01-01 10:01"
-
-# make sure user/global hgrc does not affect tests
-echo '[ui]' > .hg/hgrc
-echo 'logtemplate =' >> .hg/hgrc
-echo 'style =' >> .hg/hgrc
-
-echo '# default style is like normal output'
-echo '#  normal'
-hg log > log.out
-hg log --style default > style.out
-cmp log.out style.out || diff -u log.out style.out
-echo '#  verbose'
-hg log -v > log.out
-hg log -v --style default > style.out
-cmp log.out style.out || diff -u log.out style.out
-echo '#  debug'
-hg log --debug > log.out
-hg log --debug --style default > style.out
-cmp log.out style.out || diff -u log.out style.out
-
-echo '# revision with no copies (used to print a traceback)'
-hg tip -v --template '\n'
-
-echo '# compact style works'
-hg log --style compact
-hg log -v --style compact
-hg log --debug --style compact
-
-# Test xml styles
-echo '# xml style works (--style xml)'
-hg log --style xml
-echo '# xml style works (-v --style xml)'
-hg log -v --style xml
-echo '# xml style works (--debug --style xml)'
-hg log --debug --style xml
-
-echo '# error if style not readable'
-touch q
-chmod 0 q
-hg log --style ./q
-
-echo '# error if no style'
-hg log --style notexist
-
-echo '# error if style missing key'
-echo 'q = q' > t
-hg log --style ./t
-
-echo '# error if include fails'
-echo 'changeset = q' >> t
-hg log --style ./t
-
-echo '# include works'
-rm q
-echo '{rev}' > q
-hg log --style ./t
-
-echo '# ui.style works'
-echo '[ui]' > .hg/hgrc
-echo 'style = t' >> .hg/hgrc
-hg log
-
-echo '# issue338'
-hg log --style=changelog > changelog
-cat changelog
-
-echo '# issue 2130'
-hg heads --style changelog
-
-echo "# keys work"
-for key in author branches date desc file_adds file_dels file_mods \
-        file_copies file_copies_switch files \
-        manifest node parents rev tags diffstat extras; do
-    for mode in '' --verbose --debug; do
-        hg log $mode --template "$key$mode: {$key}\n"
-    done
-done
-
-echo '# filters work'
-hg log --template '{author|domain}\n'
-hg log --template '{author|person}\n'
-hg log --template '{author|user}\n'
-hg log --template '{date|age}\n' > /dev/null || exit 1
-hg log -l1 --template '{date|age}\n' 
-hg log --template '{date|date}\n'
-hg log --template '{date|isodate}\n'
-hg log --template '{date|isodatesec}\n'
-hg log --template '{date|rfc822date}\n'
-hg log --template '{desc|firstline}\n'
-hg log --template '{node|short}\n'
-hg log --template '<changeset author="{author|xmlescape}"/>\n'
-hg log --template '{rev}: {children}\n'
-
-echo '# formatnode filter works'
-echo '#  quiet'
-hg -q log -r 0 --template '{node|formatnode}\n'
-echo '#  normal'
-hg log -r 0 --template '{node|formatnode}\n'
-echo '#  verbose'
-hg -v log -r 0 --template '{node|formatnode}\n'
-echo '#  debug'
-hg --debug log -r 0 --template '{node|formatnode}\n'
-
-echo '# error on syntax'
-echo 'x = "f' >> t
-hg log
-
-cd ..
-
-echo '# latesttag'
-hg init latesttag
-cd latesttag
-
-echo a > file
-hg ci -Am a -d '0 0'
-
-echo b >> file
-hg ci -m b -d '1 0'
-
-echo c >> head1
-hg ci -Am h1c -d '2 0'
-
-hg update -q 1
-echo d >> head2
-hg ci -Am h2d -d '3 0'
-
-echo e >> head2
-hg ci -m h2e -d '4 0'
-
-hg merge -q
-hg ci -m merge -d '5 0'
-
-echo '# No tag set'
-hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
-
-echo '# one common tag: longuest path wins'
-hg tag -r 1 -m t1 -d '6 0' t1
-hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
-
-echo '# one ancestor tag: more recent wins'
-hg tag -r 2 -m t2 -d '7 0' t2
-hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
-
-echo '# two branch tags: more recent wins'
-hg tag -r 3 -m t3 -d '8 0' t3
-hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
-
-echo '# merged tag overrides'
-hg tag -r 5 -m t5 -d '9 0' t5
-hg tag -r 3 -m at3 -d '10 0' at3
-hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
-cd ..
-
-echo '# style path expansion (issue1948)'
-mkdir -p home/styles
-cat > home/styles/teststyle <<EOF
-changeset = 'test {rev}:{node|short}\n'
-EOF
-HOME=`pwd`/home; export HOME
-cat > latesttag/.hg/hgrc <<EOF
-[ui]
-style = ~/styles/teststyle
-EOF
-hg -R latesttag tip
-
-echo '# test recursive showlist template (issue1989)'
-cat > style1989 <<EOF
-changeset = '{file_mods}{manifest}{extras}'
-file_mod  = 'M|{author|person}\n'
-manifest = '{rev},{author}\n'
-extra = '{key}: {author}\n'
-EOF
-hg -R latesttag log -r tip --style=style1989
-
-echo '# done'
--- a/tests/test-command-template.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1098 +0,0 @@
-0 files updated, 0 files merged, 4 files removed, 0 files unresolved
-created new head
-# default style is like normal output
-#  normal
-#  verbose
-#  debug
-# revision with no copies (used to print a traceback)
-
-# compact style works
-8[tip]   95c24699272e   2020-01-01 10:01 +0000   test
-  third
-
-7:-1   29114dbae42b   1970-01-12 13:46 +0000   user
-  second
-
-6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
-  merge
-
-5:3   13207e5a10d9   1970-01-18 08:40 +0000   person
-  new head
-
-4   32a18f097fcc   1970-01-17 04:53 +0000   person
-  new branch
-
-3   10e46f2dcbf4   1970-01-16 01:06 +0000   person
-  no user, no domain
-
-2   97054abb4ab8   1970-01-14 21:20 +0000   other
-  no person
-
-1   b608e9d1a3f0   1970-01-13 17:33 +0000   other
-  other 1
-
-0   1e4e1b8f71e0   1970-01-12 13:46 +0000   user
-  line 1
-
-8[tip]   95c24699272e   2020-01-01 10:01 +0000   test
-  third
-
-7:-1   29114dbae42b   1970-01-12 13:46 +0000   User Name <user@hostname>
-  second
-
-6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
-  merge
-
-5:3   13207e5a10d9   1970-01-18 08:40 +0000   person
-  new head
-
-4   32a18f097fcc   1970-01-17 04:53 +0000   person
-  new branch
-
-3   10e46f2dcbf4   1970-01-16 01:06 +0000   person
-  no user, no domain
-
-2   97054abb4ab8   1970-01-14 21:20 +0000   other@place
-  no person
-
-1   b608e9d1a3f0   1970-01-13 17:33 +0000   A. N. Other <other@place>
-  other 1
-other 2
-
-other 3
-
-0   1e4e1b8f71e0   1970-01-12 13:46 +0000   User Name <user@hostname>
-  line 1
-line 2
-
-8[tip]:7,-1   95c24699272e   2020-01-01 10:01 +0000   test
-  third
-
-7:-1,-1   29114dbae42b   1970-01-12 13:46 +0000   User Name <user@hostname>
-  second
-
-6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
-  merge
-
-5:3,-1   13207e5a10d9   1970-01-18 08:40 +0000   person
-  new head
-
-4:3,-1   32a18f097fcc   1970-01-17 04:53 +0000   person
-  new branch
-
-3:2,-1   10e46f2dcbf4   1970-01-16 01:06 +0000   person
-  no user, no domain
-
-2:1,-1   97054abb4ab8   1970-01-14 21:20 +0000   other@place
-  no person
-
-1:0,-1   b608e9d1a3f0   1970-01-13 17:33 +0000   A. N. Other <other@place>
-  other 1
-other 2
-
-other 3
-
-0:-1,-1   1e4e1b8f71e0   1970-01-12 13:46 +0000   User Name <user@hostname>
-  line 1
-line 2
-
-# xml style works (--style xml)
-<?xml version="1.0"?>
-<log>
-<logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
-<tag>tip</tag>
-<author email="test">test</author>
-<date>2020-01-01T10:01:00+00:00</date>
-<msg xml:space="preserve">third</msg>
-</logentry>
-<logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="user@hostname">User Name</author>
-<date>1970-01-12T13:46:40+00:00</date>
-<msg xml:space="preserve">second</msg>
-</logentry>
-<logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
-<parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
-<parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
-<author email="person">person</author>
-<date>1970-01-18T08:40:01+00:00</date>
-<msg xml:space="preserve">merge</msg>
-</logentry>
-<logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
-<parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
-<author email="person">person</author>
-<date>1970-01-18T08:40:00+00:00</date>
-<msg xml:space="preserve">new head</msg>
-</logentry>
-<logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
-<branch>foo</branch>
-<author email="person">person</author>
-<date>1970-01-17T04:53:20+00:00</date>
-<msg xml:space="preserve">new branch</msg>
-</logentry>
-<logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
-<author email="person">person</author>
-<date>1970-01-16T01:06:40+00:00</date>
-<msg xml:space="preserve">no user, no domain</msg>
-</logentry>
-<logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
-<author email="other@place">other</author>
-<date>1970-01-14T21:20:00+00:00</date>
-<msg xml:space="preserve">no person</msg>
-</logentry>
-<logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
-<author email="other@place">A. N. Other</author>
-<date>1970-01-13T17:33:20+00:00</date>
-<msg xml:space="preserve">other 1
-other 2
-
-other 3</msg>
-</logentry>
-<logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
-<author email="user@hostname">User Name</author>
-<date>1970-01-12T13:46:40+00:00</date>
-<msg xml:space="preserve">line 1
-line 2</msg>
-</logentry>
-</log>
-# xml style works (-v --style xml)
-<?xml version="1.0"?>
-<log>
-<logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
-<tag>tip</tag>
-<author email="test">test</author>
-<date>2020-01-01T10:01:00+00:00</date>
-<msg xml:space="preserve">third</msg>
-<paths>
-<path action="A">fourth</path>
-<path action="A">third</path>
-<path action="R">second</path>
-</paths>
-<copies>
-<copy source="second">fourth</copy>
-</copies>
-</logentry>
-<logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="user@hostname">User Name</author>
-<date>1970-01-12T13:46:40+00:00</date>
-<msg xml:space="preserve">second</msg>
-<paths>
-<path action="A">second</path>
-</paths>
-</logentry>
-<logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
-<parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
-<parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
-<author email="person">person</author>
-<date>1970-01-18T08:40:01+00:00</date>
-<msg xml:space="preserve">merge</msg>
-<paths>
-</paths>
-</logentry>
-<logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
-<parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
-<author email="person">person</author>
-<date>1970-01-18T08:40:00+00:00</date>
-<msg xml:space="preserve">new head</msg>
-<paths>
-<path action="A">d</path>
-</paths>
-</logentry>
-<logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
-<branch>foo</branch>
-<author email="person">person</author>
-<date>1970-01-17T04:53:20+00:00</date>
-<msg xml:space="preserve">new branch</msg>
-<paths>
-</paths>
-</logentry>
-<logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
-<author email="person">person</author>
-<date>1970-01-16T01:06:40+00:00</date>
-<msg xml:space="preserve">no user, no domain</msg>
-<paths>
-<path action="M">c</path>
-</paths>
-</logentry>
-<logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
-<author email="other@place">other</author>
-<date>1970-01-14T21:20:00+00:00</date>
-<msg xml:space="preserve">no person</msg>
-<paths>
-<path action="A">c</path>
-</paths>
-</logentry>
-<logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
-<author email="other@place">A. N. Other</author>
-<date>1970-01-13T17:33:20+00:00</date>
-<msg xml:space="preserve">other 1
-other 2
-
-other 3</msg>
-<paths>
-<path action="A">b</path>
-</paths>
-</logentry>
-<logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
-<author email="user@hostname">User Name</author>
-<date>1970-01-12T13:46:40+00:00</date>
-<msg xml:space="preserve">line 1
-line 2</msg>
-<paths>
-<path action="A">a</path>
-</paths>
-</logentry>
-</log>
-# xml style works (--debug --style xml)
-<?xml version="1.0"?>
-<log>
-<logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
-<tag>tip</tag>
-<parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="test">test</author>
-<date>2020-01-01T10:01:00+00:00</date>
-<msg xml:space="preserve">third</msg>
-<paths>
-<path action="A">fourth</path>
-<path action="A">third</path>
-<path action="R">second</path>
-</paths>
-<copies>
-<copy source="second">fourth</copy>
-</copies>
-<extra key="branch">default</extra>
-</logentry>
-<logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="user@hostname">User Name</author>
-<date>1970-01-12T13:46:40+00:00</date>
-<msg xml:space="preserve">second</msg>
-<paths>
-<path action="A">second</path>
-</paths>
-<extra key="branch">default</extra>
-</logentry>
-<logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
-<parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
-<parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
-<author email="person">person</author>
-<date>1970-01-18T08:40:01+00:00</date>
-<msg xml:space="preserve">merge</msg>
-<paths>
-</paths>
-<extra key="branch">default</extra>
-</logentry>
-<logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
-<parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="person">person</author>
-<date>1970-01-18T08:40:00+00:00</date>
-<msg xml:space="preserve">new head</msg>
-<paths>
-<path action="A">d</path>
-</paths>
-<extra key="branch">default</extra>
-</logentry>
-<logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
-<branch>foo</branch>
-<parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="person">person</author>
-<date>1970-01-17T04:53:20+00:00</date>
-<msg xml:space="preserve">new branch</msg>
-<paths>
-</paths>
-<extra key="branch">foo</extra>
-</logentry>
-<logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
-<parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="person">person</author>
-<date>1970-01-16T01:06:40+00:00</date>
-<msg xml:space="preserve">no user, no domain</msg>
-<paths>
-<path action="M">c</path>
-</paths>
-<extra key="branch">default</extra>
-</logentry>
-<logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
-<parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="other@place">other</author>
-<date>1970-01-14T21:20:00+00:00</date>
-<msg xml:space="preserve">no person</msg>
-<paths>
-<path action="A">c</path>
-</paths>
-<extra key="branch">default</extra>
-</logentry>
-<logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
-<parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="other@place">A. N. Other</author>
-<date>1970-01-13T17:33:20+00:00</date>
-<msg xml:space="preserve">other 1
-other 2
-
-other 3</msg>
-<paths>
-<path action="A">b</path>
-</paths>
-<extra key="branch">default</extra>
-</logentry>
-<logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<parent revision="-1" node="0000000000000000000000000000000000000000" />
-<author email="user@hostname">User Name</author>
-<date>1970-01-12T13:46:40+00:00</date>
-<msg xml:space="preserve">line 1
-line 2</msg>
-<paths>
-<path action="A">a</path>
-</paths>
-<extra key="branch">default</extra>
-</logentry>
-</log>
-# error if style not readable
-abort: Permission denied: ./q
-# error if no style
-abort: style not found: notexist
-# error if style missing key
-abort: ./t: no key named 'changeset'
-# error if include fails
-abort: template file ./q: Permission denied
-# include works
-8
-7
-6
-5
-4
-3
-2
-1
-0
-# ui.style works
-8
-7
-6
-5
-4
-3
-2
-1
-0
-# issue338
-2020-01-01  test  <test>
-
-	* fourth, second, third:
-	third
-	[95c24699272e] [tip]
-
-1970-01-12  User Name  <user@hostname>
-
-	* second:
-	second
-	[29114dbae42b]
-
-1970-01-18  person  <person>
-
-	* merge
-	[c7b487c6c50e]
-
-	* d:
-	new head
-	[13207e5a10d9]
-
-1970-01-17  person  <person>
-
-	* new branch
-	[32a18f097fcc] <foo>
-
-1970-01-16  person  <person>
-
-	* c:
-	no user, no domain
-	[10e46f2dcbf4]
-
-1970-01-14  other  <other@place>
-
-	* c:
-	no person
-	[97054abb4ab8]
-
-1970-01-13  A. N. Other  <other@place>
-
-	* b:
-	other 1 other 2
-
-	other 3
-	[b608e9d1a3f0]
-
-1970-01-12  User Name  <user@hostname>
-
-	* a:
-	line 1 line 2
-	[1e4e1b8f71e0]
-
-# issue 2130
-2020-01-01  test  <test>
-
-	* fourth, second, third:
-	third
-	[95c24699272e] [tip]
-
-1970-01-18  person  <person>
-
-	* merge
-	[c7b487c6c50e]
-
-1970-01-17  person  <person>
-
-	* new branch
-	[32a18f097fcc] <foo>
-
-# keys work
-author: test
-author: User Name <user@hostname>
-author: person
-author: person
-author: person
-author: person
-author: other@place
-author: A. N. Other <other@place>
-author: User Name <user@hostname>
-author--verbose: test
-author--verbose: User Name <user@hostname>
-author--verbose: person
-author--verbose: person
-author--verbose: person
-author--verbose: person
-author--verbose: other@place
-author--verbose: A. N. Other <other@place>
-author--verbose: User Name <user@hostname>
-author--debug: test
-author--debug: User Name <user@hostname>
-author--debug: person
-author--debug: person
-author--debug: person
-author--debug: person
-author--debug: other@place
-author--debug: A. N. Other <other@place>
-author--debug: User Name <user@hostname>
-branches: 
-branches: 
-branches: 
-branches: 
-branches: foo
-branches: 
-branches: 
-branches: 
-branches: 
-branches--verbose: 
-branches--verbose: 
-branches--verbose: 
-branches--verbose: 
-branches--verbose: foo
-branches--verbose: 
-branches--verbose: 
-branches--verbose: 
-branches--verbose: 
-branches--debug: 
-branches--debug: 
-branches--debug: 
-branches--debug: 
-branches--debug: foo
-branches--debug: 
-branches--debug: 
-branches--debug: 
-branches--debug: 
-date: 1577872860.00
-date: 1000000.00
-date: 1500001.00
-date: 1500000.00
-date: 1400000.00
-date: 1300000.00
-date: 1200000.00
-date: 1100000.00
-date: 1000000.00
-date--verbose: 1577872860.00
-date--verbose: 1000000.00
-date--verbose: 1500001.00
-date--verbose: 1500000.00
-date--verbose: 1400000.00
-date--verbose: 1300000.00
-date--verbose: 1200000.00
-date--verbose: 1100000.00
-date--verbose: 1000000.00
-date--debug: 1577872860.00
-date--debug: 1000000.00
-date--debug: 1500001.00
-date--debug: 1500000.00
-date--debug: 1400000.00
-date--debug: 1300000.00
-date--debug: 1200000.00
-date--debug: 1100000.00
-date--debug: 1000000.00
-desc: third
-desc: second
-desc: merge
-desc: new head
-desc: new branch
-desc: no user, no domain
-desc: no person
-desc: other 1
-other 2
-
-other 3
-desc: line 1
-line 2
-desc--verbose: third
-desc--verbose: second
-desc--verbose: merge
-desc--verbose: new head
-desc--verbose: new branch
-desc--verbose: no user, no domain
-desc--verbose: no person
-desc--verbose: other 1
-other 2
-
-other 3
-desc--verbose: line 1
-line 2
-desc--debug: third
-desc--debug: second
-desc--debug: merge
-desc--debug: new head
-desc--debug: new branch
-desc--debug: no user, no domain
-desc--debug: no person
-desc--debug: other 1
-other 2
-
-other 3
-desc--debug: line 1
-line 2
-file_adds: fourth third
-file_adds: second
-file_adds: 
-file_adds: d
-file_adds: 
-file_adds: 
-file_adds: c
-file_adds: b
-file_adds: a
-file_adds--verbose: fourth third
-file_adds--verbose: second
-file_adds--verbose: 
-file_adds--verbose: d
-file_adds--verbose: 
-file_adds--verbose: 
-file_adds--verbose: c
-file_adds--verbose: b
-file_adds--verbose: a
-file_adds--debug: fourth third
-file_adds--debug: second
-file_adds--debug: 
-file_adds--debug: d
-file_adds--debug: 
-file_adds--debug: 
-file_adds--debug: c
-file_adds--debug: b
-file_adds--debug: a
-file_dels: second
-file_dels: 
-file_dels: 
-file_dels: 
-file_dels: 
-file_dels: 
-file_dels: 
-file_dels: 
-file_dels: 
-file_dels--verbose: second
-file_dels--verbose: 
-file_dels--verbose: 
-file_dels--verbose: 
-file_dels--verbose: 
-file_dels--verbose: 
-file_dels--verbose: 
-file_dels--verbose: 
-file_dels--verbose: 
-file_dels--debug: second
-file_dels--debug: 
-file_dels--debug: 
-file_dels--debug: 
-file_dels--debug: 
-file_dels--debug: 
-file_dels--debug: 
-file_dels--debug: 
-file_dels--debug: 
-file_mods: 
-file_mods: 
-file_mods: 
-file_mods: 
-file_mods: 
-file_mods: c
-file_mods: 
-file_mods: 
-file_mods: 
-file_mods--verbose: 
-file_mods--verbose: 
-file_mods--verbose: 
-file_mods--verbose: 
-file_mods--verbose: 
-file_mods--verbose: c
-file_mods--verbose: 
-file_mods--verbose: 
-file_mods--verbose: 
-file_mods--debug: 
-file_mods--debug: 
-file_mods--debug: 
-file_mods--debug: 
-file_mods--debug: 
-file_mods--debug: c
-file_mods--debug: 
-file_mods--debug: 
-file_mods--debug: 
-file_copies: fourth (second)
-file_copies: 
-file_copies: 
-file_copies: 
-file_copies: 
-file_copies: 
-file_copies: 
-file_copies: 
-file_copies: 
-file_copies--verbose: fourth (second)
-file_copies--verbose: 
-file_copies--verbose: 
-file_copies--verbose: 
-file_copies--verbose: 
-file_copies--verbose: 
-file_copies--verbose: 
-file_copies--verbose: 
-file_copies--verbose: 
-file_copies--debug: fourth (second)
-file_copies--debug: 
-file_copies--debug: 
-file_copies--debug: 
-file_copies--debug: 
-file_copies--debug: 
-file_copies--debug: 
-file_copies--debug: 
-file_copies--debug: 
-file_copies_switch: 
-file_copies_switch: 
-file_copies_switch: 
-file_copies_switch: 
-file_copies_switch: 
-file_copies_switch: 
-file_copies_switch: 
-file_copies_switch: 
-file_copies_switch: 
-file_copies_switch--verbose: 
-file_copies_switch--verbose: 
-file_copies_switch--verbose: 
-file_copies_switch--verbose: 
-file_copies_switch--verbose: 
-file_copies_switch--verbose: 
-file_copies_switch--verbose: 
-file_copies_switch--verbose: 
-file_copies_switch--verbose: 
-file_copies_switch--debug: 
-file_copies_switch--debug: 
-file_copies_switch--debug: 
-file_copies_switch--debug: 
-file_copies_switch--debug: 
-file_copies_switch--debug: 
-file_copies_switch--debug: 
-file_copies_switch--debug: 
-file_copies_switch--debug: 
-files: fourth second third
-files: second
-files: 
-files: d
-files: 
-files: c
-files: c
-files: b
-files: a
-files--verbose: fourth second third
-files--verbose: second
-files--verbose: 
-files--verbose: d
-files--verbose: 
-files--verbose: c
-files--verbose: c
-files--verbose: b
-files--verbose: a
-files--debug: fourth second third
-files--debug: second
-files--debug: 
-files--debug: d
-files--debug: 
-files--debug: c
-files--debug: c
-files--debug: b
-files--debug: a
-manifest: 8:94961b75a2da
-manifest: 7:f2dbc354b94e
-manifest: 6:91015e9dbdd7
-manifest: 5:4dc3def4f9b4
-manifest: 4:90ae8dda64e1
-manifest: 3:cb5a1327723b
-manifest: 2:6e0e82995c35
-manifest: 1:4e8d705b1e53
-manifest: 0:a0c8bcbbb45c
-manifest--verbose: 8:94961b75a2da
-manifest--verbose: 7:f2dbc354b94e
-manifest--verbose: 6:91015e9dbdd7
-manifest--verbose: 5:4dc3def4f9b4
-manifest--verbose: 4:90ae8dda64e1
-manifest--verbose: 3:cb5a1327723b
-manifest--verbose: 2:6e0e82995c35
-manifest--verbose: 1:4e8d705b1e53
-manifest--verbose: 0:a0c8bcbbb45c
-manifest--debug: 8:94961b75a2da554b4df6fb599e5bfc7d48de0c64
-manifest--debug: 7:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
-manifest--debug: 6:91015e9dbdd76a6791085d12b0a0ec7fcd22ffbf
-manifest--debug: 5:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
-manifest--debug: 4:90ae8dda64e1a876c792bccb9af66284f6018363
-manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
-manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
-manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
-manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
-node: 95c24699272ef57d062b8bccc32c878bf841784a
-node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
-node: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
-node: 13207e5a10d9fd28ec424934298e176197f2c67f
-node: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
-node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
-node: 97054abb4ab824450e9164180baf491ae0078465
-node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
-node: 1e4e1b8f71e05681d422154f5421e385fec3454f
-node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
-node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
-node--verbose: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
-node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
-node--verbose: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
-node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
-node--verbose: 97054abb4ab824450e9164180baf491ae0078465
-node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
-node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
-node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
-node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
-node--debug: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
-node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
-node--debug: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
-node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
-node--debug: 97054abb4ab824450e9164180baf491ae0078465
-node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
-node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
-parents: 
-parents: -1:000000000000 
-parents: 5:13207e5a10d9 4:32a18f097fcc 
-parents: 3:10e46f2dcbf4 
-parents: 
-parents: 
-parents: 
-parents: 
-parents: 
-parents--verbose: 
-parents--verbose: -1:000000000000 
-parents--verbose: 5:13207e5a10d9 4:32a18f097fcc 
-parents--verbose: 3:10e46f2dcbf4 
-parents--verbose: 
-parents--verbose: 
-parents--verbose: 
-parents--verbose: 
-parents--verbose: 
-parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000 
-parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000 
-parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:32a18f097fcccf76ef282f62f8a85b3adf8d13c4 
-parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000 
-parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000 
-parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000 
-parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000 
-parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000 
-parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000 
-rev: 8
-rev: 7
-rev: 6
-rev: 5
-rev: 4
-rev: 3
-rev: 2
-rev: 1
-rev: 0
-rev--verbose: 8
-rev--verbose: 7
-rev--verbose: 6
-rev--verbose: 5
-rev--verbose: 4
-rev--verbose: 3
-rev--verbose: 2
-rev--verbose: 1
-rev--verbose: 0
-rev--debug: 8
-rev--debug: 7
-rev--debug: 6
-rev--debug: 5
-rev--debug: 4
-rev--debug: 3
-rev--debug: 2
-rev--debug: 1
-rev--debug: 0
-tags: tip
-tags: 
-tags: 
-tags: 
-tags: 
-tags: 
-tags: 
-tags: 
-tags: 
-tags--verbose: tip
-tags--verbose: 
-tags--verbose: 
-tags--verbose: 
-tags--verbose: 
-tags--verbose: 
-tags--verbose: 
-tags--verbose: 
-tags--verbose: 
-tags--debug: tip
-tags--debug: 
-tags--debug: 
-tags--debug: 
-tags--debug: 
-tags--debug: 
-tags--debug: 
-tags--debug: 
-tags--debug: 
-diffstat: 3: +2/-1
-diffstat: 1: +1/-0
-diffstat: 0: +0/-0
-diffstat: 1: +1/-0
-diffstat: 0: +0/-0
-diffstat: 1: +1/-0
-diffstat: 1: +4/-0
-diffstat: 1: +2/-0
-diffstat: 1: +1/-0
-diffstat--verbose: 3: +2/-1
-diffstat--verbose: 1: +1/-0
-diffstat--verbose: 0: +0/-0
-diffstat--verbose: 1: +1/-0
-diffstat--verbose: 0: +0/-0
-diffstat--verbose: 1: +1/-0
-diffstat--verbose: 1: +4/-0
-diffstat--verbose: 1: +2/-0
-diffstat--verbose: 1: +1/-0
-diffstat--debug: 3: +2/-1
-diffstat--debug: 1: +1/-0
-diffstat--debug: 0: +0/-0
-diffstat--debug: 1: +1/-0
-diffstat--debug: 0: +0/-0
-diffstat--debug: 1: +1/-0
-diffstat--debug: 1: +4/-0
-diffstat--debug: 1: +2/-0
-diffstat--debug: 1: +1/-0
-extras: branch=default
-extras: branch=default
-extras: branch=default
-extras: branch=default
-extras: branch=foo
-extras: branch=default
-extras: branch=default
-extras: branch=default
-extras: branch=default
-extras--verbose: branch=default
-extras--verbose: branch=default
-extras--verbose: branch=default
-extras--verbose: branch=default
-extras--verbose: branch=foo
-extras--verbose: branch=default
-extras--verbose: branch=default
-extras--verbose: branch=default
-extras--verbose: branch=default
-extras--debug: branch=default
-extras--debug: branch=default
-extras--debug: branch=default
-extras--debug: branch=default
-extras--debug: branch=foo
-extras--debug: branch=default
-extras--debug: branch=default
-extras--debug: branch=default
-extras--debug: branch=default
-# filters work
-
-hostname
-
-
-
-
-place
-place
-hostname
-test
-User Name
-person
-person
-person
-person
-other
-A. N. Other
-User Name
-test
-user
-person
-person
-person
-person
-other
-other
-user
-in the future
-Wed Jan 01 10:01:00 2020 +0000
-Mon Jan 12 13:46:40 1970 +0000
-Sun Jan 18 08:40:01 1970 +0000
-Sun Jan 18 08:40:00 1970 +0000
-Sat Jan 17 04:53:20 1970 +0000
-Fri Jan 16 01:06:40 1970 +0000
-Wed Jan 14 21:20:00 1970 +0000
-Tue Jan 13 17:33:20 1970 +0000
-Mon Jan 12 13:46:40 1970 +0000
-2020-01-01 10:01 +0000
-1970-01-12 13:46 +0000
-1970-01-18 08:40 +0000
-1970-01-18 08:40 +0000
-1970-01-17 04:53 +0000
-1970-01-16 01:06 +0000
-1970-01-14 21:20 +0000
-1970-01-13 17:33 +0000
-1970-01-12 13:46 +0000
-2020-01-01 10:01:00 +0000
-1970-01-12 13:46:40 +0000
-1970-01-18 08:40:01 +0000
-1970-01-18 08:40:00 +0000
-1970-01-17 04:53:20 +0000
-1970-01-16 01:06:40 +0000
-1970-01-14 21:20:00 +0000
-1970-01-13 17:33:20 +0000
-1970-01-12 13:46:40 +0000
-Wed, 01 Jan 2020 10:01:00 +0000
-Mon, 12 Jan 1970 13:46:40 +0000
-Sun, 18 Jan 1970 08:40:01 +0000
-Sun, 18 Jan 1970 08:40:00 +0000
-Sat, 17 Jan 1970 04:53:20 +0000
-Fri, 16 Jan 1970 01:06:40 +0000
-Wed, 14 Jan 1970 21:20:00 +0000
-Tue, 13 Jan 1970 17:33:20 +0000
-Mon, 12 Jan 1970 13:46:40 +0000
-third
-second
-merge
-new head
-new branch
-no user, no domain
-no person
-other 1
-line 1
-95c24699272e
-29114dbae42b
-c7b487c6c50e
-13207e5a10d9
-32a18f097fcc
-10e46f2dcbf4
-97054abb4ab8
-b608e9d1a3f0
-1e4e1b8f71e0
-<changeset author="test"/>
-<changeset author="User Name &lt;user@hostname&gt;"/>
-<changeset author="person"/>
-<changeset author="person"/>
-<changeset author="person"/>
-<changeset author="person"/>
-<changeset author="other@place"/>
-<changeset author="A. N. Other &lt;other@place&gt;"/>
-<changeset author="User Name &lt;user@hostname&gt;"/>
-8: 
-7: 8:95c24699272e
-6: 
-5: 6:c7b487c6c50e
-4: 6:c7b487c6c50e
-3: 4:32a18f097fcc 5:13207e5a10d9
-2: 3:10e46f2dcbf4
-1: 2:97054abb4ab8
-0: 1:b608e9d1a3f0
-# formatnode filter works
-#  quiet
-1e4e1b8f71e0
-#  normal
-1e4e1b8f71e0
-#  verbose
-1e4e1b8f71e0
-#  debug
-1e4e1b8f71e05681d422154f5421e385fec3454f
-# error on syntax
-abort: t:3: unmatched quotes
-# latesttag
-adding file
-adding head1
-adding head2
-created new head
-# No tag set
-5: null+5
-4: null+4
-3: null+3
-2: null+3
-1: null+2
-0: null+1
-# one common tag: longuest path wins
-6: t1+4
-5: t1+3
-4: t1+2
-3: t1+1
-2: t1+1
-1: t1+0
-0: null+1
-# one ancestor tag: more recent wins
-7: t2+3
-6: t2+2
-5: t2+1
-4: t1+2
-3: t1+1
-2: t2+0
-1: t1+0
-0: null+1
-# two branch tags: more recent wins
-8: t3+5
-7: t3+4
-6: t3+3
-5: t3+2
-4: t3+1
-3: t3+0
-2: t2+0
-1: t1+0
-0: null+1
-# merged tag overrides
-10: t5+5
-9: t5+4
-8: t5+3
-7: t5+2
-6: t5+1
-5: t5+0
-4: at3:t3+1
-3: at3:t3+0
-2: t2+0
-1: t1+0
-0: null+1
-# style path expansion (issue1948)
-test 10:dee8f28249af
-# test recursive showlist template (issue1989)
-M|test
-10,test
-branch: test
-# done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-command-template.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,1327 @@
+  $ hg init a
+  $ cd a
+  $ echo a > a
+  $ hg add a
+  $ echo line 1 > b
+  $ echo line 2 >> b
+  $ hg commit -l b -d '1000000 0' -u 'User Name <user@hostname>'
+
+  $ hg add b
+  $ echo other 1 > c
+  $ echo other 2 >> c
+  $ echo >> c
+  $ echo other 3 >> c
+  $ hg commit -l c -d '1100000 0' -u 'A. N. Other <other@place>'
+
+  $ hg add c
+  $ hg commit -m 'no person' -d '1200000 0' -u 'other@place'
+  $ echo c >> c
+  $ hg commit -m 'no user, no domain' -d '1300000 0' -u 'person'
+
+  $ echo foo > .hg/branch
+  $ hg commit -m 'new branch' -d '1400000 0' -u 'person'
+
+  $ hg co -q 3
+  $ echo other 4 >> d
+  $ hg add d
+  $ hg commit -m 'new head' -d '1500000 0' -u 'person'
+
+  $ hg merge -q foo
+  $ hg commit -m 'merge' -d '1500001 0' -u 'person'
+
+Second branch starting at nullrev:
+
+  $ hg update null
+  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  $ echo second > second
+  $ hg add second
+  $ hg commit -m second -d '1000000 0' -u 'User Name <user@hostname>'
+  created new head
+
+  $ echo third > third
+  $ hg add third
+  $ hg mv second fourth
+  $ hg commit -m third -d "2020-01-01 10:01"
+
+Make sure user/global hgrc does not affect tests
+
+  $ echo '[ui]' > .hg/hgrc
+  $ echo 'logtemplate =' >> .hg/hgrc
+  $ echo 'style =' >> .hg/hgrc
+
+Default style is like normal output:
+
+  $ hg log > log.out
+  $ hg log --style default > style.out
+  $ cmp log.out style.out || diff -u log.out style.out
+
+  $ hg log -v > log.out
+  $ hg log -v --style default > style.out
+  $ cmp log.out style.out || diff -u log.out style.out
+
+  $ hg log --debug > log.out
+  $ hg log --debug --style default > style.out
+  $ cmp log.out style.out || diff -u log.out style.out
+
+Revision with no copies (used to print a traceback):
+
+  $ hg tip -v --template '\n'
+  
+
+Compact style works:
+
+  $ hg log --style compact
+  8[tip]   95c24699272e   2020-01-01 10:01 +0000   test
+    third
+  
+  7:-1   29114dbae42b   1970-01-12 13:46 +0000   user
+    second
+  
+  6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
+    merge
+  
+  5:3   13207e5a10d9   1970-01-18 08:40 +0000   person
+    new head
+  
+  4   32a18f097fcc   1970-01-17 04:53 +0000   person
+    new branch
+  
+  3   10e46f2dcbf4   1970-01-16 01:06 +0000   person
+    no user, no domain
+  
+  2   97054abb4ab8   1970-01-14 21:20 +0000   other
+    no person
+  
+  1   b608e9d1a3f0   1970-01-13 17:33 +0000   other
+    other 1
+  
+  0   1e4e1b8f71e0   1970-01-12 13:46 +0000   user
+    line 1
+  
+
+  $ hg log -v --style compact
+  8[tip]   95c24699272e   2020-01-01 10:01 +0000   test
+    third
+  
+  7:-1   29114dbae42b   1970-01-12 13:46 +0000   User Name <user@hostname>
+    second
+  
+  6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
+    merge
+  
+  5:3   13207e5a10d9   1970-01-18 08:40 +0000   person
+    new head
+  
+  4   32a18f097fcc   1970-01-17 04:53 +0000   person
+    new branch
+  
+  3   10e46f2dcbf4   1970-01-16 01:06 +0000   person
+    no user, no domain
+  
+  2   97054abb4ab8   1970-01-14 21:20 +0000   other@place
+    no person
+  
+  1   b608e9d1a3f0   1970-01-13 17:33 +0000   A. N. Other <other@place>
+    other 1
+  other 2
+  
+  other 3
+  
+  0   1e4e1b8f71e0   1970-01-12 13:46 +0000   User Name <user@hostname>
+    line 1
+  line 2
+  
+
+  $ hg log --debug --style compact
+  8[tip]:7,-1   95c24699272e   2020-01-01 10:01 +0000   test
+    third
+  
+  7:-1,-1   29114dbae42b   1970-01-12 13:46 +0000   User Name <user@hostname>
+    second
+  
+  6:5,4   c7b487c6c50e   1970-01-18 08:40 +0000   person
+    merge
+  
+  5:3,-1   13207e5a10d9   1970-01-18 08:40 +0000   person
+    new head
+  
+  4:3,-1   32a18f097fcc   1970-01-17 04:53 +0000   person
+    new branch
+  
+  3:2,-1   10e46f2dcbf4   1970-01-16 01:06 +0000   person
+    no user, no domain
+  
+  2:1,-1   97054abb4ab8   1970-01-14 21:20 +0000   other@place
+    no person
+  
+  1:0,-1   b608e9d1a3f0   1970-01-13 17:33 +0000   A. N. Other <other@place>
+    other 1
+  other 2
+  
+  other 3
+  
+  0:-1,-1   1e4e1b8f71e0   1970-01-12 13:46 +0000   User Name <user@hostname>
+    line 1
+  line 2
+  
+
+Test xml styles:
+
+  $ hg log --style xml
+  <?xml version="1.0"?>
+  <log>
+  <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
+  <tag>tip</tag>
+  <author email="test">test</author>
+  <date>2020-01-01T10:01:00+00:00</date>
+  <msg xml:space="preserve">third</msg>
+  </logentry>
+  <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="user@hostname">User Name</author>
+  <date>1970-01-12T13:46:40+00:00</date>
+  <msg xml:space="preserve">second</msg>
+  </logentry>
+  <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
+  <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
+  <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
+  <author email="person">person</author>
+  <date>1970-01-18T08:40:01+00:00</date>
+  <msg xml:space="preserve">merge</msg>
+  </logentry>
+  <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
+  <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
+  <author email="person">person</author>
+  <date>1970-01-18T08:40:00+00:00</date>
+  <msg xml:space="preserve">new head</msg>
+  </logentry>
+  <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
+  <branch>foo</branch>
+  <author email="person">person</author>
+  <date>1970-01-17T04:53:20+00:00</date>
+  <msg xml:space="preserve">new branch</msg>
+  </logentry>
+  <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
+  <author email="person">person</author>
+  <date>1970-01-16T01:06:40+00:00</date>
+  <msg xml:space="preserve">no user, no domain</msg>
+  </logentry>
+  <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
+  <author email="other@place">other</author>
+  <date>1970-01-14T21:20:00+00:00</date>
+  <msg xml:space="preserve">no person</msg>
+  </logentry>
+  <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
+  <author email="other@place">A. N. Other</author>
+  <date>1970-01-13T17:33:20+00:00</date>
+  <msg xml:space="preserve">other 1
+  other 2
+  
+  other 3</msg>
+  </logentry>
+  <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
+  <author email="user@hostname">User Name</author>
+  <date>1970-01-12T13:46:40+00:00</date>
+  <msg xml:space="preserve">line 1
+  line 2</msg>
+  </logentry>
+  </log>
+
+  $ hg log -v --style xml
+  <?xml version="1.0"?>
+  <log>
+  <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
+  <tag>tip</tag>
+  <author email="test">test</author>
+  <date>2020-01-01T10:01:00+00:00</date>
+  <msg xml:space="preserve">third</msg>
+  <paths>
+  <path action="A">fourth</path>
+  <path action="A">third</path>
+  <path action="R">second</path>
+  </paths>
+  <copies>
+  <copy source="second">fourth</copy>
+  </copies>
+  </logentry>
+  <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="user@hostname">User Name</author>
+  <date>1970-01-12T13:46:40+00:00</date>
+  <msg xml:space="preserve">second</msg>
+  <paths>
+  <path action="A">second</path>
+  </paths>
+  </logentry>
+  <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
+  <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
+  <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
+  <author email="person">person</author>
+  <date>1970-01-18T08:40:01+00:00</date>
+  <msg xml:space="preserve">merge</msg>
+  <paths>
+  </paths>
+  </logentry>
+  <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
+  <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
+  <author email="person">person</author>
+  <date>1970-01-18T08:40:00+00:00</date>
+  <msg xml:space="preserve">new head</msg>
+  <paths>
+  <path action="A">d</path>
+  </paths>
+  </logentry>
+  <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
+  <branch>foo</branch>
+  <author email="person">person</author>
+  <date>1970-01-17T04:53:20+00:00</date>
+  <msg xml:space="preserve">new branch</msg>
+  <paths>
+  </paths>
+  </logentry>
+  <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
+  <author email="person">person</author>
+  <date>1970-01-16T01:06:40+00:00</date>
+  <msg xml:space="preserve">no user, no domain</msg>
+  <paths>
+  <path action="M">c</path>
+  </paths>
+  </logentry>
+  <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
+  <author email="other@place">other</author>
+  <date>1970-01-14T21:20:00+00:00</date>
+  <msg xml:space="preserve">no person</msg>
+  <paths>
+  <path action="A">c</path>
+  </paths>
+  </logentry>
+  <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
+  <author email="other@place">A. N. Other</author>
+  <date>1970-01-13T17:33:20+00:00</date>
+  <msg xml:space="preserve">other 1
+  other 2
+  
+  other 3</msg>
+  <paths>
+  <path action="A">b</path>
+  </paths>
+  </logentry>
+  <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
+  <author email="user@hostname">User Name</author>
+  <date>1970-01-12T13:46:40+00:00</date>
+  <msg xml:space="preserve">line 1
+  line 2</msg>
+  <paths>
+  <path action="A">a</path>
+  </paths>
+  </logentry>
+  </log>
+
+  $ hg log --debug --style xml
+  <?xml version="1.0"?>
+  <log>
+  <logentry revision="8" node="95c24699272ef57d062b8bccc32c878bf841784a">
+  <tag>tip</tag>
+  <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" />
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="test">test</author>
+  <date>2020-01-01T10:01:00+00:00</date>
+  <msg xml:space="preserve">third</msg>
+  <paths>
+  <path action="A">fourth</path>
+  <path action="A">third</path>
+  <path action="R">second</path>
+  </paths>
+  <copies>
+  <copy source="second">fourth</copy>
+  </copies>
+  <extra key="branch">default</extra>
+  </logentry>
+  <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453">
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="user@hostname">User Name</author>
+  <date>1970-01-12T13:46:40+00:00</date>
+  <msg xml:space="preserve">second</msg>
+  <paths>
+  <path action="A">second</path>
+  </paths>
+  <extra key="branch">default</extra>
+  </logentry>
+  <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f">
+  <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" />
+  <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" />
+  <author email="person">person</author>
+  <date>1970-01-18T08:40:01+00:00</date>
+  <msg xml:space="preserve">merge</msg>
+  <paths>
+  </paths>
+  <extra key="branch">default</extra>
+  </logentry>
+  <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f">
+  <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="person">person</author>
+  <date>1970-01-18T08:40:00+00:00</date>
+  <msg xml:space="preserve">new head</msg>
+  <paths>
+  <path action="A">d</path>
+  </paths>
+  <extra key="branch">default</extra>
+  </logentry>
+  <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4">
+  <branch>foo</branch>
+  <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" />
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="person">person</author>
+  <date>1970-01-17T04:53:20+00:00</date>
+  <msg xml:space="preserve">new branch</msg>
+  <paths>
+  </paths>
+  <extra key="branch">foo</extra>
+  </logentry>
+  <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47">
+  <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" />
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="person">person</author>
+  <date>1970-01-16T01:06:40+00:00</date>
+  <msg xml:space="preserve">no user, no domain</msg>
+  <paths>
+  <path action="M">c</path>
+  </paths>
+  <extra key="branch">default</extra>
+  </logentry>
+  <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465">
+  <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" />
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="other@place">other</author>
+  <date>1970-01-14T21:20:00+00:00</date>
+  <msg xml:space="preserve">no person</msg>
+  <paths>
+  <path action="A">c</path>
+  </paths>
+  <extra key="branch">default</extra>
+  </logentry>
+  <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965">
+  <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" />
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="other@place">A. N. Other</author>
+  <date>1970-01-13T17:33:20+00:00</date>
+  <msg xml:space="preserve">other 1
+  other 2
+  
+  other 3</msg>
+  <paths>
+  <path action="A">b</path>
+  </paths>
+  <extra key="branch">default</extra>
+  </logentry>
+  <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f">
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <parent revision="-1" node="0000000000000000000000000000000000000000" />
+  <author email="user@hostname">User Name</author>
+  <date>1970-01-12T13:46:40+00:00</date>
+  <msg xml:space="preserve">line 1
+  line 2</msg>
+  <paths>
+  <path action="A">a</path>
+  </paths>
+  <extra key="branch">default</extra>
+  </logentry>
+  </log>
+
+
+Error if style not readable:
+
+  $ touch q
+  $ chmod 0 q
+  $ hg log --style ./q
+  abort: Permission denied: ./q
+
+Error if no style:
+
+  $ hg log --style notexist
+  abort: style not found: notexist
+
+Error if style missing key:
+
+  $ echo 'q = q' > t
+  $ hg log --style ./t
+  abort: ./t: no key named 'changeset'
+
+Error if include fails:
+
+  $ echo 'changeset = q' >> t
+  $ hg log --style ./t
+  abort: template file ./q: Permission denied
+
+Include works:
+
+  $ rm q
+  $ echo '{rev}' > q
+  $ hg log --style ./t
+  8
+  7
+  6
+  5
+  4
+  3
+  2
+  1
+  0
+
+ui.style works:
+
+  $ echo '[ui]' > .hg/hgrc
+  $ echo 'style = t' >> .hg/hgrc
+  $ hg log
+  8
+  7
+  6
+  5
+  4
+  3
+  2
+  1
+  0
+
+
+Issue338:
+
+  $ hg log --style=changelog > changelog
+
+  $ cat changelog
+  2020-01-01  test  <test>
+  
+  	* fourth, second, third:
+  	third
+  	[95c24699272e] [tip]
+  
+  1970-01-12  User Name  <user@hostname>
+  
+  	* second:
+  	second
+  	[29114dbae42b]
+  
+  1970-01-18  person  <person>
+  
+  	* merge
+  	[c7b487c6c50e]
+  
+  	* d:
+  	new head
+  	[13207e5a10d9]
+  
+  1970-01-17  person  <person>
+  
+  	* new branch
+  	[32a18f097fcc] <foo>
+  
+  1970-01-16  person  <person>
+  
+  	* c:
+  	no user, no domain
+  	[10e46f2dcbf4]
+  
+  1970-01-14  other  <other@place>
+  
+  	* c:
+  	no person
+  	[97054abb4ab8]
+  
+  1970-01-13  A. N. Other  <other@place>
+  
+  	* b:
+  	other 1 other 2
+  
+  	other 3
+  	[b608e9d1a3f0]
+  
+  1970-01-12  User Name  <user@hostname>
+  
+  	* a:
+  	line 1 line 2
+  	[1e4e1b8f71e0]
+  
+
+Issue 2130:
+
+  $ hg heads --style changelog
+  2020-01-01  test  <test>
+  
+  	* fourth, second, third:
+  	third
+  	[95c24699272e] [tip]
+  
+  1970-01-18  person  <person>
+  
+  	* merge
+  	[c7b487c6c50e]
+  
+  1970-01-17  person  <person>
+  
+  	* new branch
+  	[32a18f097fcc] <foo>
+  
+
+Keys work:
+
+  $ for key in author branches date desc file_adds file_dels file_mods \
+  >         file_copies file_copies_switch files \
+  >         manifest node parents rev tags diffstat extras; do
+  >     for mode in '' --verbose --debug; do
+  >         hg log $mode --template "$key$mode: {$key}\n"
+  >     done
+  > done
+  author: test
+  author: User Name <user@hostname>
+  author: person
+  author: person
+  author: person
+  author: person
+  author: other@place
+  author: A. N. Other <other@place>
+  author: User Name <user@hostname>
+  author--verbose: test
+  author--verbose: User Name <user@hostname>
+  author--verbose: person
+  author--verbose: person
+  author--verbose: person
+  author--verbose: person
+  author--verbose: other@place
+  author--verbose: A. N. Other <other@place>
+  author--verbose: User Name <user@hostname>
+  author--debug: test
+  author--debug: User Name <user@hostname>
+  author--debug: person
+  author--debug: person
+  author--debug: person
+  author--debug: person
+  author--debug: other@place
+  author--debug: A. N. Other <other@place>
+  author--debug: User Name <user@hostname>
+  branches: 
+  branches: 
+  branches: 
+  branches: 
+  branches: foo
+  branches: 
+  branches: 
+  branches: 
+  branches: 
+  branches--verbose: 
+  branches--verbose: 
+  branches--verbose: 
+  branches--verbose: 
+  branches--verbose: foo
+  branches--verbose: 
+  branches--verbose: 
+  branches--verbose: 
+  branches--verbose: 
+  branches--debug: 
+  branches--debug: 
+  branches--debug: 
+  branches--debug: 
+  branches--debug: foo
+  branches--debug: 
+  branches--debug: 
+  branches--debug: 
+  branches--debug: 
+  date: 1577872860.00
+  date: 1000000.00
+  date: 1500001.00
+  date: 1500000.00
+  date: 1400000.00
+  date: 1300000.00
+  date: 1200000.00
+  date: 1100000.00
+  date: 1000000.00
+  date--verbose: 1577872860.00
+  date--verbose: 1000000.00
+  date--verbose: 1500001.00
+  date--verbose: 1500000.00
+  date--verbose: 1400000.00
+  date--verbose: 1300000.00
+  date--verbose: 1200000.00
+  date--verbose: 1100000.00
+  date--verbose: 1000000.00
+  date--debug: 1577872860.00
+  date--debug: 1000000.00
+  date--debug: 1500001.00
+  date--debug: 1500000.00
+  date--debug: 1400000.00
+  date--debug: 1300000.00
+  date--debug: 1200000.00
+  date--debug: 1100000.00
+  date--debug: 1000000.00
+  desc: third
+  desc: second
+  desc: merge
+  desc: new head
+  desc: new branch
+  desc: no user, no domain
+  desc: no person
+  desc: other 1
+  other 2
+  
+  other 3
+  desc: line 1
+  line 2
+  desc--verbose: third
+  desc--verbose: second
+  desc--verbose: merge
+  desc--verbose: new head
+  desc--verbose: new branch
+  desc--verbose: no user, no domain
+  desc--verbose: no person
+  desc--verbose: other 1
+  other 2
+  
+  other 3
+  desc--verbose: line 1
+  line 2
+  desc--debug: third
+  desc--debug: second
+  desc--debug: merge
+  desc--debug: new head
+  desc--debug: new branch
+  desc--debug: no user, no domain
+  desc--debug: no person
+  desc--debug: other 1
+  other 2
+  
+  other 3
+  desc--debug: line 1
+  line 2
+  file_adds: fourth third
+  file_adds: second
+  file_adds: 
+  file_adds: d
+  file_adds: 
+  file_adds: 
+  file_adds: c
+  file_adds: b
+  file_adds: a
+  file_adds--verbose: fourth third
+  file_adds--verbose: second
+  file_adds--verbose: 
+  file_adds--verbose: d
+  file_adds--verbose: 
+  file_adds--verbose: 
+  file_adds--verbose: c
+  file_adds--verbose: b
+  file_adds--verbose: a
+  file_adds--debug: fourth third
+  file_adds--debug: second
+  file_adds--debug: 
+  file_adds--debug: d
+  file_adds--debug: 
+  file_adds--debug: 
+  file_adds--debug: c
+  file_adds--debug: b
+  file_adds--debug: a
+  file_dels: second
+  file_dels: 
+  file_dels: 
+  file_dels: 
+  file_dels: 
+  file_dels: 
+  file_dels: 
+  file_dels: 
+  file_dels: 
+  file_dels--verbose: second
+  file_dels--verbose: 
+  file_dels--verbose: 
+  file_dels--verbose: 
+  file_dels--verbose: 
+  file_dels--verbose: 
+  file_dels--verbose: 
+  file_dels--verbose: 
+  file_dels--verbose: 
+  file_dels--debug: second
+  file_dels--debug: 
+  file_dels--debug: 
+  file_dels--debug: 
+  file_dels--debug: 
+  file_dels--debug: 
+  file_dels--debug: 
+  file_dels--debug: 
+  file_dels--debug: 
+  file_mods: 
+  file_mods: 
+  file_mods: 
+  file_mods: 
+  file_mods: 
+  file_mods: c
+  file_mods: 
+  file_mods: 
+  file_mods: 
+  file_mods--verbose: 
+  file_mods--verbose: 
+  file_mods--verbose: 
+  file_mods--verbose: 
+  file_mods--verbose: 
+  file_mods--verbose: c
+  file_mods--verbose: 
+  file_mods--verbose: 
+  file_mods--verbose: 
+  file_mods--debug: 
+  file_mods--debug: 
+  file_mods--debug: 
+  file_mods--debug: 
+  file_mods--debug: 
+  file_mods--debug: c
+  file_mods--debug: 
+  file_mods--debug: 
+  file_mods--debug: 
+  file_copies: fourth (second)
+  file_copies: 
+  file_copies: 
+  file_copies: 
+  file_copies: 
+  file_copies: 
+  file_copies: 
+  file_copies: 
+  file_copies: 
+  file_copies--verbose: fourth (second)
+  file_copies--verbose: 
+  file_copies--verbose: 
+  file_copies--verbose: 
+  file_copies--verbose: 
+  file_copies--verbose: 
+  file_copies--verbose: 
+  file_copies--verbose: 
+  file_copies--verbose: 
+  file_copies--debug: fourth (second)
+  file_copies--debug: 
+  file_copies--debug: 
+  file_copies--debug: 
+  file_copies--debug: 
+  file_copies--debug: 
+  file_copies--debug: 
+  file_copies--debug: 
+  file_copies--debug: 
+  file_copies_switch: 
+  file_copies_switch: 
+  file_copies_switch: 
+  file_copies_switch: 
+  file_copies_switch: 
+  file_copies_switch: 
+  file_copies_switch: 
+  file_copies_switch: 
+  file_copies_switch: 
+  file_copies_switch--verbose: 
+  file_copies_switch--verbose: 
+  file_copies_switch--verbose: 
+  file_copies_switch--verbose: 
+  file_copies_switch--verbose: 
+  file_copies_switch--verbose: 
+  file_copies_switch--verbose: 
+  file_copies_switch--verbose: 
+  file_copies_switch--verbose: 
+  file_copies_switch--debug: 
+  file_copies_switch--debug: 
+  file_copies_switch--debug: 
+  file_copies_switch--debug: 
+  file_copies_switch--debug: 
+  file_copies_switch--debug: 
+  file_copies_switch--debug: 
+  file_copies_switch--debug: 
+  file_copies_switch--debug: 
+  files: fourth second third
+  files: second
+  files: 
+  files: d
+  files: 
+  files: c
+  files: c
+  files: b
+  files: a
+  files--verbose: fourth second third
+  files--verbose: second
+  files--verbose: 
+  files--verbose: d
+  files--verbose: 
+  files--verbose: c
+  files--verbose: c
+  files--verbose: b
+  files--verbose: a
+  files--debug: fourth second third
+  files--debug: second
+  files--debug: 
+  files--debug: d
+  files--debug: 
+  files--debug: c
+  files--debug: c
+  files--debug: b
+  files--debug: a
+  manifest: 8:94961b75a2da
+  manifest: 7:f2dbc354b94e
+  manifest: 6:91015e9dbdd7
+  manifest: 5:4dc3def4f9b4
+  manifest: 4:90ae8dda64e1
+  manifest: 3:cb5a1327723b
+  manifest: 2:6e0e82995c35
+  manifest: 1:4e8d705b1e53
+  manifest: 0:a0c8bcbbb45c
+  manifest--verbose: 8:94961b75a2da
+  manifest--verbose: 7:f2dbc354b94e
+  manifest--verbose: 6:91015e9dbdd7
+  manifest--verbose: 5:4dc3def4f9b4
+  manifest--verbose: 4:90ae8dda64e1
+  manifest--verbose: 3:cb5a1327723b
+  manifest--verbose: 2:6e0e82995c35
+  manifest--verbose: 1:4e8d705b1e53
+  manifest--verbose: 0:a0c8bcbbb45c
+  manifest--debug: 8:94961b75a2da554b4df6fb599e5bfc7d48de0c64
+  manifest--debug: 7:f2dbc354b94e5ec0b4f10680ee0cee816101d0bf
+  manifest--debug: 6:91015e9dbdd76a6791085d12b0a0ec7fcd22ffbf
+  manifest--debug: 5:4dc3def4f9b4c6e8de820f6ee74737f91e96a216
+  manifest--debug: 4:90ae8dda64e1a876c792bccb9af66284f6018363
+  manifest--debug: 3:cb5a1327723bada42f117e4c55a303246eaf9ccc
+  manifest--debug: 2:6e0e82995c35d0d57a52aca8da4e56139e06b4b1
+  manifest--debug: 1:4e8d705b1e53e3f9375e0e60dc7b525d8211fe55
+  manifest--debug: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
+  node: 95c24699272ef57d062b8bccc32c878bf841784a
+  node: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
+  node: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
+  node: 13207e5a10d9fd28ec424934298e176197f2c67f
+  node: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
+  node: 10e46f2dcbf4823578cf180f33ecf0b957964c47
+  node: 97054abb4ab824450e9164180baf491ae0078465
+  node: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
+  node: 1e4e1b8f71e05681d422154f5421e385fec3454f
+  node--verbose: 95c24699272ef57d062b8bccc32c878bf841784a
+  node--verbose: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
+  node--verbose: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
+  node--verbose: 13207e5a10d9fd28ec424934298e176197f2c67f
+  node--verbose: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
+  node--verbose: 10e46f2dcbf4823578cf180f33ecf0b957964c47
+  node--verbose: 97054abb4ab824450e9164180baf491ae0078465
+  node--verbose: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
+  node--verbose: 1e4e1b8f71e05681d422154f5421e385fec3454f
+  node--debug: 95c24699272ef57d062b8bccc32c878bf841784a
+  node--debug: 29114dbae42b9f078cf2714dbe3a86bba8ec7453
+  node--debug: c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f
+  node--debug: 13207e5a10d9fd28ec424934298e176197f2c67f
+  node--debug: 32a18f097fcccf76ef282f62f8a85b3adf8d13c4
+  node--debug: 10e46f2dcbf4823578cf180f33ecf0b957964c47
+  node--debug: 97054abb4ab824450e9164180baf491ae0078465
+  node--debug: b608e9d1a3f0273ccf70fb85fd6866b3482bf965
+  node--debug: 1e4e1b8f71e05681d422154f5421e385fec3454f
+  parents: 
+  parents: -1:000000000000 
+  parents: 5:13207e5a10d9 4:32a18f097fcc 
+  parents: 3:10e46f2dcbf4 
+  parents: 
+  parents: 
+  parents: 
+  parents: 
+  parents: 
+  parents--verbose: 
+  parents--verbose: -1:000000000000 
+  parents--verbose: 5:13207e5a10d9 4:32a18f097fcc 
+  parents--verbose: 3:10e46f2dcbf4 
+  parents--verbose: 
+  parents--verbose: 
+  parents--verbose: 
+  parents--verbose: 
+  parents--verbose: 
+  parents--debug: 7:29114dbae42b9f078cf2714dbe3a86bba8ec7453 -1:0000000000000000000000000000000000000000 
+  parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000 
+  parents--debug: 5:13207e5a10d9fd28ec424934298e176197f2c67f 4:32a18f097fcccf76ef282f62f8a85b3adf8d13c4 
+  parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000 
+  parents--debug: 3:10e46f2dcbf4823578cf180f33ecf0b957964c47 -1:0000000000000000000000000000000000000000 
+  parents--debug: 2:97054abb4ab824450e9164180baf491ae0078465 -1:0000000000000000000000000000000000000000 
+  parents--debug: 1:b608e9d1a3f0273ccf70fb85fd6866b3482bf965 -1:0000000000000000000000000000000000000000 
+  parents--debug: 0:1e4e1b8f71e05681d422154f5421e385fec3454f -1:0000000000000000000000000000000000000000 
+  parents--debug: -1:0000000000000000000000000000000000000000 -1:0000000000000000000000000000000000000000 
+  rev: 8
+  rev: 7
+  rev: 6
+  rev: 5
+  rev: 4
+  rev: 3
+  rev: 2
+  rev: 1
+  rev: 0
+  rev--verbose: 8
+  rev--verbose: 7
+  rev--verbose: 6
+  rev--verbose: 5
+  rev--verbose: 4
+  rev--verbose: 3
+  rev--verbose: 2
+  rev--verbose: 1
+  rev--verbose: 0
+  rev--debug: 8
+  rev--debug: 7
+  rev--debug: 6
+  rev--debug: 5
+  rev--debug: 4
+  rev--debug: 3
+  rev--debug: 2
+  rev--debug: 1
+  rev--debug: 0
+  tags: tip
+  tags: 
+  tags: 
+  tags: 
+  tags: 
+  tags: 
+  tags: 
+  tags: 
+  tags: 
+  tags--verbose: tip
+  tags--verbose: 
+  tags--verbose: 
+  tags--verbose: 
+  tags--verbose: 
+  tags--verbose: 
+  tags--verbose: 
+  tags--verbose: 
+  tags--verbose: 
+  tags--debug: tip
+  tags--debug: 
+  tags--debug: 
+  tags--debug: 
+  tags--debug: 
+  tags--debug: 
+  tags--debug: 
+  tags--debug: 
+  tags--debug: 
+  diffstat: 3: +2/-1
+  diffstat: 1: +1/-0
+  diffstat: 0: +0/-0
+  diffstat: 1: +1/-0
+  diffstat: 0: +0/-0
+  diffstat: 1: +1/-0
+  diffstat: 1: +4/-0
+  diffstat: 1: +2/-0
+  diffstat: 1: +1/-0
+  diffstat--verbose: 3: +2/-1
+  diffstat--verbose: 1: +1/-0
+  diffstat--verbose: 0: +0/-0
+  diffstat--verbose: 1: +1/-0
+  diffstat--verbose: 0: +0/-0
+  diffstat--verbose: 1: +1/-0
+  diffstat--verbose: 1: +4/-0
+  diffstat--verbose: 1: +2/-0
+  diffstat--verbose: 1: +1/-0
+  diffstat--debug: 3: +2/-1
+  diffstat--debug: 1: +1/-0
+  diffstat--debug: 0: +0/-0
+  diffstat--debug: 1: +1/-0
+  diffstat--debug: 0: +0/-0
+  diffstat--debug: 1: +1/-0
+  diffstat--debug: 1: +4/-0
+  diffstat--debug: 1: +2/-0
+  diffstat--debug: 1: +1/-0
+  extras: branch=default
+  extras: branch=default
+  extras: branch=default
+  extras: branch=default
+  extras: branch=foo
+  extras: branch=default
+  extras: branch=default
+  extras: branch=default
+  extras: branch=default
+  extras--verbose: branch=default
+  extras--verbose: branch=default
+  extras--verbose: branch=default
+  extras--verbose: branch=default
+  extras--verbose: branch=foo
+  extras--verbose: branch=default
+  extras--verbose: branch=default
+  extras--verbose: branch=default
+  extras--verbose: branch=default
+  extras--debug: branch=default
+  extras--debug: branch=default
+  extras--debug: branch=default
+  extras--debug: branch=default
+  extras--debug: branch=foo
+  extras--debug: branch=default
+  extras--debug: branch=default
+  extras--debug: branch=default
+  extras--debug: branch=default
+
+
+Filters work:
+
+  $ hg log --template '{author|domain}\n'
+  
+  hostname
+  
+  
+  
+  
+  place
+  place
+  hostname
+
+  $ hg log --template '{author|person}\n'
+  test
+  User Name
+  person
+  person
+  person
+  person
+  other
+  A. N. Other
+  User Name
+
+  $ hg log --template '{author|user}\n'
+  test
+  user
+  person
+  person
+  person
+  person
+  other
+  other
+  user
+
+  $ hg log --template '{date|age}\n' > /dev/null || exit 1
+
+  $ hg log -l1 --template '{date|age}\n' 
+  in the future
+  $ hg log --template '{date|date}\n'
+  Wed Jan 01 10:01:00 2020 +0000
+  Mon Jan 12 13:46:40 1970 +0000
+  Sun Jan 18 08:40:01 1970 +0000
+  Sun Jan 18 08:40:00 1970 +0000
+  Sat Jan 17 04:53:20 1970 +0000
+  Fri Jan 16 01:06:40 1970 +0000
+  Wed Jan 14 21:20:00 1970 +0000
+  Tue Jan 13 17:33:20 1970 +0000
+  Mon Jan 12 13:46:40 1970 +0000
+
+  $ hg log --template '{date|isodate}\n'
+  2020-01-01 10:01 +0000
+  1970-01-12 13:46 +0000
+  1970-01-18 08:40 +0000
+  1970-01-18 08:40 +0000
+  1970-01-17 04:53 +0000
+  1970-01-16 01:06 +0000
+  1970-01-14 21:20 +0000
+  1970-01-13 17:33 +0000
+  1970-01-12 13:46 +0000
+
+  $ hg log --template '{date|isodatesec}\n'
+  2020-01-01 10:01:00 +0000
+  1970-01-12 13:46:40 +0000
+  1970-01-18 08:40:01 +0000
+  1970-01-18 08:40:00 +0000
+  1970-01-17 04:53:20 +0000
+  1970-01-16 01:06:40 +0000
+  1970-01-14 21:20:00 +0000
+  1970-01-13 17:33:20 +0000
+  1970-01-12 13:46:40 +0000
+
+  $ hg log --template '{date|rfc822date}\n'
+  Wed, 01 Jan 2020 10:01:00 +0000
+  Mon, 12 Jan 1970 13:46:40 +0000
+  Sun, 18 Jan 1970 08:40:01 +0000
+  Sun, 18 Jan 1970 08:40:00 +0000
+  Sat, 17 Jan 1970 04:53:20 +0000
+  Fri, 16 Jan 1970 01:06:40 +0000
+  Wed, 14 Jan 1970 21:20:00 +0000
+  Tue, 13 Jan 1970 17:33:20 +0000
+  Mon, 12 Jan 1970 13:46:40 +0000
+
+  $ hg log --template '{desc|firstline}\n'
+  third
+  second
+  merge
+  new head
+  new branch
+  no user, no domain
+  no person
+  other 1
+  line 1
+
+  $ hg log --template '{node|short}\n'
+  95c24699272e
+  29114dbae42b
+  c7b487c6c50e
+  13207e5a10d9
+  32a18f097fcc
+  10e46f2dcbf4
+  97054abb4ab8
+  b608e9d1a3f0
+  1e4e1b8f71e0
+
+  $ hg log --template '<changeset author="{author|xmlescape}"/>\n'
+  <changeset author="test"/>
+  <changeset author="User Name &lt;user@hostname&gt;"/>
+  <changeset author="person"/>
+  <changeset author="person"/>
+  <changeset author="person"/>
+  <changeset author="person"/>
+  <changeset author="other@place"/>
+  <changeset author="A. N. Other &lt;other@place&gt;"/>
+  <changeset author="User Name &lt;user@hostname&gt;"/>
+
+  $ hg log --template '{rev}: {children}\n'
+  8: 
+  7: 8:95c24699272e
+  6: 
+  5: 6:c7b487c6c50e
+  4: 6:c7b487c6c50e
+  3: 4:32a18f097fcc 5:13207e5a10d9
+  2: 3:10e46f2dcbf4
+  1: 2:97054abb4ab8
+  0: 1:b608e9d1a3f0
+
+Formatnode filter works:
+
+  $ hg -q log -r 0 --template '{node|formatnode}\n'
+  1e4e1b8f71e0
+
+  $ hg log -r 0 --template '{node|formatnode}\n'
+  1e4e1b8f71e0
+
+  $ hg -v log -r 0 --template '{node|formatnode}\n'
+  1e4e1b8f71e0
+
+  $ hg --debug log -r 0 --template '{node|formatnode}\n'
+  1e4e1b8f71e05681d422154f5421e385fec3454f
+
+Error on syntax:
+
+  $ echo 'x = "f' >> t
+  $ hg log
+  abort: t:3: unmatched quotes
+
+  $ cd ..
+
+
+latesttag:
+
+  $ hg init latesttag
+  $ cd latesttag
+
+  $ echo a > file
+  $ hg ci -Am a -d '0 0'
+  adding file
+
+  $ echo b >> file
+  $ hg ci -m b -d '1 0'
+
+  $ echo c >> head1
+  $ hg ci -Am h1c -d '2 0'
+  adding head1
+
+  $ hg update -q 1
+  $ echo d >> head2
+  $ hg ci -Am h2d -d '3 0'
+  adding head2
+  created new head
+
+  $ echo e >> head2
+  $ hg ci -m h2e -d '4 0'
+
+  $ hg merge -q
+  $ hg ci -m merge -d '5 0'
+
+No tag set:
+
+  $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
+  5: null+5
+  4: null+4
+  3: null+3
+  2: null+3
+  1: null+2
+  0: null+1
+
+One common tag: longuest path wins:
+
+  $ hg tag -r 1 -m t1 -d '6 0' t1
+  $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
+  6: t1+4
+  5: t1+3
+  4: t1+2
+  3: t1+1
+  2: t1+1
+  1: t1+0
+  0: null+1
+
+One ancestor tag: more recent wins:
+
+  $ hg tag -r 2 -m t2 -d '7 0' t2
+  $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
+  7: t2+3
+  6: t2+2
+  5: t2+1
+  4: t1+2
+  3: t1+1
+  2: t2+0
+  1: t1+0
+  0: null+1
+
+Two branch tags: more recent wins:
+
+  $ hg tag -r 3 -m t3 -d '8 0' t3
+  $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
+  8: t3+5
+  7: t3+4
+  6: t3+3
+  5: t3+2
+  4: t3+1
+  3: t3+0
+  2: t2+0
+  1: t1+0
+  0: null+1
+
+Merged tag overrides:
+
+  $ hg tag -r 5 -m t5 -d '9 0' t5
+  $ hg tag -r 3 -m at3 -d '10 0' at3
+  $ hg log --template '{rev}: {latesttag}+{latesttagdistance}\n'
+  10: t5+5
+  9: t5+4
+  8: t5+3
+  7: t5+2
+  6: t5+1
+  5: t5+0
+  4: at3:t3+1
+  3: at3:t3+0
+  2: t2+0
+  1: t1+0
+  0: null+1
+
+  $ cd ..
+
+
+Style path expansion (issue1948):
+
+  $ mkdir -p home/styles
+
+  $ cat > home/styles/teststyle <<EOF
+  > changeset = 'test {rev}:{node|short}\n'
+  > EOF
+
+  $ HOME=`pwd`/home; export HOME
+
+  $ cat > latesttag/.hg/hgrc <<EOF
+  > [ui]
+  > style = ~/styles/teststyle
+  > EOF
+
+  $ hg -R latesttag tip
+  test 10:dee8f28249af
+
+Test recursive showlist template (issue1989):
+
+  $ cat > style1989 <<EOF
+  > changeset = '{file_mods}{manifest}{extras}'
+  > file_mod  = 'M|{author|person}\n'
+  > manifest = '{rev},{author}\n'
+  > extra = '{key}: {author}\n'
+  > EOF
+
+  $ hg -R latesttag log -r tip --style=style1989
+  M|test
+  10,test
+  branch: test
+
--- a/tests/test-confused-revert	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#!/bin/sh
-
-hg init
-echo foo > a
-hg add a
-hg commit -m "1"
-
-echo bar > b
-hg add b
-hg remove a
-
-echo "%%% should show a removed and b added"
-hg status
-
-echo "reverting..."
-hg revert --all
-
-echo "%%% should show b unknown and a back to normal"
-hg status
-
-rm b
-
-hg co -C 0
-echo foo-a > a
-hg commit -m "2a"
-
-hg co -C 0
-echo foo-b > a
-hg commit -m "2b"
-
-HGMERGE=true hg merge 1
-
-echo "%%% should show foo-b"
-cat a
-
-echo bar > b
-hg add b
-rm a
-hg remove a
-
-echo "%%% should show a removed and b added"
-hg status
-
-echo "%%% revert should fail"
-hg revert --all
-
-echo "%%% revert should be ok now"
-hg revert -r2 --all
-
-echo "%%% should show b unknown and a marked modified (merged)"
-hg status
-
-echo "%%% should show foo-b"
-cat a
-
--- a/tests/test-confused-revert.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-%%% should show a removed and b added
-A b
-R a
-reverting...
-undeleting a
-forgetting b
-%%% should show b unknown and a back to normal
-? b
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-merging a
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-%%% should show foo-b
-foo-b
-%%% should show a removed and b added
-A b
-R a
-%%% revert should fail
-abort: uncommitted merge - please provide a specific revision
-%%% revert should be ok now
-undeleting a
-forgetting b
-%%% should show b unknown and a marked modified (merged)
-M a
-? b
-%%% should show foo-b
-foo-b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-confused-revert.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,80 @@
+  $ hg init
+  $ echo foo > a
+  $ hg add a
+  $ hg commit -m "1"
+
+  $ echo bar > b
+  $ hg add b
+  $ hg remove a
+
+Should show a removed and b added:
+
+  $ hg status
+  A b
+  R a
+
+  $ hg revert --all
+  undeleting a
+  forgetting b
+
+Should show b unknown and a back to normal:
+
+  $ hg status
+  ? b
+
+  $ rm b
+
+  $ hg co -C 0
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo foo-a > a
+  $ hg commit -m "2a"
+
+  $ hg co -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo foo-b > a
+  $ hg commit -m "2b"
+  created new head
+
+  $ HGMERGE=true hg merge 1
+  merging a
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+Should show foo-b:
+
+  $ cat a
+  foo-b
+
+  $ echo bar > b
+  $ hg add b
+  $ rm a
+  $ hg remove a
+
+Should show a removed and b added:
+
+  $ hg status
+  A b
+  R a
+
+Revert should fail:
+
+  $ hg revert --all
+  abort: uncommitted merge - please provide a specific revision
+
+Revert should be ok now:
+
+  $ hg revert -r2 --all
+  undeleting a
+  forgetting b
+
+Should show b unknown and a marked modified (merged):
+
+  $ hg status
+  M a
+  ? b
+
+Should show foo-b:
+
+  $ cat a
+  foo-b
+
--- a/tests/test-convert-darcs	Mon Sep 13 01:37:56 2010 +0000
+++ b/tests/test-convert-darcs	Tue Sep 14 16:21:01 2010 -0500
@@ -56,13 +56,18 @@
 rm dir/d2
 darcs mv dir dir2
 darcs record -a -l -m p3
-cd ..
+
+echo % test utf-8 commit message and author
+echo g > g
+# darcs is encoding agnostic, so it takes whatever bytes it's given
+darcs record -a -l -m 'p4: desc ñ' -A 'author ñ'
 
 glog()
 {
-    hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
+    HGENCODING=utf-8 hg glog --template '{rev} "{desc|firstline}" ({author}) files: {files}\n' "$@"
 }
 
+cd ..
 hg convert darcs-repo darcs-repo-hg
 # The converter does not currently handle patch conflicts very well.
 # When they occur, it reverts *all* changes and moves forward,
--- a/tests/test-convert-darcs.out	Mon Sep 13 01:37:56 2010 +0000
+++ b/tests/test-convert-darcs.out	Tue Sep 14 16:21:01 2010 -0500
@@ -12,26 +12,32 @@
 Finished recording patch 'p2'
 % test file and directory move
 Finished recording patch 'p3'
+% test utf-8 commit message and author
+Finished recording patch 'p4: desc ñ'
 initializing destination darcs-repo-hg repository
 scanning source...
 sorting...
 converting...
-4 p0
-3 p1.2
-2 p1.1
-1 p2
-0 p3
-o  4 "p3" files: dir/d dir/d2 dir2/d f ff
+5 p0
+4 p1.2
+3 p1.1
+2 p2
+1 p3
+0 p4: desc ?
+o  5 "p4: desc ñ" (author ñ) files: g
 |
-o  3 "p2" files: a dir/d dir/d2 f
+o  4 "p3" (test@example.org) files: dir/d dir/d2 dir2/d f ff
 |
-o  2 "p1.1" files:
+o  3 "p2" (test@example.org) files: a dir/d dir/d2 f
 |
-o  1 "p1.2" files: a b
+o  2 "p1.1" (test@example.org) files:
 |
-o  0 "p0" files: a
+o  1 "p1.2" (test@example.org) files: a b
+|
+o  0 "p0" (test@example.org) files: a
 
 7225b30cdf38257d5cc7780772c051b6f33e6d6b 644   a
 1e88685f5ddec574a34c70af492f95b6debc8741 644   b
 37406831adc447ec2385014019599dfec953c806 644   dir2/d
 b783a337463792a5c7d548ad85a7d3253c16ba8c 644   ff
+0973eb1b2ecc4de7fafe7447ce1b7462108b4848 644   g
--- a/tests/test-debugcomplete.t	Mon Sep 13 01:37:56 2010 +0000
+++ b/tests/test-debugcomplete.t	Tue Sep 14 16:21:01 2010 -0500
@@ -176,7 +176,7 @@
 
 Show all commands + options
   $ hg debugcommands
-  add: include, exclude, dry-run
+  add: include, exclude, subrepos, dry-run
   annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, include, exclude
   clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd
   commit: addremove, close-branch, include, exclude, message, logfile, date, user
@@ -227,10 +227,10 @@
   help: 
   identify: rev, num, id, branch, tags
   import: strip, base, force, no-commit, exact, import-branch, message, logfile, date, user, similarity
-  incoming: force, newest-first, bundle, rev, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd
+  incoming: force, newest-first, bundle, rev, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, subrepos
   locate: rev, print0, fullpath, include, exclude
   manifest: rev
-  outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd
+  outgoing: force, rev, newest-first, branch, patch, git, limit, no-merges, stat, style, template, ssh, remotecmd, subrepos
   parents: rev, style, template
   paths: 
   recover: 
--- a/tests/test-debugrename	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-hg init
-echo a > a
-hg ci -Am t
-
-hg mv a b
-hg ci -Am t1
-hg debugrename b
-
-hg mv b a
-hg ci -Am t2
-hg debugrename a
-
-echo % test with --rev
-hg debugrename --rev 1 b
-
--- a/tests/test-debugrename.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-adding a
-b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
-a renamed from b:37d9b5d994eab34eda9c16b195ace52c7b129980
-% test with --rev
-b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-debugrename.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,18 @@
+  $ hg init
+  $ echo a > a
+  $ hg ci -Am t
+  adding a
+
+  $ hg mv a b
+  $ hg ci -Am t1
+  $ hg debugrename b
+  b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
+
+  $ hg mv b a
+  $ hg ci -Am t2
+  $ hg debugrename a
+  a renamed from b:37d9b5d994eab34eda9c16b195ace52c7b129980
+
+  $ hg debugrename --rev 1 b
+  b renamed from a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
+
--- a/tests/test-default-push	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-hg init a
-echo a > a/a
-hg --cwd a ci -Ama
-
-hg clone a c
-
-hg clone a b
-echo b >> b/a
-hg --cwd b ci -mb
-
-echo % push should push to default when default-push not set
-hg --cwd b push | sed 's/pushing to.*/pushing/'
-
-echo % push should push to default-push when set
-echo 'default-push = ../c' >> b/.hg/hgrc
-hg --cwd b push | sed 's/pushing to.*/pushing/'
--- a/tests/test-default-push.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-adding a
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% push should push to default when default-push not set
-pushing
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-% push should push to default-push when set
-pushing
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-default-push.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,38 @@
+  $ hg init a
+
+  $ echo a > a/a
+  $ hg --cwd a ci -Ama
+  adding a
+
+  $ hg clone a c
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg clone a b
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ echo b >> b/a
+  $ hg --cwd b ci -mb
+
+Push should push to 'default' when 'default-push' not set:
+
+  $ hg --cwd b push
+  pushing to .*/a
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
+Push should push to 'default-push' when set:
+
+  $ echo 'default-push = ../c' >> b/.hg/hgrc
+  $ hg --cwd b push
+  pushing to .*/c
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-dirstate-race.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,33 @@
+  $ hg init
+  $ echo a > a
+  $ hg add a
+  $ hg commit -m test
+
+Do we ever miss a sub-second change?:
+
+  $ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
+  >     hg co -qC 0
+  >     echo b > a
+  >     hg st
+  > done
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+  M a
+
--- a/tests/test-help.t	Mon Sep 13 01:37:56 2010 +0000
+++ b/tests/test-help.t	Tue Sep 14 16:21:01 2010 -0500
@@ -274,6 +274,7 @@
   
    -I --include PATTERN [+]  include names matching the given patterns
    -X --exclude PATTERN [+]  exclude names matching the given patterns
+   -S --subrepos             recurse into subrepositories
    -n --dry-run              do not perform actions, just print output
   
   [+] marked option can be specified multiple times
@@ -312,6 +313,7 @@
   
    -I --include PATTERN [+]  include names matching the given patterns
    -X --exclude PATTERN [+]  exclude names matching the given patterns
+   -S --subrepos             recurse into subrepositories
    -n --dry-run              do not perform actions, just print output
   
   global options:
@@ -364,6 +366,7 @@
   
    -I --include PATTERN [+]  include names matching the given patterns
    -X --exclude PATTERN [+]  exclude names matching the given patterns
+   -S --subrepos             recurse into subrepositories
    -n --dry-run              do not perform actions, just print output
   
   [+] marked option can be specified multiple times
@@ -391,6 +394,7 @@
   
    -I --include PATTERN [+]  include names matching the given patterns
    -X --exclude PATTERN [+]  exclude names matching the given patterns
+   -S --subrepos             recurse into subrepositories
    -n --dry-run              do not perform actions, just print output
   
   [+] marked option can be specified multiple times
--- a/tests/test-manifest	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-# Source bundle was generated with the following script.
-#
-# hg init
-# echo a > a
-# ln -s a l
-# hg ci -Ama -d'0 0'
-# mkdir b
-# echo a > b/a
-# chmod +x b/a
-# hg ci -Amb -d'1 0'
-
-hg init
-hg -q pull "$TESTDIR/test-manifest.hg"
-
-echo % should be empty
-hg manifest
-
-hg co
-hg manifest
-hg manifest -v
-hg manifest --debug
-hg manifest -r 0
-hg manifest -r 1
-hg manifest -r tip
-
-echo % should fail
-hg manifest -r 2
-hg manifest -r tip tip
-
-hg manifest tip
--- a/tests/test-manifest-merging	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-echo % init foo-base
-hg init foo-base
-
-echo % create alpha in first repo
-cd foo-base
-echo 'alpha' > alpha
-hg ci -A -m 'add alpha' -d '1 0'
-cd ..
-
-echo % clone foo-base to foo-work
-hg clone foo-base foo-work
-
-echo % create beta in second repo
-cd foo-work
-echo 'beta' > beta
-hg ci -A -m 'add beta' -d '2 0'
-cd ..
-
-echo % create gamma in first repo
-cd foo-base
-echo 'gamma' > gamma
-hg ci -A -m 'add gamma' -d '3 0'
-cd ..
-
-echo % pull into work and merge
-cd foo-work
-hg pull -q
-hg merge
-
-echo % revert to changeset 1 to simulate a failed merge
-rm alpha beta gamma
-hg up -C 1
--- a/tests/test-manifest-merging.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-% init foo-base
-% create alpha in first repo
-adding alpha
-% clone foo-base to foo-work
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% create beta in second repo
-adding beta
-% create gamma in first repo
-adding gamma
-% pull into work and merge
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% revert to changeset 1 to simulate a failed merge
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-manifest-merging.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,36 @@
+  $ hg init base
+
+  $ cd base
+  $ echo 'alpha' > alpha
+  $ hg ci -A -m 'add alpha'
+  adding alpha
+  $ cd ..
+
+  $ hg clone base work
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd work
+  $ echo 'beta' > beta
+  $ hg ci -A -m 'add beta'
+  adding beta
+  $ cd ..
+
+  $ cd base
+  $ echo 'gamma' > gamma
+  $ hg ci -A -m 'add gamma'
+  adding gamma
+  $ cd ..
+
+  $ cd work
+  $ hg pull -q
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+Update --clean to revision 1 to simulate a failed merge:
+
+  $ rm alpha beta gamma
+  $ hg update --clean 1
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
--- a/tests/test-manifest.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-% should be empty
-3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-a
-b/a
-l
-644   a
-755 * b/a
-644 @ l
-b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644   a
-b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 755 * b/a
-047b75c6d7a3ef6a2243bd0e99f94f6ea6683597 644 @ l
-a
-l
-a
-b/a
-l
-a
-b/a
-l
-% should fail
-abort: unknown revision '2'!
-abort: please specify just one revision
-a
-b/a
-l
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-manifest.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,69 @@
+# Source bundle was generated with the following script.
+#
+# hg init
+# echo a > a
+# ln -s a l
+# hg ci -Ama -d'0 0'
+# mkdir b
+# echo a > b/a
+# chmod +x b/a
+# hg ci -Amb -d'1 0'
+
+  $ 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
+
+  $ hg manifest
+  a
+  b/a
+  l
+
+  $ hg manifest -v
+  644   a
+  755 * b/a
+  644 @ l
+
+  $ hg manifest --debug
+  b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644   a
+  b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 755 * b/a
+  047b75c6d7a3ef6a2243bd0e99f94f6ea6683597 644 @ l
+
+  $ hg manifest -r 0
+  a
+  l
+
+  $ hg manifest -r 1
+  a
+  b/a
+  l
+
+  $ hg manifest -r tip
+  a
+  b/a
+  l
+
+  $ hg manifest tip
+  a
+  b/a
+  l
+
+
+The next two calls are expected to abort:
+
+  $ hg manifest -r 2
+  abort: unknown revision '2'!
+
+  $ hg manifest -r tip tip
+  abort: please specify just one revision
+
+
+  $ true
+
--- a/tests/test-merge-commit	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-#!/bin/sh
-# 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
-hg init a
-cd a
-
-echo line1 > foo
-hg add foo
-hg ci -m '0: add foo'
-
-echo line2 >> foo
-hg ci -m '1: change foo'
-
-hg up -C 0
-hg mv foo bar
-rm bar
-echo line0 > bar
-echo line1 >> bar
-hg ci -m '2: mv foo bar; change bar'
-
-hg merge 1
-echo '% contents of bar should be line0 line1 line2'
-cat bar
-hg ci -m '3: merge with local rename'
-hg debugindex .hg/store/data/bar.i
-hg debugrename bar
-hg debugindex .hg/store/data/foo.i
-
-# revert the content change from rev 2
-hg up -C 2
-rm bar
-echo line1 > bar
-hg ci -m '4: revert content change from rev 2'
-
-hg log --template '{rev}:{node|short} {parents}\n'
-echo '% this should use bar@rev2 as the ancestor'
-hg --debug merge 3
-echo '% contents of bar should be line1 line2'
-cat bar
-hg ci -m '5: merge'
-hg debugindex .hg/store/data/bar.i
-
-
-# same thing, but with the merge on 3 having the rename on the remote parent
-echo
-echo
-cd ..
-hg clone -U -r 1 -r 2 a b
-cd b
-
-hg up -C 1
-hg merge 2
-echo '% contents of bar should be line0 line1 line2'
-cat bar
-hg ci -m '3: merge with remote rename'
-hg debugindex .hg/store/data/bar.i
-hg debugrename bar
-hg debugindex .hg/store/data/foo.i
-
-# revert the content change from rev 2
-hg up -C 2
-rm bar
-echo line1 > bar
-hg ci -m '4: revert content change from rev 2'
-
-hg log --template '{rev}:{node|short} {parents}\n'
-echo '% this should use bar@rev2 as the ancestor'
-hg --debug merge 3
-echo '% contents of bar should be line1 line2'
-cat bar
-hg ci -m '5: merge'
-hg debugindex .hg/store/data/bar.i
-
--- a/tests/test-merge-commit.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-merging bar and foo to bar
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% contents of bar should be line0 line1 line2
-line0
-line1
-line2
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0      77      0       2 d35118874825 000000000000 000000000000
-     1        77      76      0       3 5345f5ab8abd 000000000000 d35118874825
-bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0       7      0       0 690b295714ae 000000000000 000000000000
-     1         7      13      1       1 9e25c27b8757 690b295714ae 000000000000
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-4:2263c1be0967 2:0f2ff26688b9 
-3:0555950ead28 2:0f2ff26688b9 1:5cd961e4045d 
-2:0f2ff26688b9 0:2665aaee66e9 
-1:5cd961e4045d 
-0:2665aaee66e9 
-% this should use bar@rev2 as the ancestor
-  searching for copies back to rev 1
-resolving manifests
- overwrite None partial False
- ancestor 0f2ff26688b9 local 2263c1be0967+ remote 0555950ead28
- bar: versions differ -> m
-preserving bar for resolve of bar
-updating: bar 1/1 files (100.00%)
-picked tool 'internal:merge' for bar (binary False symlink False)
-merging bar
-my bar@2263c1be0967+ other bar@0555950ead28 ancestor bar@0f2ff26688b9
- premerge successful
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% contents of bar should be line1 line2
-line1
-line2
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0      77      0       2 d35118874825 000000000000 000000000000
-     1        77      76      0       3 5345f5ab8abd 000000000000 d35118874825
-     2       153       7      2       4 ff4b45017382 d35118874825 000000000000
-     3       160      13      3       5 3701b4893544 ff4b45017382 5345f5ab8abd
-
-
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 2 files (+1 heads)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-merging foo and bar to bar
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% contents of bar should be line0 line1 line2
-line0
-line1
-line2
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0      77      0       2 d35118874825 000000000000 000000000000
-     1        77      76      0       3 5345f5ab8abd 000000000000 d35118874825
-bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0       7      0       0 690b295714ae 000000000000 000000000000
-     1         7      13      1       1 9e25c27b8757 690b295714ae 000000000000
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-4:2263c1be0967 2:0f2ff26688b9 
-3:3ffa6b9e35f0 1:5cd961e4045d 2:0f2ff26688b9 
-2:0f2ff26688b9 0:2665aaee66e9 
-1:5cd961e4045d 
-0:2665aaee66e9 
-% this should use bar@rev2 as the ancestor
-  searching for copies back to rev 1
-resolving manifests
- overwrite None partial False
- ancestor 0f2ff26688b9 local 2263c1be0967+ remote 3ffa6b9e35f0
- bar: versions differ -> m
-preserving bar for resolve of bar
-updating: bar 1/1 files (100.00%)
-picked tool 'internal:merge' for bar (binary False symlink False)
-merging bar
-my bar@2263c1be0967+ other bar@3ffa6b9e35f0 ancestor bar@0f2ff26688b9
- premerge successful
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% contents of bar should be line1 line2
-line1
-line2
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0      77      0       2 d35118874825 000000000000 000000000000
-     1        77      76      0       3 5345f5ab8abd 000000000000 d35118874825
-     2       153       7      2       4 ff4b45017382 d35118874825 000000000000
-     3       160      13      3       5 3701b4893544 ff4b45017382 5345f5ab8abd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-commit.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,184 @@
+# 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
+
+  $ hg init a
+  $ cd a
+
+  $ echo line1 > foo
+  $ hg add foo
+  $ hg ci -m '0: add foo'
+
+  $ echo line2 >> foo
+  $ hg ci -m '1: change foo'
+
+  $ hg up -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg mv foo bar
+  $ rm bar
+  $ echo line0 > bar
+  $ echo line1 >> bar
+  $ hg ci -m '2: mv foo bar; change bar'
+  created new head
+
+  $ hg merge 1
+  merging bar and foo to bar
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ cat bar
+  line0
+  line1
+  line2
+
+  $ hg ci -m '3: merge with local rename'
+
+  $ hg debugindex .hg/store/data/bar.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0      77      0       2 d35118874825 000000000000 000000000000
+       1        77      76      0       3 5345f5ab8abd 000000000000 d35118874825
+
+  $ hg debugrename bar
+  bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
+
+  $ hg debugindex .hg/store/data/foo.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0       7      0       0 690b295714ae 000000000000 000000000000
+       1         7      13      1       1 9e25c27b8757 690b295714ae 000000000000
+
+
+Revert the content change from rev 2:
+
+  $ hg up -C 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm bar
+  $ echo line1 > bar
+  $ hg ci -m '4: revert content change from rev 2'
+  created new head
+
+  $ hg log --template '{rev}:{node|short} {parents}\n'
+  4:2263c1be0967 2:0f2ff26688b9 
+  3:0555950ead28 2:0f2ff26688b9 1:5cd961e4045d 
+  2:0f2ff26688b9 0:2665aaee66e9 
+  1:5cd961e4045d 
+  0:2665aaee66e9 
+
+This should use bar@rev2 as the ancestor:
+
+  $ hg --debug merge 3
+    searching for copies back to rev 1
+  resolving manifests
+   overwrite None partial False
+   ancestor 0f2ff26688b9 local 2263c1be0967+ remote 0555950ead28
+   bar: versions differ -> m
+  preserving bar for resolve of bar
+  updating: bar 1/1 files (100.00%)
+  picked tool 'internal:merge' for bar (binary False symlink False)
+  merging bar
+  my bar@2263c1be0967+ other bar@0555950ead28 ancestor bar@0f2ff26688b9
+   premerge successful
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ cat bar
+  line1
+  line2
+
+  $ hg ci -m '5: merge'
+
+  $ hg debugindex .hg/store/data/bar.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0      77      0       2 d35118874825 000000000000 000000000000
+       1        77      76      0       3 5345f5ab8abd 000000000000 d35118874825
+       2       153       7      2       4 ff4b45017382 d35118874825 000000000000
+       3       160      13      3       5 3701b4893544 ff4b45017382 5345f5ab8abd
+
+
+Same thing, but with the merge on 3 having the rename
+on the remote parent:
+
+  $ cd ..
+  $ hg clone -U -r 1 -r 2 a b
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 2 files (+1 heads)
+  $ cd b
+
+  $ hg up -C 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg merge 2
+  merging foo and bar to bar
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ cat bar
+  line0
+  line1
+  line2
+
+  $ hg ci -m '3: merge with remote rename'
+
+  $ hg debugindex .hg/store/data/bar.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0      77      0       2 d35118874825 000000000000 000000000000
+       1        77      76      0       3 5345f5ab8abd 000000000000 d35118874825
+
+  $ hg debugrename bar
+  bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
+
+  $ hg debugindex .hg/store/data/foo.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0       7      0       0 690b295714ae 000000000000 000000000000
+       1         7      13      1       1 9e25c27b8757 690b295714ae 000000000000
+
+
+Revert the content change from rev 2:
+
+  $ hg up -C 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm bar
+  $ echo line1 > bar
+  $ hg ci -m '4: revert content change from rev 2'
+  created new head
+
+  $ hg log --template '{rev}:{node|short} {parents}\n'
+  4:2263c1be0967 2:0f2ff26688b9 
+  3:3ffa6b9e35f0 1:5cd961e4045d 2:0f2ff26688b9 
+  2:0f2ff26688b9 0:2665aaee66e9 
+  1:5cd961e4045d 
+  0:2665aaee66e9 
+
+This should use bar@rev2 as the ancestor:
+
+  $ hg --debug merge 3
+    searching for copies back to rev 1
+  resolving manifests
+   overwrite None partial False
+   ancestor 0f2ff26688b9 local 2263c1be0967+ remote 3ffa6b9e35f0
+   bar: versions differ -> m
+  preserving bar for resolve of bar
+  updating: bar 1/1 files (100.00%)
+  picked tool 'internal:merge' for bar (binary False symlink False)
+  merging bar
+  my bar@2263c1be0967+ other bar@3ffa6b9e35f0 ancestor bar@0f2ff26688b9
+   premerge successful
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ cat bar
+  line1
+  line2
+
+  $ hg ci -m '5: merge'
+
+  $ hg debugindex .hg/store/data/bar.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0      77      0       2 d35118874825 000000000000 000000000000
+       1        77      76      0       3 5345f5ab8abd 000000000000 d35118874825
+       2       153       7      2       4 ff4b45017382 d35118874825 000000000000
+       3       160      13      3       5 3701b4893544 ff4b45017382 5345f5ab8abd
+
--- a/tests/test-merge-default	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-#!/bin/sh
-
-hg init
-echo a > a
-hg commit -A -ma
-
-echo b >> a
-hg commit -mb
-
-echo c >> a
-hg commit -mc
-
-hg up 1
-echo d >> a
-hg commit -md
-
-hg up 1
-echo e >> a
-hg commit -me
-
-hg up 1
-echo % should fail because not at a head
-hg merge
-
-hg up
-echo % should fail because \> 2 heads
-HGMERGE=internal:other; export HGMERGE
-hg merge
-
-echo % should succeed
-hg merge 2
-hg commit -mm1
-
-echo % should succeed - 2 heads
-hg merge -P
-hg merge
-hg commit -mm2
-
-echo % should fail because at tip
-hg merge
-
-hg up 0
-echo % should fail because 1 head
-hg merge
-
-hg up 3
-echo f >> a
-hg branch foobranch
-hg commit -mf
-echo % should fail because merge with other branch
-hg merge
-
-# Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that
-# are not ancestors of 7, regardless of where their least common
-# ancestor is.
-echo % merge preview not affected by common ancestor
-hg up -q 7
-hg merge -q -P 6         # expect: 2, 4, 5, 6
-
-true
--- a/tests/test-merge-default.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-adding a
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should fail because not at a head
-abort: branch 'default' has 3 heads - please merge with an explicit rev
-(run 'hg heads .' to see heads)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should fail because > 2 heads
-abort: branch 'default' has 3 heads - please merge with an explicit rev
-(run 'hg heads .' to see heads)
-% should succeed
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% should succeed - 2 heads
-changeset:   3:ea9ff125ff88
-parent:      1:1846eede8b68
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     d
-
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% should fail because at tip
-abort: there is nothing to merge
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should fail because 1 head
-abort: there is nothing to merge - use "hg update" instead
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch foobranch
-% should fail because merge with other branch
-abort: branch 'foobranch' has one head - please merge with an explicit rev
-(run 'hg heads' to see all heads)
-% merge preview not affected by common ancestor
-2:2d95304fed5d
-4:f25cbe84d8b3
-5:a431fabd6039
-6:e88e33f3bf62
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-default.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,104 @@
+  $ hg init
+  $ echo a > a
+  $ hg commit -A -ma
+  adding a
+
+  $ echo b >> a
+  $ hg commit -mb
+
+  $ echo c >> a
+  $ hg commit -mc
+
+  $ hg up 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo d >> a
+  $ hg commit -md
+  created new head
+
+  $ hg up 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo e >> a
+  $ hg commit -me
+  created new head
+
+  $ hg up 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Should fail because not at a head:
+
+  $ hg merge
+  abort: branch 'default' has 3 heads - please merge with an explicit rev
+  (run 'hg heads .' to see heads)
+
+  $ hg up
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Should fail because > 2 heads:
+
+  $ HGMERGE=internal:other; export HGMERGE
+  $ hg merge
+  abort: branch 'default' has 3 heads - please merge with an explicit rev
+  (run 'hg heads .' to see heads)
+
+Should succeed:
+
+  $ hg merge 2
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -mm1
+
+Should succeed - 2 heads:
+
+  $ hg merge -P
+  changeset:   3:ea9ff125ff88
+  parent:      1:1846eede8b68
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     d
+  
+  $ hg merge
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -mm2
+
+Should fail because at tip:
+
+  $ hg merge
+  abort: there is nothing to merge
+
+  $ hg up 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Should fail because there is only one head:
+
+  $ hg merge
+  abort: there is nothing to merge - use "hg update" instead
+
+  $ hg up 3
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ echo f >> a
+  $ hg branch foobranch
+  marked working directory as branch foobranch
+  $ hg commit -mf
+
+Should fail because merge with other branch:
+
+  $ hg merge
+  abort: branch 'foobranch' has one head - please merge with an explicit rev
+  (run 'hg heads' to see all heads)
+
+
+Test for issue2043: ensure that 'merge -P' shows ancestors of 6 that
+are not ancestors of 7, regardless of where their least common
+ancestor is.
+
+Merge preview not affected by common ancestor:
+
+  $ hg up -q 7
+  $ hg merge -q -P 6
+  2:2d95304fed5d
+  4:f25cbe84d8b3
+  5:a431fabd6039
+  6:e88e33f3bf62
+
--- a/tests/test-merge-force	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-hg init repo
-cd repo
-
-echo a > a
-hg ci -qAm 'add a'
-
-echo b > b
-hg ci -qAm 'add b'
-
-hg up -qC 0
-hg rm a
-hg ci -m 'rm a'
-
-hg up -qC 1
-rm a
-
-echo '% local deleted a file, remote removed'
-hg merge # should fail, since there are deleted files
-hg -v merge --force
-echo % should show a as removed
-hg st
-
-hg ci -m merge
-echo % manifest. should not have a:
-hg manifest
--- a/tests/test-merge-force.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-created new head
-% local deleted a file, remote removed
-abort: outstanding uncommitted changes (use 'hg status' to list changes)
-resolving manifests
-removing a
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% should show a as removed
-R a
-% manifest. should not have a:
-b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-force.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,43 @@
+  $ hg init
+
+  $ echo a > a
+  $ hg ci -qAm 'add a'
+
+  $ echo b > b
+  $ hg ci -qAm 'add b'
+
+  $ hg up -qC 0
+  $ hg rm a
+  $ hg ci -m 'rm a'
+  created new head
+
+  $ hg up -qC 1
+  $ rm a
+
+Local deleted a file, remote removed
+
+Should fail, since there are deleted files:
+
+  $ hg merge
+  abort: outstanding uncommitted changes (use 'hg status' to list changes)
+
+Should succeed with --force:
+
+  $ hg -v merge --force
+  resolving manifests
+  removing a
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+Should show 'a' as removed:
+
+  $ hg status
+  R a
+
+  $ hg ci -m merge
+
+Should not show 'a':
+
+  $ hg manifest
+  b
+
--- a/tests/test-merge-internal-tools-pattern	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-#!/bin/sh
-
-# make sure that the internal merge tools (internal:fail, internal:local, and
-# internal:other) are used when matched by a merge-pattern in hgrc
-
-unset HGMERGE # make sure HGMERGE doesn't interfere with the test
-
-hg init
-
-echo "# initial file contents"
-echo "line 1" > f
-echo "line 2" >> f
-echo "line 3" >> f
-hg commit -Am "revision 0"
-cat f
-echo "# branch 1: editing line 1"
-sed 's/line 1/first line/' f > f.new
-mv f.new f
-hg commit -Am "edited first line"
-
-echo "# branch 2: editing line 3"
-hg update 0
-sed 's/line 3/third line/' f > f.new
-mv f.new f
-hg commit -Am "edited third line"
-
-echo "# merge using internal:fail tool"
-echo "[merge-patterns]" > .hg/hgrc
-echo "* = internal:fail" >> .hg/hgrc
-hg merge
-cat f
-hg stat
-
-echo "# merge using internal:local tool"
-hg update -C 2
-sed 's/internal:fail/internal:local/' .hg/hgrc > .hg/hgrc.new
-mv .hg/hgrc.new .hg/hgrc
-hg merge
-cat f
-hg stat
-
-echo "# merge using internal:other tool"
-hg update -C 2
-sed 's/internal:local/internal:other/' .hg/hgrc > .hg/hgrc.new
-mv .hg/hgrc.new .hg/hgrc
-hg merge
-cat f
-hg stat
-
-echo "# merge using default tool"
-hg update -C 2
-rm .hg/hgrc
-hg merge
-cat f
-hg stat
-
--- a/tests/test-merge-internal-tools-pattern.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-# initial file contents
-adding f
-line 1
-line 2
-line 3
-# branch 1: editing line 1
-# branch 2: editing line 3
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-# merge using internal:fail tool
-0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
-line 1
-line 2
-third line
-M f
-# merge using internal:local tool
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-line 1
-line 2
-third line
-M f
-# merge using internal:other tool
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-first line
-line 2
-line 3
-M f
-# merge using default tool
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-merging f
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-first line
-line 2
-third line
-M f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-internal-tools-pattern.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,111 @@
+# 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:
+
+  $ unset HGMERGE
+
+  $ hg init
+
+Initial file contents:
+
+  $ echo "line 1" > f
+  $ echo "line 2" >> f
+  $ echo "line 3" >> f
+  $ hg ci -Am "revision 0"
+  adding f
+
+  $ cat f
+  line 1
+  line 2
+  line 3
+
+Branch 1: editing line 1:
+
+  $ sed 's/line 1/first line/' f > f.new
+  $ mv f.new f
+  $ hg ci -Am "edited first line"
+
+Branch 2: editing line 3:
+
+  $ hg update 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ sed 's/line 3/third line/' f > f.new
+  $ mv f.new f
+  $ hg ci -Am "edited third line"
+  created new head
+
+Merge using internal:fail tool:
+
+  $ echo "[merge-patterns]" > .hg/hgrc
+  $ echo "* = internal:fail" >> .hg/hgrc
+
+  $ hg merge
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
+
+  $ cat f
+  line 1
+  line 2
+  third line
+
+  $ hg stat
+  M f
+
+Merge using internal:local tool:
+
+  $ hg update -C 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ sed 's/internal:fail/internal:local/' .hg/hgrc > .hg/hgrc.new
+  $ mv .hg/hgrc.new .hg/hgrc
+
+  $ hg merge
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ cat f
+  line 1
+  line 2
+  third line
+
+  $ hg stat
+  M f
+
+Merge using internal:other tool:
+
+  $ hg update -C 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ sed 's/internal:local/internal:other/' .hg/hgrc > .hg/hgrc.new
+  $ mv .hg/hgrc.new .hg/hgrc
+
+  $ hg merge
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ cat f
+  first line
+  line 2
+  line 3
+
+  $ hg stat
+  M f
+
+Merge using default tool:
+
+  $ hg update -C 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm .hg/hgrc
+
+  $ hg merge
+  merging f
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ cat f
+  first line
+  line 2
+  third line
+
+  $ hg stat
+  M f
+
--- a/tests/test-merge-local	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-#!/bin/sh
-
-hg init
-
-echo "# revision 0"
-echo "unchanged" > unchanged
-echo "remove me" > remove
-echo "copy me" > copy
-echo "move me" > move
-for i in 1 2 3 4 5 6 7 8 9; do
-    echo "merge ok $i" >> zzz1_merge_ok
-done
-echo "merge bad" > zzz2_merge_bad
-hg ci -Am "revision 0"
-
-echo "# revision 1"
-hg rm remove
-hg mv move moved
-hg cp copy copied
-echo "added" > added
-hg add added
-echo "new first line" > zzz1_merge_ok
-hg cat zzz1_merge_ok >> zzz1_merge_ok
-echo "new last line" >> zzz2_merge_bad
-hg ci -m "revision 1"
-
-echo "# local changes to revision 0"
-hg co 0
-echo "new last line" >> zzz1_merge_ok
-echo "another last line" >> zzz2_merge_bad
-hg diff --nodates | grep "^[+-][^<>]"
-hg st
-
-echo "# local merge with bad merge tool"
-HGMERGE=false hg co
-hg co 0
-hg diff --nodates | grep "^[+-][^<>]"
-hg st
-
-echo "# local merge with conflicts"
-hg co
-hg co 0
-hg diff --nodates | grep "^[+-][^<>]"
-hg st
-
-echo "# local merge without conflicts"
-hg revert zzz2_merge_bad
-hg co
-hg diff --nodates | grep "^[+-][^<>]"
-hg st
--- a/tests/test-merge-local.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-# revision 0
-adding copy
-adding move
-adding remove
-adding unchanged
-adding zzz1_merge_ok
-adding zzz2_merge_bad
-# revision 1
-# local changes to revision 0
-4 files updated, 0 files merged, 3 files removed, 0 files unresolved
---- a/zzz1_merge_ok
-+++ b/zzz1_merge_ok
-+new last line
---- a/zzz2_merge_bad
-+++ b/zzz2_merge_bad
-+another last line
-M zzz1_merge_ok
-M zzz2_merge_bad
-# local merge with bad merge tool
-merging zzz1_merge_ok
-merging zzz2_merge_bad
-merging zzz2_merge_bad failed!
-3 files updated, 1 files merged, 2 files removed, 1 files unresolved
-use 'hg resolve' to retry unresolved file merges
-merging zzz1_merge_ok
-merging zzz2_merge_bad
-warning: conflicts during merge.
-merging zzz2_merge_bad failed!
-2 files updated, 1 files merged, 3 files removed, 1 files unresolved
-use 'hg resolve' to retry unresolved file merges
---- a/zzz1_merge_ok
-+++ b/zzz1_merge_ok
-+new last line
---- a/zzz2_merge_bad
-+++ b/zzz2_merge_bad
-+another last line
-+=======
-M zzz1_merge_ok
-M zzz2_merge_bad
-? zzz2_merge_bad.orig
-# local merge with conflicts
-merging zzz1_merge_ok
-merging zzz2_merge_bad
-warning: conflicts during merge.
-merging zzz2_merge_bad failed!
-3 files updated, 1 files merged, 2 files removed, 1 files unresolved
-use 'hg resolve' to retry unresolved file merges
-merging zzz1_merge_ok
-merging zzz2_merge_bad
-warning: conflicts during merge.
-merging zzz2_merge_bad failed!
-2 files updated, 1 files merged, 3 files removed, 1 files unresolved
-use 'hg resolve' to retry unresolved file merges
---- a/zzz1_merge_ok
-+++ b/zzz1_merge_ok
-+new last line
---- a/zzz2_merge_bad
-+++ b/zzz2_merge_bad
-+another last line
-+=======
-+=======
-+new last line
-+=======
-M zzz1_merge_ok
-M zzz2_merge_bad
-? zzz2_merge_bad.orig
-# local merge without conflicts
-merging zzz1_merge_ok
-4 files updated, 1 files merged, 2 files removed, 0 files unresolved
---- a/zzz1_merge_ok
-+++ b/zzz1_merge_ok
-+new last line
-M zzz1_merge_ok
-? zzz2_merge_bad.orig
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-local.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,134 @@
+  $ hg init
+
+Revision 0:
+
+  $ echo "unchanged" > unchanged
+  $ echo "remove me" > remove
+  $ echo "copy me" > copy
+  $ echo "move me" > move
+  $ for i in 1 2 3 4 5 6 7 8 9; do
+  >     echo "merge ok $i" >> zzz1_merge_ok
+  > done
+  $ echo "merge bad" > zzz2_merge_bad
+  $ hg ci -Am "revision 0"
+  adding copy
+  adding move
+  adding remove
+  adding unchanged
+  adding zzz1_merge_ok
+  adding zzz2_merge_bad
+
+Revision 1:
+
+  $ hg rm remove
+  $ hg mv move moved
+  $ hg cp copy copied
+  $ echo "added" > added
+  $ hg add added
+  $ echo "new first line" > zzz1_merge_ok
+  $ hg cat zzz1_merge_ok >> zzz1_merge_ok
+  $ echo "new last line" >> zzz2_merge_bad
+  $ hg ci -m "revision 1"
+
+Local changes to revision 0:
+
+  $ hg co 0
+  4 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ echo "new last line" >> zzz1_merge_ok
+  $ echo "another last line" >> zzz2_merge_bad
+
+  $ hg diff --nodates | grep "^[+-][^<>]"
+  --- a/zzz1_merge_ok
+  +++ b/zzz1_merge_ok
+  +new last line
+  --- a/zzz2_merge_bad
+  +++ b/zzz2_merge_bad
+  +another last line
+
+  $ hg st
+  M zzz1_merge_ok
+  M zzz2_merge_bad
+
+Local merge with bad merge tool:
+
+  $ HGMERGE=false hg co
+  merging zzz1_merge_ok
+  merging zzz2_merge_bad
+  merging zzz2_merge_bad failed!
+  3 files updated, 1 files merged, 2 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+
+  $ hg co 0
+  merging zzz1_merge_ok
+  merging zzz2_merge_bad
+  warning: conflicts during merge.
+  merging zzz2_merge_bad failed!
+  2 files updated, 1 files merged, 3 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+
+  $ hg diff --nodates | grep "^[+-][^<>]"
+  --- a/zzz1_merge_ok
+  +++ b/zzz1_merge_ok
+  +new last line
+  --- a/zzz2_merge_bad
+  +++ b/zzz2_merge_bad
+  +another last line
+  +=======
+
+  $ hg st
+  M zzz1_merge_ok
+  M zzz2_merge_bad
+  ? zzz2_merge_bad.orig
+
+Local merge with conflicts:
+
+  $ hg co
+  merging zzz1_merge_ok
+  merging zzz2_merge_bad
+  warning: conflicts during merge.
+  merging zzz2_merge_bad failed!
+  3 files updated, 1 files merged, 2 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+
+  $ hg co 0
+  merging zzz1_merge_ok
+  merging zzz2_merge_bad
+  warning: conflicts during merge.
+  merging zzz2_merge_bad failed!
+  2 files updated, 1 files merged, 3 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+
+  $ hg diff --nodates | grep "^[+-][^<>]"
+  --- a/zzz1_merge_ok
+  +++ b/zzz1_merge_ok
+  +new last line
+  --- a/zzz2_merge_bad
+  +++ b/zzz2_merge_bad
+  +another last line
+  +=======
+  +=======
+  +new last line
+  +=======
+
+  $ hg st
+  M zzz1_merge_ok
+  M zzz2_merge_bad
+  ? zzz2_merge_bad.orig
+
+Local merge without conflicts:
+
+  $ hg revert zzz2_merge_bad
+
+  $ hg co
+  merging zzz1_merge_ok
+  4 files updated, 1 files merged, 2 files removed, 0 files unresolved
+
+  $ hg diff --nodates | grep "^[+-][^<>]"
+  --- a/zzz1_merge_ok
+  +++ b/zzz1_merge_ok
+  +new last line
+
+  $ hg st
+  M zzz1_merge_ok
+  ? zzz2_merge_bad.orig
+
--- a/tests/test-merge-prompt	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#!/bin/sh
-#
-# Test for b5605d88dc27
-#  Make ui.prompt repeat on "unrecognized response" again (issue897)
-# and for 840e2b315c1f
-#  Fix misleading error and prompts during update/merge (issue556)
-
-status() {
-    [ $? -ne 0 ] && echo "failed."
-    echo "status:"
-    hg st -A file1 file2
-    for file in file1 file2; do
-        if [ -f $file ]; then
-            echo "$file:"
-            cat $file
-        else
-            echo "$file does not exist"
-        fi
-    done
-}
-
-hg init repo
-cd repo
-echo 1 > file1
-echo 2 > file2
-hg ci -Am 'added file1 and file2' # rev 0
-
-hg rm file1
-echo changed >> file2
-hg ci -m 'removed file1, changed file2' # rev 1
-
-hg co 0
-echo changed >> file1
-hg rm file2
-hg ci -m 'changed file1, removed file2' # rev 2
-
-echo
-echo "# non-interactive merge"
-hg merge -y || echo "failed"
-status
-
-echo
-echo "# interactive merge"
-hg co -C
-hg merge --config ui.interactive=true <<EOF || echo "failed"
-c
-d
-EOF
-status
-
-echo
-echo "# interactive merge with bad input"
-hg co -C
-hg merge --config ui.interactive=true <<EOF || echo "failed"
-foo
-bar
-d
-baz
-c
-EOF
-status
-
-echo
-echo "# interactive merge with not enough input"
-hg co -C
-hg merge --config ui.interactive=true <<EOF || echo "failed"
-d
-EOF
-status
--- a/tests/test-merge-prompt.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-adding file1
-adding file2
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-
-# non-interactive merge
- local changed file1 which remote deleted
-use (c)hanged version or (d)elete? c
-remote changed file2 which local deleted
-use (c)hanged version or leave (d)eleted? c
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-status:
-M file2
-C file1
-file1:
-1
-changed
-file2:
-2
-changed
-
-# interactive merge
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
- local changed file1 which remote deleted
-use (c)hanged version or (d)elete? remote changed file2 which local deleted
-use (c)hanged version or leave (d)eleted? 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-status:
-file2: No such file or directory
-C file1
-file1:
-1
-changed
-file2 does not exist
-
-# interactive merge with bad input
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
- local changed file1 which remote deleted
-use (c)hanged version or (d)elete? unrecognized response
- local changed file1 which remote deleted
-use (c)hanged version or (d)elete? unrecognized response
- local changed file1 which remote deleted
-use (c)hanged version or (d)elete? remote changed file2 which local deleted
-use (c)hanged version or leave (d)eleted? unrecognized response
-remote changed file2 which local deleted
-use (c)hanged version or leave (d)eleted? 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-status:
-M file2
-R file1
-file1 does not exist
-file2:
-2
-changed
-
-# interactive merge with not enough input
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
- local changed file1 which remote deleted
-use (c)hanged version or (d)elete? remote changed file2 which local deleted
-use (c)hanged version or leave (d)eleted? abort: response expected
-failed
-status:
-file2: No such file or directory
-C file1
-file1:
-1
-changed
-file2 does not exist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-prompt.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,144 @@
+# 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."
+  >     echo "--- status ---"
+  >     hg st -A file1 file2
+  >     for file in file1 file2; do
+  >         if [ -f $file ]; then
+  >             echo "--- $file ---"
+  >             cat $file
+  >         else
+  >             echo "*** $file does not exist"
+  >         fi
+  >     done
+  > }
+
+  $ hg init
+
+  $ echo 1 > file1
+  $ echo 2 > file2
+  $ hg ci -Am 'added file1 and file2'
+  adding file1
+  adding file2
+
+  $ hg rm file1
+  $ echo changed >> file2
+  $ hg ci -m 'removed file1, changed file2'
+
+  $ hg co 0
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ echo changed >> file1
+  $ hg rm file2
+  $ hg ci -m 'changed file1, removed file2'
+  created new head
+
+
+Non-interactive merge:
+
+  $ hg merge -y || echo "failed"
+   local changed file1 which remote deleted
+  use (c)hanged version or (d)elete? c
+  remote changed file2 which local deleted
+  use (c)hanged version or leave (d)eleted? c
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ status
+  --- status ---
+  M file2
+  C file1
+  --- file1 ---
+  1
+  changed
+  --- file2 ---
+  2
+  changed
+
+
+Interactive merge:
+
+  $ hg co -C
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg merge --config ui.interactive=true <<EOF || echo "failed"
+  > c
+  > d
+  > EOF
+   local changed file1 which remote deleted
+  use (c)hanged version or (d)elete? remote changed file2 which local deleted
+  use (c)hanged version or leave (d)eleted? 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ status
+  --- status ---
+  file2: No such file or directory
+  C file1
+  --- file1 ---
+  1
+  changed
+  *** file2 does not exist
+
+
+Interactive merge with bad input:
+
+  $ hg co -C
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg merge --config ui.interactive=true <<EOF || echo "failed"
+  > foo
+  > bar
+  > d
+  > baz
+  > c
+  > EOF
+   local changed file1 which remote deleted
+  use (c)hanged version or (d)elete? unrecognized response
+   local changed file1 which remote deleted
+  use (c)hanged version or (d)elete? unrecognized response
+   local changed file1 which remote deleted
+  use (c)hanged version or (d)elete? remote changed file2 which local deleted
+  use (c)hanged version or leave (d)eleted? unrecognized response
+  remote changed file2 which local deleted
+  use (c)hanged version or leave (d)eleted? 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ status
+  --- status ---
+  M file2
+  R file1
+  *** file1 does not exist
+  --- file2 ---
+  2
+  changed
+
+
+Interactive merge with not enough input:
+
+  $ hg co -C
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg merge --config ui.interactive=true <<EOF || echo "failed"
+  > d
+  > EOF
+   local changed file1 which remote deleted
+  use (c)hanged version or (d)elete? remote changed file2 which local deleted
+  use (c)hanged version or leave (d)eleted? abort: response expected
+  failed
+
+  $ status
+  --- status ---
+  file2: No such file or directory
+  C file1
+  --- file1 ---
+  1
+  changed
+  *** file2 does not exist
+
--- a/tests/test-merge-remove	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-#!/bin/sh
-
-hg init repo
-cd repo
-
-echo foo > foo
-echo bar > bar
-hg ci -qAm 'add foo bar'
-
-echo foo2 >> foo
-echo bleh > bar
-hg ci -m 'change foo bar'
-
-hg up -qC 0
-hg mv foo foo1
-echo foo1 > foo1
-hg cat foo >> foo1
-hg ci -m 'mv foo foo1'
-
-hg merge
-hg debugstate --nodates
-hg st -q
-
-echo '% removing foo1 and bar'
-cp foo1 F
-cp bar B
-hg rm -f foo1 bar
-hg debugstate --nodates
-hg st -qC
-
-echo '% readding foo1 and bar'
-cp F foo1
-cp B bar
-hg add -v foo1 bar
-hg debugstate --nodates
-hg st -qC
-
-echo '% reverting foo1 and bar'
-hg revert -vr . foo1 bar
-hg debugstate --nodates
-hg st -qC
-hg diff
-
--- a/tests/test-merge-remove.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-created new head
-merging foo1 and foo to foo1
-1 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-n   0         -2 bar
-m 644         14 foo1
-copy: foo -> foo1
-M bar
-M foo1
-% removing foo1 and bar
-r   0         -2 bar
-r   0         -1 foo1
-copy: foo -> foo1
-R bar
-R foo1
-% readding foo1 and bar
-adding bar
-adding foo1
-n   0         -2 bar
-m 644         14 foo1
-copy: foo -> foo1
-M bar
-M foo1
-  foo
-% reverting foo1 and bar
-saving current version of bar as bar.orig
-reverting bar
-saving current version of foo1 as foo1.orig
-reverting foo1
-n   0         -2 bar
-m 644         14 foo1
-copy: foo -> foo1
-M bar
-M foo1
-  foo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-remove.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,87 @@
+  $ hg init
+
+  $ echo foo > foo
+  $ echo bar > bar
+  $ hg ci -qAm 'add foo bar'
+
+  $ echo foo2 >> foo
+  $ echo bleh > bar
+  $ hg ci -m 'change foo bar'
+
+  $ hg up -qC 0
+  $ hg mv foo foo1
+  $ echo foo1 > foo1
+  $ hg cat foo >> foo1
+  $ hg ci -m 'mv foo foo1'
+  created new head
+
+  $ hg merge
+  merging foo1 and foo to foo1
+  1 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg debugstate --nodates
+  n   0         -2 bar
+  m 644         14 foo1
+  copy: foo -> foo1
+
+  $ hg st -q
+  M bar
+  M foo1
+
+
+Removing foo1 and bar:
+
+  $ cp foo1 F
+  $ cp bar B
+  $ hg rm -f foo1 bar
+
+  $ hg debugstate --nodates
+  r   0         -2 bar
+  r   0         -1 foo1
+  copy: foo -> foo1
+
+  $ hg st -qC
+  R bar
+  R foo1
+
+
+Re-adding foo1 and bar:
+
+  $ cp F foo1
+  $ cp B bar
+  $ hg add -v foo1 bar
+  adding bar
+  adding foo1
+
+  $ hg debugstate --nodates
+  n   0         -2 bar
+  m 644         14 foo1
+  copy: foo -> foo1
+
+  $ hg st -qC
+  M bar
+  M foo1
+    foo
+
+
+Reverting foo1 and bar:
+
+  $ hg revert -vr . foo1 bar
+  saving current version of bar as bar.orig
+  reverting bar
+  saving current version of foo1 as foo1.orig
+  reverting foo1
+
+  $ hg debugstate --nodates
+  n   0         -2 bar
+  m 644         14 foo1
+  copy: foo -> foo1
+
+  $ hg st -qC
+  M bar
+  M foo1
+    foo
+
+  $ hg diff
+
--- a/tests/test-merge-revert	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#!/bin/sh
-
-mkdir t
-cd t
-hg init
-echo "added file1" > file1
-echo "added file2" > file2
-hg add file1 file2
-hg commit -m "added file1 and file2"
-echo "changed file1" >> file1
-hg commit -m "changed file1"
-hg -q log
-hg id
-hg update -C 0
-hg id
-echo "changed file1" >> file1
-hg id
-hg revert --all
-hg diff
-hg status
-hg id
-hg update
-hg diff
-hg status
-hg id
-hg update -C 0
-echo "changed file1" >> file1
-hg update
-hg diff
-hg status
-hg id
-hg revert --all
-hg diff
-hg status
-hg id
-hg revert -r tip --all
-hg diff
-hg status
-hg id
-hg update -C
-hg diff
-hg status
-hg id
-
--- a/tests/test-merge-revert.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-1:08a16e8e4408
-0:d29c767a4b52
-08a16e8e4408 tip
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-d29c767a4b52
-d29c767a4b52+
-reverting file1
-? file1.orig
-d29c767a4b52
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-? file1.orig
-08a16e8e4408 tip
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-? file1.orig
-08a16e8e4408 tip
-? file1.orig
-08a16e8e4408 tip
-? file1.orig
-08a16e8e4408 tip
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-? file1.orig
-08a16e8e4408 tip
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-revert.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,74 @@
+  $ hg init
+
+  $ echo "added file1" > file1
+  $ echo "added file2" > file2
+  $ hg add file1 file2
+  $ hg commit -m "added file1 and file2"
+
+  $ echo "changed file1" >> file1
+  $ hg commit -m "changed file1"
+
+  $ hg -q log
+  1:08a16e8e4408
+  0:d29c767a4b52
+  $ hg id
+  08a16e8e4408 tip
+
+  $ hg update -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id
+  d29c767a4b52
+  $ echo "changed file1" >> file1
+  $ hg id
+  d29c767a4b52+
+
+  $ hg revert --all
+  reverting file1
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  d29c767a4b52
+
+  $ hg update
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  08a16e8e4408 tip
+
+  $ hg update -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo "changed file1" >> file1
+
+  $ hg update
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  08a16e8e4408 tip
+
+  $ hg revert --all
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  08a16e8e4408 tip
+
+  $ hg revert -r tip --all
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  08a16e8e4408 tip
+
+  $ hg update -C
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  08a16e8e4408 tip
+
--- a/tests/test-merge-revert2	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-mkdir t
-cd t
-hg init
-echo "added file1" > file1
-echo "another line of text" >> file1
-echo "added file2" > file2
-hg add file1 file2
-hg commit -m "added file1 and file2"
-echo "changed file1" >> file1
-hg commit -m "changed file1"
-hg -q log
-hg id
-hg update -C 0
-hg id
-echo "changed file1" >> file1
-hg id
-hg revert --no-backup --all
-hg diff
-hg status
-hg id
-hg update
-hg diff
-hg status
-hg id
-hg update -C 0
-echo "changed file1 different" >> file1
-hg update
-hg diff --nodates
-hg status
-hg id
-hg revert --no-backup --all
-hg diff
-hg status
-hg id
-hg revert -r tip --no-backup --all
-hg diff
-hg status
-hg id
-hg update -C
-hg diff
-hg status
-hg id
-
--- a/tests/test-merge-revert2.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-1:dfab7f3c2efb
-0:c3fa057dd86f
-dfab7f3c2efb tip
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-c3fa057dd86f
-c3fa057dd86f+
-reverting file1
-c3fa057dd86f
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-dfab7f3c2efb tip
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-merging file1
-warning: conflicts during merge.
-merging file1 failed!
-0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-use 'hg resolve' to retry unresolved file merges
-diff -r dfab7f3c2efb file1
---- a/file1
-+++ b/file1
-@@ -1,3 +1,7 @@
- added file1
- another line of text
-+<<<<<<< local
-+changed file1 different
-+=======
- changed file1
-+>>>>>>> other
-M file1
-? file1.orig
-dfab7f3c2efb+ tip
-reverting file1
-? file1.orig
-dfab7f3c2efb tip
-? file1.orig
-dfab7f3c2efb tip
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-? file1.orig
-dfab7f3c2efb tip
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-revert2.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,93 @@
+  $ hg init
+
+  $ echo "added file1" > file1
+  $ echo "another line of text" >> file1
+  $ echo "added file2" > file2
+  $ hg add file1 file2
+  $ hg commit -m "added file1 and file2"
+
+  $ echo "changed file1" >> file1
+  $ hg commit -m "changed file1"
+
+  $ hg -q log
+  1:dfab7f3c2efb
+  0:c3fa057dd86f
+  $ hg id
+  dfab7f3c2efb tip
+
+  $ hg update -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg id
+  c3fa057dd86f
+
+  $ echo "changed file1" >> file1
+  $ hg id
+  c3fa057dd86f+
+
+  $ hg revert --no-backup --all
+  reverting file1
+  $ hg diff
+  $ hg status
+  $ hg id
+  c3fa057dd86f
+
+  $ hg update
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg diff
+  $ hg status
+  $ hg id
+  dfab7f3c2efb tip
+
+  $ hg update -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo "changed file1 different" >> file1
+
+  $ hg update
+  merging file1
+  warning: conflicts during merge.
+  merging file1 failed!
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges
+
+  $ hg diff --nodates
+  diff -r dfab7f3c2efb file1
+  --- a/file1
+  +++ b/file1
+  @@ -1,3 +1,7 @@
+   added file1
+   another line of text
+  +<<<<<<< local
+  +changed file1 different
+  +=======
+   changed file1
+  +>>>>>>> other
+
+  $ hg status
+  M file1
+  ? file1.orig
+  $ hg id
+  dfab7f3c2efb+ tip
+
+  $ hg revert --no-backup --all
+  reverting file1
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  dfab7f3c2efb tip
+
+  $ hg revert -r tip --no-backup --all
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  dfab7f3c2efb tip
+
+  $ hg update -C
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg diff
+  $ hg status
+  ? file1.orig
+  $ hg id
+  dfab7f3c2efb tip
+
--- a/tests/test-merge-types	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-hg init
-echo a > a
-hg ci -Amadd       # 0
-
-chmod +x a
-hg ci -mexecutable # 1
-
-hg up 0
-rm a
-ln -s symlink a
-hg ci -msymlink    # 2
-hg merge --debug
-
-echo % symlink is local parent, executable is other
-
-if [ -h a ]; then
-    echo a is a symlink
-    $TESTDIR/readlink.py a
-elif [ -x a ]; then
-    echo a is executable
-else
-    echo "a has no flags (default for conflicts)"
-fi
-
-hg update -C 1
-hg merge --debug
-
-echo % symlink is other parent, executable is local
-
-if [ -h a ]; then
-    echo a is a symlink
-    $TESTDIR/readlink.py a
-elif [ -x a ]; then
-    echo a is executable
-else
-    echo "a has no flags (default for conflicts)"
-fi
--- a/tests/test-merge-types.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-adding a
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-  searching for copies back to rev 1
-resolving manifests
- overwrite None partial False
- ancestor c334dc3be0da local 521a1e40188f+ remote 3574f3e69b1c
- conflicting flags for a
-(n)one, e(x)ec or sym(l)ink? n
- a: update permissions -> e
-updating: a 1/1 files (100.00%)
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% symlink is local parent, executable is other
-a has no flags (default for conflicts)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  searching for copies back to rev 1
-resolving manifests
- overwrite None partial False
- ancestor c334dc3be0da local 3574f3e69b1c+ remote 521a1e40188f
- conflicting flags for a
-(n)one, e(x)ec or sym(l)ink? n
- a: remote is newer -> g
-updating: a 1/1 files (100.00%)
-getting a
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% symlink is other parent, executable is local
-a has no flags (default for conflicts)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge-types.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,70 @@
+  $ hg init
+
+  $ echo a > a
+  $ hg ci -Amadd
+  adding a
+
+  $ chmod +x a
+  $ hg ci -mexecutable
+
+  $ hg up 0
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm a
+  $ ln -s symlink a
+  $ hg ci -msymlink
+  created new head
+
+  $ hg merge --debug
+    searching for copies back to rev 1
+  resolving manifests
+   overwrite None partial False
+   ancestor c334dc3be0da local 521a1e40188f+ remote 3574f3e69b1c
+   conflicting flags for a
+  (n)one, e(x)ec or sym(l)ink? n
+   a: update permissions -> e
+  updating: a 1/1 files (100.00%)
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+
+Symlink is local parent, executable is other:
+
+  $ if [ -h a ]; then
+  >     echo a is a symlink
+  >     $TESTDIR/readlink.py a
+  > elif [ -x a ]; then
+  >     echo a is executable
+  > else
+  >     echo "a has no flags (default for conflicts)"
+  > fi
+  a has no flags (default for conflicts)
+
+  $ hg update -C 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg merge --debug
+    searching for copies back to rev 1
+  resolving manifests
+   overwrite None partial False
+   ancestor c334dc3be0da local 3574f3e69b1c+ remote 521a1e40188f
+   conflicting flags for a
+  (n)one, e(x)ec or sym(l)ink? n
+   a: remote is newer -> g
+  updating: a 1/1 files (100.00%)
+  getting a
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+
+Symlink is other parent, executable is local:
+
+  $ if [ -h a ]; then
+  >    echo a is a symlink
+  >    $TESTDIR/readlink.py a
+  > elif [ -x a ]; then
+  >     echo a is executable
+  > else
+  >     echo "a has no flags (default for conflicts)"
+  > fi
+  a has no flags (default for conflicts)
+
--- a/tests/test-nested-repo	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-hg init a
-cd a
-hg init b
-echo x > b/x
-
-echo '# should print nothing'
-hg add b
-hg st
-
-echo '# should fail'
-hg st b/x
-hg add b/x
-
-echo '# should fail'
-hg add b b/x
-hg st
-
-echo '# should arguably print nothing'
-hg st b
-
-echo a > a
-hg ci -Ama a
-
-echo '# should fail'
-hg mv a b
-hg st
--- a/tests/test-nested-repo.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-# should print nothing
-# should fail
-abort: path 'b/x' is inside repo 'b'
-abort: path 'b/x' is inside repo 'b'
-# should fail
-abort: path 'b/x' is inside repo 'b'
-# should arguably print nothing
-# should fail
-abort: path 'b/a' is inside repo 'b'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-nested-repo.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,36 @@
+  $ hg init a
+  $ cd a
+  $ hg init b
+  $ echo x > b/x
+
+Should print nothing:
+
+  $ hg add b
+  $ hg st
+
+Should fail:
+
+  $ hg st b/x
+  abort: path 'b/x' is inside repo 'b'
+  $ hg add b/x
+  abort: path 'b/x' is inside repo 'b'
+
+Should fail:
+
+  $ hg add b b/x
+  abort: path 'b/x' is inside repo 'b'
+  $ hg st
+
+Should arguably print nothing:
+
+  $ hg st b
+
+  $ echo a > a
+  $ hg ci -Ama a
+
+Should fail:
+
+  $ hg mv a b
+  abort: path 'b/a' is inside repo 'b'
+  $ hg st
+
--- a/tests/test-newbranch	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-#!/bin/sh
-
-branchcache=.hg/branchheads.cache
-
-hg init t
-cd t
-hg branches
-
-echo foo > a
-hg add a
-hg ci -m "initial"
-hg branch foo
-hg branch
-hg ci -m "add branch name"
-hg branch bar
-hg ci -m "change branch name"
-echo % branch shadowing
-hg branch default
-hg branch -f default
-hg ci -m "clear branch name"
-
-echo % there should be only one default branch head
-hg heads .
-
-hg co foo
-hg branch
-echo bleah > a
-hg ci -m "modify a branch"
-
-hg merge default
-hg branch
-hg ci -m "merge"
-hg log
-
-hg branches
-hg branches -q
-
-echo % test for invalid branch cache
-hg rollback
-cp $branchcache .hg/bc-invalid
-hg log -r foo
-cp .hg/bc-invalid $branchcache
-hg --debug log -r foo
-rm $branchcache
-echo corrupted > $branchcache
-hg log -qr foo
-cat $branchcache
-
-echo % push should update the branch cache
-hg init ../target
-echo % pushing just rev 0
-hg push -qr 0 ../target
-cat ../target/$branchcache
-echo % pushing everything
-hg push -qf ../target
-cat ../target/$branchcache
-
-echo % update with no arguments: tipmost revision of the current branch
-hg up -q -C 0
-hg up -q
-hg id
-hg up -q 1
-hg up -q
-hg id
-hg branch foobar
-hg up
-
-echo % fastforward merge
-hg branch ff
-echo ff > ff
-hg ci -Am'fast forward'
-hg up foo
-hg merge ff
-hg branch
-hg commit -m'Merge ff into foo'
-hg parents
-hg manifest
-
-echo % test merging, add 3 default heads and one test head
-cd ..
-hg init merges
-cd merges
-echo a > a
-hg ci -Ama
-
-echo b > b
-hg ci -Amb
-
-hg up 0
-echo c > c
-hg ci -Amc
-
-hg up 0
-echo d > d
-hg ci -Amd
-
-hg up 0
-hg branch test
-echo e >> e
-hg ci -Ame
-
-hg log
-
-echo % implicit merge with test branch as parent
-hg merge
-hg up -C default
-echo % implicit merge with default branch as parent
-hg merge
-echo % 3 branch heads, explicit merge required
-hg merge 2
-hg ci -m merge
-echo % 2 branch heads, implicit merge works
-hg merge
--- a/tests/test-newbranch.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-marked working directory as branch foo
-foo
-marked working directory as branch bar
-% branch shadowing
-abort: a branch of the same name already exists (use 'hg update' to switch to it)
-marked working directory as branch default
-created new head
-% there should be only one default branch head
-changeset:   3:9d567d0b51f9
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     clear branch name
-
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-foo
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-foo
-changeset:   5:dc140083783b
-branch:      foo
-tag:         tip
-parent:      4:98d14f698afe
-parent:      3:9d567d0b51f9
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     merge
-
-changeset:   4:98d14f698afe
-branch:      foo
-parent:      1:0079f24813e2
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     modify a branch
-
-changeset:   3:9d567d0b51f9
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     clear branch name
-
-changeset:   2:ed2bbf4e0102
-branch:      bar
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     change branch name
-
-changeset:   1:0079f24813e2
-branch:      foo
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     add branch name
-
-changeset:   0:db01e8ea3388
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     initial
-
-foo                            5:dc140083783b
-default                        3:9d567d0b51f9 (inactive)
-bar                            2:ed2bbf4e0102 (inactive)
-foo
-default
-bar
-% test for invalid branch cache
-rolling back to revision 4 (undo commit)
-changeset:   4:98d14f698afe
-branch:      foo
-tag:         tip
-parent:      1:0079f24813e2
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     modify a branch
-
-invalidating branch cache (tip differs)
-changeset:   4:98d14f698afeaff8cb612dcf215ce95e639effc3
-branch:      foo
-tag:         tip
-parent:      1:0079f24813e2b73a891577c243684c5066347bc8
-parent:      -1:0000000000000000000000000000000000000000
-manifest:    4:d01b250baaa05909152f7ae07d7a649deea0df9a
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-files:       a
-extra:       branch=foo
-description:
-modify a branch
-
-
-4:98d14f698afe
-98d14f698afeaff8cb612dcf215ce95e639effc3 4
-9d567d0b51f9e2068b054e1948e1a927f99b5874 default
-98d14f698afeaff8cb612dcf215ce95e639effc3 foo
-ed2bbf4e01029020711be82ca905283e883f0e11 bar
-% push should update the branch cache
-% pushing just rev 0
-db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0
-db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default
-% pushing everything
-98d14f698afeaff8cb612dcf215ce95e639effc3 4
-9d567d0b51f9e2068b054e1948e1a927f99b5874 default
-98d14f698afeaff8cb612dcf215ce95e639effc3 foo
-ed2bbf4e01029020711be82ca905283e883f0e11 bar
-% update with no arguments: tipmost revision of the current branch
-9d567d0b51f9
-98d14f698afe (foo) tip
-marked working directory as branch foobar
-abort: branch foobar not found
-% fastforward merge
-marked working directory as branch ff
-adding ff
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-foo
-changeset:   6:917eb54e1b4b
-branch:      foo
-tag:         tip
-parent:      4:98d14f698afe
-parent:      5:6683a60370cb
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     Merge ff into foo
-
-a
-ff
-% test merging, add 3 default heads and one test head
-adding a
-adding b
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding c
-created new head
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding d
-created new head
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch test
-adding e
-changeset:   4:3a1e01ed1df4
-branch:      test
-tag:         tip
-parent:      0:cb9a9f314b8b
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     e
-
-changeset:   3:980f7dc84c29
-parent:      0:cb9a9f314b8b
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     d
-
-changeset:   2:d36c0562f908
-parent:      0:cb9a9f314b8b
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     c
-
-changeset:   1:d2ae7f538514
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     b
-
-changeset:   0:cb9a9f314b8b
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     a
-
-% implicit merge with test branch as parent
-abort: branch 'test' has one head - please merge with an explicit rev
-(run 'hg heads' to see all heads)
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-% implicit merge with default branch as parent
-abort: branch 'default' has 3 heads - please merge with an explicit rev
-(run 'hg heads .' to see heads)
-% 3 branch heads, explicit merge required
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% 2 branch heads, implicit merge works
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-newbranch.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,316 @@
+  $ branchcache=.hg/branchheads.cache
+
+  $ hg init t
+  $ cd t
+
+  $ hg branches
+  $ echo foo > a
+  $ hg add a
+  $ hg ci -m "initial"
+  $ hg branch foo
+  marked working directory as branch foo
+  $ hg branch
+  foo
+  $ hg ci -m "add branch name"
+  $ hg branch bar
+  marked working directory as branch bar
+  $ hg ci -m "change branch name"
+
+Branch shadowing:
+
+  $ hg branch default
+  abort: a branch of the same name already exists (use 'hg update' to switch to it)
+
+  $ hg branch -f default
+  marked working directory as branch default
+
+  $ hg ci -m "clear branch name"
+  created new head
+
+There should be only one default branch head
+
+  $ hg heads .
+  changeset:   3:9d567d0b51f9
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     clear branch name
+  
+
+  $ hg co foo
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch
+  foo
+  $ echo bleah > a
+  $ hg ci -m "modify a branch"
+
+  $ hg merge default
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg branch
+  foo
+  $ hg ci -m "merge"
+
+  $ hg log
+  changeset:   5:dc140083783b
+  branch:      foo
+  tag:         tip
+  parent:      4:98d14f698afe
+  parent:      3:9d567d0b51f9
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     merge
+  
+  changeset:   4:98d14f698afe
+  branch:      foo
+  parent:      1:0079f24813e2
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     modify a branch
+  
+  changeset:   3:9d567d0b51f9
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     clear branch name
+  
+  changeset:   2:ed2bbf4e0102
+  branch:      bar
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     change branch name
+  
+  changeset:   1:0079f24813e2
+  branch:      foo
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add branch name
+  
+  changeset:   0:db01e8ea3388
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     initial
+  
+  $ hg branches
+  foo                            5:dc140083783b
+  default                        3:9d567d0b51f9 (inactive)
+  bar                            2:ed2bbf4e0102 (inactive)
+
+  $ hg branches -q
+  foo
+  default
+  bar
+
+Test for invalid branch cache:
+
+  $ hg rollback
+  rolling back to revision 4 (undo commit)
+
+  $ cp $branchcache .hg/bc-invalid
+
+  $ hg log -r foo
+  changeset:   4:98d14f698afe
+  branch:      foo
+  tag:         tip
+  parent:      1:0079f24813e2
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     modify a branch
+  
+  $ cp .hg/bc-invalid $branchcache
+
+  $ hg --debug log -r foo
+  invalidating branch cache (tip differs)
+  changeset:   4:98d14f698afeaff8cb612dcf215ce95e639effc3
+  branch:      foo
+  tag:         tip
+  parent:      1:0079f24813e2b73a891577c243684c5066347bc8
+  parent:      -1:0000000000000000000000000000000000000000
+  manifest:    4:d01b250baaa05909152f7ae07d7a649deea0df9a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  files:       a
+  extra:       branch=foo
+  description:
+  modify a branch
+  
+  
+  $ rm $branchcache
+  $ echo corrupted > $branchcache
+
+  $ hg log -qr foo
+  4:98d14f698afe
+
+  $ cat $branchcache
+  98d14f698afeaff8cb612dcf215ce95e639effc3 4
+  9d567d0b51f9e2068b054e1948e1a927f99b5874 default
+  98d14f698afeaff8cb612dcf215ce95e639effc3 foo
+  ed2bbf4e01029020711be82ca905283e883f0e11 bar
+
+Push should update the branch cache:
+
+  $ hg init ../target
+
+Pushing just rev 0:
+
+  $ hg push -qr 0 ../target
+
+  $ cat ../target/$branchcache
+  db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0
+  db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default
+
+Pushing everything:
+
+  $ hg push -qf ../target
+
+  $ cat ../target/$branchcache
+  98d14f698afeaff8cb612dcf215ce95e639effc3 4
+  9d567d0b51f9e2068b054e1948e1a927f99b5874 default
+  98d14f698afeaff8cb612dcf215ce95e639effc3 foo
+  ed2bbf4e01029020711be82ca905283e883f0e11 bar
+
+Update with no arguments: tipmost revision of the current branch:
+
+  $ hg up -q -C 0
+  $ hg up -q
+  $ hg id
+  9d567d0b51f9
+
+  $ hg up -q 1
+  $ hg up -q
+  $ hg id
+  98d14f698afe (foo) tip
+
+  $ hg branch foobar
+  marked working directory as branch foobar
+
+  $ hg up
+  abort: branch foobar not found
+
+Fastforward merge:
+
+  $ hg branch ff
+  marked working directory as branch ff
+
+  $ echo ff > ff
+  $ hg ci -Am'fast forward'
+  adding ff
+
+  $ hg up foo
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+  $ hg merge ff
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg branch
+  foo
+  $ hg commit -m'Merge ff into foo'
+  $ hg parents
+  changeset:   6:917eb54e1b4b
+  branch:      foo
+  tag:         tip
+  parent:      4:98d14f698afe
+  parent:      5:6683a60370cb
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Merge ff into foo
+  
+  $ hg manifest
+  a
+  ff
+
+
+Test merging, add 3 default heads and one test head:
+
+  $ cd ..
+  $ hg init merges
+  $ cd merges
+  $ echo a > a
+  $ hg ci -Ama
+  adding a
+
+  $ echo b > b
+  $ hg ci -Amb
+  adding b
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo c > c
+  $ hg ci -Amc
+  adding c
+  created new head
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d
+  $ hg ci -Amd
+  adding d
+  created new head
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch test
+  marked working directory as branch test
+  $ echo e >> e
+  $ hg ci -Ame
+  adding e
+
+  $ hg log
+  changeset:   4:3a1e01ed1df4
+  branch:      test
+  tag:         tip
+  parent:      0:cb9a9f314b8b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     e
+  
+  changeset:   3:980f7dc84c29
+  parent:      0:cb9a9f314b8b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     d
+  
+  changeset:   2:d36c0562f908
+  parent:      0:cb9a9f314b8b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     c
+  
+  changeset:   1:d2ae7f538514
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     b
+  
+  changeset:   0:cb9a9f314b8b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a
+  
+Implicit merge with test branch as parent:
+
+  $ hg merge
+  abort: branch 'test' has one head - please merge with an explicit rev
+  (run 'hg heads' to see all heads)
+  $ hg up -C default
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+Implicit merge with default branch as parent:
+
+  $ hg merge
+  abort: branch 'default' has 3 heads - please merge with an explicit rev
+  (run 'hg heads .' to see heads)
+
+3 branch heads, explicit merge required:
+
+  $ hg merge 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m merge
+
+2 branch heads, implicit merge works:
+
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
--- a/tests/test-permissions	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#!/bin/sh
-
-echo '% hg init t'
-hg init t
-cd t
-echo foo > a
-echo '% hg add a'
-hg add a
-echo '% hg commit'
-hg commit -m "1"
-echo '% hg verify'
-hg verify
-chmod -r .hg/store/data/a.i
-echo '% hg verify'
-hg verify 2>/dev/null || echo verify failed
-chmod +r .hg/store/data/a.i
-echo '% hg verify'
-hg verify 2>/dev/null || echo verify failed
-chmod -w .hg/store/data/a.i
-echo barber > a
-echo '% hg commit'
-hg commit -m "2" 2>/dev/null || echo commit failed
-chmod -w .
-echo '% hg diff'
-hg diff --nodates
-chmod +w .
-
-chmod +w .hg/store/data/a.i
-mkdir dir
-touch dir/a
-echo '% hg status'
-hg status
-chmod -rx dir
-echo '% hg status'
-hg status
-# reenable perm to allow deletion
-chmod +rx dir
--- a/tests/test-permissions.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-% hg init t
-% hg add a
-% hg commit
-% hg verify
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
-% hg verify
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-verify failed
-% hg verify
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
-% hg commit
-commit failed
-% hg diff
-diff -r 2a18120dc1c9 a
---- a/a
-+++ b/a
-@@ -1,1 +1,1 @@
--foo
-+barber
-% hg status
-M a
-? dir/a
-% hg status
-dir: Permission denied
-M a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-permissions.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,69 @@
+  $ hg init t
+  $ cd t
+
+  $ echo foo > a
+  $ hg add a
+
+  $ hg commit -m "1"
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+
+  $ chmod -r .hg/store/data/a.i
+
+  $ hg verify || echo %%% verify failed
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  abort: Permission denied: .*
+  %%% verify failed
+
+  $ chmod +r .hg/store/data/a.i
+
+  $ hg verify || echo %%% verify failed
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+
+  $ chmod -w .hg/store/data/a.i
+
+  $ echo barber > a
+  $ hg commit -m "2" || echo %%% commit failed
+  trouble committing a!
+  abort: Permission denied: .*
+  %%% commit failed
+
+  $ chmod -w .
+
+  $ hg diff --nodates
+  diff -r 2a18120dc1c9 a
+  --- a/a
+  +++ b/a
+  @@ -1,1 +1,1 @@
+  -foo
+  +barber
+
+  $ chmod +w .
+
+  $ chmod +w .hg/store/data/a.i
+  $ mkdir dir
+  $ touch dir/a
+  $ hg status
+  M a
+  ? dir/a
+  $ chmod -rx dir
+  $ hg status
+  dir: Permission denied
+  M a
+
+Reenable perm to allow deletion:
+
+  $ chmod +rx dir
+
--- a/tests/test-pull	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-mkdir test
-cd test
-echo foo>foo
-hg init
-hg addremove
-hg commit -m 1
-hg verify
-hg serve -p $HGPORT -d --pid-file=hg.pid
-cat hg.pid >> $DAEMON_PIDS
-cd ..
-
-hg clone --pull http://foo:bar@localhost:$HGPORT/ copy | sed -e "s,:$HGPORT/,:\$HGPORT/,"
-cd copy
-hg verify
-hg co
-cat foo
-hg manifest --debug
-hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/,"
-hg rollback --dry-run --verbose | sed -e "s,:$HGPORT/,:\$HGPORT/,"
-
-echo % issue 622
-cd ..
-hg init empty
-cd empty
-hg pull -u ../test
-
-echo % test file: uri handling
-hg pull -q file://../test-doesnt-exist 2>&1 \
-    | sed 's%abort: repository.*/test-doesnt-exist%abort: repository /test-doesnt-exist%'
-hg pull -q file:../test
-# It's tricky to make file:// URLs working on every platforms
-# 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-pull-branch	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-#!/bin/sh
-
-hg init t
-cd t
-echo 1 > foo
-hg ci -Am1 # 0
-hg branch branchA
-echo a1 > foo
-hg ci -ma1 # 1
-
-cd ..
-hg init tt
-cd tt
-hg pull ../t
-hg up branchA
-
-cd ../t
-echo a2 > foo
-hg ci -ma2 # 2
-echo % create branch B
-hg up 0
-hg branch branchB
-echo b1 > foo
-hg ci -mb1 # 3
-
-cd ../tt
-echo % a new branch is there
-hg pull -u ../t
-
-echo % develop both branch
-cd ../t
-hg up branchA
-echo a3 > foo
-hg ci -ma3 # 4
-hg up branchB
-echo b2 > foo
-hg ci -mb2 # 5
-
-cd ../tt
-echo % should succeed, no new heads
-hg pull -u ../t
-
-echo % add an head on other branch
-cd ../t
-hg up branchA
-echo a4 > foo
-hg ci -ma4 # 6
-hg up branchB
-echo b3.1 > foo
-hg ci -m b3.1 # 7
-hg up 5
-echo b3.2 > foo
-hg ci -m b3.2 # 8
-
-cd ../tt
-echo % should succeed only one head on our branch
-hg pull -u ../t
-
-cd ../t
-hg up -C branchA
-echo a5.1 > foo
-hg ci -ma5.1 # 9
-hg up 6
-echo a5.2 > foo
-hg ci -ma5.2 # 10
-hg up 7
-echo b4.1 > foo
-hg ci -m b4.1 # 11
-hg up -C 8
-echo b4.2 > foo
-hg ci -m b4.2 # 12
-
-cd ../tt
-echo % should fail new head in our branch
-hg pull -u ../t
--- a/tests/test-pull-branch.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-adding foo
-marked working directory as branch branchA
-pulling from ../t
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
-(run 'hg update' to get a working copy)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% create branch B
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch branchB
-% a new branch is there
-pulling from ../t
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files (+1 heads)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% develop both branch
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should succeed, no new heads
-pulling from ../t
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% add an head on other branch
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-% should succeed only one head on our branch
-pulling from ../t
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 1 files (+1 heads)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should fail new head in our branch
-pulling from ../t
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 4 changesets with 4 changes to 1 files (+1 heads)
-not updating, since new heads added
-(run 'hg heads' to see heads, 'hg merge' to merge)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pull-branch.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,136 @@
+  $ hg init t
+  $ cd t
+  $ echo 1 > foo
+  $ hg ci -Am1 # 0
+  adding foo
+  $ hg branch branchA
+  marked working directory as branch branchA
+  $ echo a1 > foo
+  $ hg ci -ma1 # 1
+
+  $ cd ..
+  $ hg init tt
+  $ cd tt
+  $ hg pull ../t
+  pulling from ../t
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  (run 'hg update' to get a working copy)
+  $ hg up branchA
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd ../t
+  $ echo a2 > foo
+  $ hg ci -ma2 # 2
+
+Create branch B:
+
+  $ hg up 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch branchB
+  marked working directory as branch branchB
+  $ echo b1 > foo
+  $ hg ci -mb1 # 3
+
+  $ cd ../tt
+
+A new branch is there
+
+  $ hg pull -u ../t
+  pulling from ../t
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files (+1 heads)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Develop both branches:
+
+  $ cd ../t
+  $ hg up branchA
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a3 > foo
+  $ hg ci -ma3 # 4
+  $ hg up branchB
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo b2 > foo
+  $ hg ci -mb2 # 5
+
+  $ cd ../tt
+
+Should succeed, no new heads:
+
+  $ hg pull -u ../t
+  pulling from ../t
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Add a head on other branch:
+
+  $ cd ../t
+  $ hg up branchA
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a4 > foo
+  $ hg ci -ma4 # 6
+  $ hg up branchB
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo b3.1 > foo
+  $ hg ci -m b3.1 # 7
+  $ hg up 5
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo b3.2 > foo
+  $ hg ci -m b3.2 # 8
+  created new head
+
+  $ cd ../tt
+
+Should succeed because there is only one head on our branch:
+
+  $ hg pull -u ../t
+  pulling from ../t
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 1 files (+1 heads)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd ../t
+  $ hg up -C branchA
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a5.1 > foo
+  $ hg ci -ma5.1 # 9
+  $ hg up 6
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a5.2 > foo
+  $ hg ci -ma5.2 # 10
+  created new head
+  $ hg up 7
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo b4.1 > foo
+  $ hg ci -m b4.1 # 11
+  $ hg up -C 8
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo b4.2 > foo
+  $ hg ci -m b4.2 # 12
+
+  $ cd ../tt
+
+  $ hg pull -u ../t
+  pulling from ../t
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 4 changes to 1 files (+1 heads)
+  not updating, since new heads added
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
--- a/tests/test-pull-permission	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-mkdir a
-cd a
-hg init
-echo foo > b
-hg add b
-hg ci -m "b"
-
-chmod -w .hg/store
-
-cd ..
-
-hg clone a b
-
-chmod +w a/.hg/store # let test clean up
-
-cd b
-hg verify
--- a/tests/test-pull-permission.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pull-permission.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,30 @@
+  $ mkdir a
+  $ cd a
+  $ hg init
+  $ echo foo > b
+  $ hg add b
+  $ hg ci -m "b"
+
+  $ chmod -w .hg/store
+
+  $ cd ..
+
+  $ hg clone a b
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ chmod +w a/.hg/store # let test clean up
+
+  $ cd b
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+
--- a/tests/test-pull-r	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-hg init repo
-cd repo
-echo foo > foo
-hg ci -qAm 'add foo'
-echo >> foo
-hg ci -m 'change foo'
-hg up -qC 0
-echo bar > bar
-hg ci -qAm 'add bar'
-hg log
-cd ..
-hg init copy
-cd copy
-
-echo '% pull a missing revision'
-hg pull -qr missing ../repo
-
-echo '% pull multiple revisions with update'
-hg pull -qu -r 0 -r 1 ../repo
-hg -q parents
-hg rollback
-
-echo '% pull -r 0'
-hg pull -qr 0 ../repo
-hg log
-
-echo '% pull -r 1'
-hg pull -qr 1 ../repo
-hg log
-
-# this used to abort: received changelog group is empty
-echo '% pull -r 1 again'
-hg pull -qr 1 ../repo
--- a/tests/test-pull-r.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-changeset:   2:effea6de0384
-tag:         tip
-parent:      0:bbd179dfa0a7
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     add bar
-
-changeset:   1:ed1b79f46b9a
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     change foo
-
-changeset:   0:bbd179dfa0a7
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     add foo
-
-% pull a missing revision
-abort: unknown revision 'missing'!
-% pull multiple revisions with update
-0:bbd179dfa0a7
-rolling back to revision -1 (undo pull)
-% pull -r 0
-changeset:   0:bbd179dfa0a7
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     add foo
-
-% pull -r 1
-changeset:   1:ed1b79f46b9a
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     change foo
-
-changeset:   0:bbd179dfa0a7
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     add foo
-
-% pull -r 1 again
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pull-r.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,71 @@
+  $ hg init repo
+  $ cd repo
+  $ echo foo > foo
+  $ hg ci -qAm 'add foo'
+  $ echo >> foo
+  $ hg ci -m 'change foo'
+  $ hg up -qC 0
+  $ echo bar > bar
+  $ hg ci -qAm 'add bar'
+
+  $ hg log
+  changeset:   2:effea6de0384
+  tag:         tip
+  parent:      0:bbd179dfa0a7
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add bar
+  
+  changeset:   1:ed1b79f46b9a
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     change foo
+  
+  changeset:   0:bbd179dfa0a7
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add foo
+  
+  $ cd ..
+  $ hg init copy
+  $ cd copy
+
+Pull a missing revision:
+
+  $ hg pull -qr missing ../repo
+  abort: unknown revision 'missing'!
+
+Pull multiple revisions with update:
+
+  $ hg pull -qu -r 0 -r 1 ../repo
+  $ hg -q parents
+  0:bbd179dfa0a7
+  $ hg rollback
+  rolling back to revision -1 (undo pull)
+
+  $ hg pull -qr 0 ../repo
+  $ hg log
+  changeset:   0:bbd179dfa0a7
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add foo
+  
+  $ hg pull -qr 1 ../repo
+  $ hg log
+  changeset:   1:ed1b79f46b9a
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     change foo
+  
+  changeset:   0:bbd179dfa0a7
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     add foo
+  
+
+This used to abort: received changelog group is empty:
+
+  $ hg pull -qr 1 ../repo
+
--- a/tests/test-pull-update	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#!/bin/sh
-#
-
-hg init t
-cd t
-echo 1 > foo
-hg ci -Am m
-
-cd ..
-hg clone t tt
-cd tt
-echo 1.1 > foo
-hg ci -Am m
-
-cd ../t
-echo 1.2 > foo
-hg ci -Am m
-echo % should fail
-hg pull -u ../tt
-
-cd ../tt
-echo % should fail
-hg pull -u ../t
-HGMERGE=true hg merge
-hg ci -mm
-
-cd ../t
-echo % should work
-hg pull -u ../tt
--- a/tests/test-pull-update.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-adding foo
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% should fail
-pulling from ../tt
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-not updating, since new heads added
-(run 'hg heads' to see heads, 'hg merge' to merge)
-% should fail
-pulling from ../t
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-not updating, since new heads added
-(run 'hg heads' to see heads, 'hg merge' to merge)
-merging foo
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% should work
-pulling from ../tt
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (-1 heads)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pull-update.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,63 @@
+  $ hg init t
+  $ cd t
+  $ echo 1 > foo
+  $ hg ci -Am m
+  adding foo
+
+  $ cd ..
+  $ hg clone t tt
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd tt
+  $ echo 1.1 > foo
+  $ hg ci -Am m
+
+  $ cd ../t
+  $ echo 1.2 > foo
+  $ hg ci -Am m
+
+Should not update:
+
+  $ hg pull -u ../tt
+  pulling from ../tt
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  not updating, since new heads added
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ cd ../tt
+
+Should not update:
+
+  $ hg pull -u ../t
+  pulling from ../t
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  not updating, since new heads added
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ HGMERGE=true hg merge
+  merging foo
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -mm
+
+  $ cd ../t
+
+Should work:
+
+  $ hg pull -u ../tt
+  pulling from ../tt
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (-1 heads)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
--- a/tests/test-pull.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-adding foo
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-foo
-2ed2a3912a0b24502043eae84ee4b279c18b90dd 644   foo
-pulling from http://foo:***@localhost:$HGPORT/
-searching for changes
-no changes found
-rolling back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
-% issue 622
-pulling from ../test
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% test file: uri handling
-abort: repository /test-doesnt-exist not found!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-pull.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,80 @@
+  $ mkdir test
+  $ cd test
+
+  $ echo foo>foo
+  $ hg init
+  $ hg addremove
+  adding foo
+  $ hg commit -m 1
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+
+  $ hg serve -p $HGPORT -d --pid-file=hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+  $ cd ..
+
+  $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy | sed -e "s,:$HGPORT/,:\$HGPORT/,"
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd copy
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+
+  $ hg co
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat foo
+  foo
+
+  $ hg manifest --debug
+  2ed2a3912a0b24502043eae84ee4b279c18b90dd 644   foo
+
+  $ hg pull | sed -e "s,:$HGPORT/,:\$HGPORT/,"
+  pulling from http://foo:***@localhost:$HGPORT/
+  searching for changes
+  no changes found
+
+  $ hg rollback --dry-run --verbose | sed -e "s,:$HGPORT/,:\$HGPORT/,"
+  rolling back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
+
+Issue 622:
+
+  $ cd ..
+  $ hg init empty
+  $ cd empty
+  $ hg pull -u ../test
+  pulling from ../test
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Test 'file:' uri handling:
+
+  $ hg pull -q file://../test-doesnt-exist
+  abort: repository /test-doesnt-exist not found!
+
+  $ hg pull -q file:../test
+
+# It's tricky to make file:// URLs working on every platforms
+# 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-hook-lock	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-#!/bin/sh
-hg init 1
-echo '[ui]' >> 1/.hg/hgrc
-echo 'timeout = 10' >> 1/.hg/hgrc
-echo foo > 1/foo
-hg --cwd 1 ci -A -m foo
-hg clone 1 2
-hg clone 2 3
-echo '[hooks]' >> 2/.hg/hgrc
-echo 'changegroup.push = hg push -qf ../1' >> 2/.hg/hgrc
-echo bar >> 3/foo
-hg --cwd 3 ci -m bar
-hg --cwd 3 push ../2
--- a/tests/test-push-hook-lock.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-adding foo
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-pushing to ../2
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-push-hook-lock.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,31 @@
+  $ hg init 1
+
+  $ echo '[ui]' >> 1/.hg/hgrc
+  $ echo 'timeout = 10' >> 1/.hg/hgrc
+
+  $ echo foo > 1/foo
+  $ hg --cwd 1 ci -A -m foo
+  adding foo
+
+  $ hg clone 1 2
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg clone 2 3
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ echo '[hooks]' >> 2/.hg/hgrc
+  $ echo 'changegroup.push = hg push -qf ../1' >> 2/.hg/hgrc
+
+  $ echo bar >> 3/foo
+  $ hg --cwd 3 ci -m bar
+
+  $ hg --cwd 3 push ../2
+  pushing to ../2
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
--- a/tests/test-push-r	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#!/bin/sh
-
-hg init test
-cd test
-cat >>afile <<EOF
-0
-EOF
-hg add afile
-hg commit -m "0.0"
-cat >>afile <<EOF
-1
-EOF
-hg commit -m "0.1"
-cat >>afile <<EOF
-2
-EOF
-hg commit -m "0.2"
-cat >>afile <<EOF
-3
-EOF
-hg commit -m "0.3"
-hg update -C 0
-cat >>afile <<EOF
-1
-EOF
-hg commit -m "1.1"
-cat >>afile <<EOF
-2
-EOF
-hg commit -m "1.2"
-cat >fred <<EOF
-a line
-EOF
-cat >>afile <<EOF
-3
-EOF
-hg add fred
-hg commit -m "1.3"
-hg mv afile adifferentfile
-hg commit -m "1.3m"
-hg update -C 3
-hg mv afile anotherfile
-hg commit -m "0.3m"
-hg debugindex .hg/store/data/afile.i
-hg debugindex .hg/store/data/adifferentfile.i
-hg debugindex .hg/store/data/anotherfile.i
-hg debugindex .hg/store/data/fred.i
-hg debugindex .hg/store/00manifest.i
-hg verify
-cd ..
-for i in 0 1 2 3 4 5 6 7 8; do
-   mkdir test-"$i"
-   hg --cwd test-"$i" init
-   hg -R test push -r "$i" test-"$i"
-   cd test-"$i"
-   hg verify
-   cd ..
-done
-cd test-8
-hg pull ../test-7
-hg verify
--- a/tests/test-push-r.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-1 files updated, 0 files merged, 2 files removed, 0 files unresolved
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0       3      0       0 362fef284ce2 000000000000 000000000000
-     1         3       5      1       1 125144f7e028 362fef284ce2 000000000000
-     2         8       7      2       2 4c982badb186 125144f7e028 000000000000
-     3        15       9      3       3 19b1fc555737 4c982badb186 000000000000
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0      75      0       7 2565f3199a74 000000000000 000000000000
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0      75      0       8 2565f3199a74 000000000000 000000000000
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0       8      0       6 12ab3bcc5ea4 000000000000 000000000000
-   rev    offset  length   base linkrev nodeid       p1           p2
-     0         0      48      0       0 43eadb1d2d06 000000000000 000000000000
-     1        48      48      1       1 8b89697eba2c 43eadb1d2d06 000000000000
-     2        96      48      2       2 626a32663c2f 8b89697eba2c 000000000000
-     3       144      48      3       3 f54c32f13478 626a32663c2f 000000000000
-     4       192      58      3       6 de68e904d169 626a32663c2f 000000000000
-     5       250      68      3       7 09bb521d218d de68e904d169 000000000000
-     6       318      54      6       8 1fde233dfb0f f54c32f13478 000000000000
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-4 files, 9 changesets, 7 total revisions
-pushing to test-0
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
-pushing to test-1
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 2 changesets, 2 total revisions
-pushing to test-2
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 1 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 3 changesets, 3 total revisions
-pushing to test-3
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 4 changesets with 4 changes to 1 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 4 changesets, 4 total revisions
-pushing to test-4
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 2 changesets, 2 total revisions
-pushing to test-5
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 3 changesets with 3 changes to 1 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 3 changesets, 3 total revisions
-pushing to test-6
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 4 changesets with 5 changes to 2 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-2 files, 4 changesets, 5 total revisions
-pushing to test-7
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 5 changesets with 6 changes to 3 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-3 files, 5 changesets, 6 total revisions
-pushing to test-8
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 5 changesets with 5 changes to 2 files
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-2 files, 5 changesets, 5 total revisions
-pulling from ../test-7
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 4 changesets with 2 changes to 3 files (+1 heads)
-(run 'hg heads' to see heads, 'hg merge' to merge)
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-4 files, 9 changesets, 7 total revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-push-r.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,230 @@
+  $ hg init test
+  $ cd test
+
+  $ cat >>afile <<EOF
+  > 0
+  > EOF
+  $ hg add afile
+  $ hg commit -m "0.0"
+
+  $ cat >>afile <<EOF
+  > 1
+  > EOF
+  $ hg commit -m "0.1"
+
+  $ cat >>afile <<EOF
+  > 2
+  > EOF
+  $ hg commit -m "0.2"
+
+  $ cat >>afile <<EOF
+  > 3
+  > EOF
+  $ hg commit -m "0.3"
+
+  $ hg update -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cat >>afile <<EOF
+  > 1
+  > EOF
+  $ hg commit -m "1.1"
+  created new head
+
+  $ cat >>afile <<EOF
+  > 2
+  > EOF
+  $ hg commit -m "1.2"
+
+  $ cat >fred <<EOF
+  > a line
+  > EOF
+  $ cat >>afile <<EOF
+  > 3
+  > EOF
+  $ hg add fred
+  $ hg commit -m "1.3"
+
+  $ hg mv afile adifferentfile
+  $ hg commit -m "1.3m"
+
+  $ hg update -C 3
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+
+  $ hg mv afile anotherfile
+  $ hg commit -m "0.3m"
+
+  $ hg debugindex .hg/store/data/afile.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0       3      0       0 362fef284ce2 000000000000 000000000000
+       1         3       5      1       1 125144f7e028 362fef284ce2 000000000000
+       2         8       7      2       2 4c982badb186 125144f7e028 000000000000
+       3        15       9      3       3 19b1fc555737 4c982badb186 000000000000
+
+  $ hg debugindex .hg/store/data/adifferentfile.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0      75      0       7 2565f3199a74 000000000000 000000000000
+
+  $ hg debugindex .hg/store/data/anotherfile.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0      75      0       8 2565f3199a74 000000000000 000000000000
+
+  $ hg debugindex .hg/store/data/fred.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0       8      0       6 12ab3bcc5ea4 000000000000 000000000000
+
+  $ hg debugindex .hg/store/00manifest.i
+     rev    offset  length   base linkrev nodeid       p1           p2
+       0         0      48      0       0 43eadb1d2d06 000000000000 000000000000
+       1        48      48      1       1 8b89697eba2c 43eadb1d2d06 000000000000
+       2        96      48      2       2 626a32663c2f 8b89697eba2c 000000000000
+       3       144      48      3       3 f54c32f13478 626a32663c2f 000000000000
+       4       192      58      3       6 de68e904d169 626a32663c2f 000000000000
+       5       250      68      3       7 09bb521d218d de68e904d169 000000000000
+       6       318      54      6       8 1fde233dfb0f f54c32f13478 000000000000
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  4 files, 9 changesets, 7 total revisions
+
+  $ cd ..
+
+  $ for i in 0 1 2 3 4 5 6 7 8; do
+  >    echo
+  >    mkdir test-"$i"
+  >    hg --cwd test-"$i" init
+  >    hg -R test push -r "$i" test-"$i"
+  >    cd test-"$i"
+  >    hg verify
+  >    cd ..
+  > done
+  
+  pushing to test-0
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+  
+  pushing to test-1
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 2 changesets, 2 total revisions
+  
+  pushing to test-2
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 1 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 3 changesets, 3 total revisions
+  
+  pushing to test-3
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 4 changes to 1 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 4 changesets, 4 total revisions
+  
+  pushing to test-4
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 2 changesets, 2 total revisions
+  
+  pushing to test-5
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 1 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 3 changesets, 3 total revisions
+  
+  pushing to test-6
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 5 changes to 2 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  2 files, 4 changesets, 5 total revisions
+  
+  pushing to test-7
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 6 changes to 3 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  3 files, 5 changesets, 6 total revisions
+  
+  pushing to test-8
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 5 changesets with 5 changes to 2 files
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  2 files, 5 changesets, 5 total revisions
+
+  $ cd test-8
+
+  $ hg pull ../test-7
+  pulling from ../test-7
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 2 changes to 3 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  4 files, 9 changesets, 7 total revisions
+
--- a/tests/test-push-validation	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-hg init test
-cd test
-cat > .hg/hgrc <<EOF
-[server]
-validate=1
-EOF
-echo alpha > alpha
-echo beta > beta
-hg addr
-hg ci -m 1
-
-cd ..
-hg clone test test-clone
-
-cd test-clone
-cp .hg/store/data/beta.i tmp
-echo blah >> beta
-hg ci -m '2 (corrupt)'
-mv tmp .hg/store/data/beta.i
-hg push 2>&1 | "$TESTDIR/filtertmp.py"
--- a/tests/test-push-validation.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-adding alpha
-adding beta
-updating to branch default
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-pushing to $HGTMP/test-push-validation/test
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-transaction abort!
-rollback completed
-abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-push-validation.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,52 @@
+  $ hg init test
+  $ cd test
+
+  $ cat > .hg/hgrc <<EOF
+  > [server]
+  > validate=1
+  > EOF
+
+  $ echo alpha > alpha
+  $ echo beta > beta
+  $ hg addr
+  adding alpha
+  adding beta
+  $ hg ci -m 1
+
+  $ cd ..
+  $ hg clone test test-clone
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd test-clone
+  $ cp .hg/store/data/beta.i tmp
+  $ echo blah >> beta
+  $ hg ci -m '2 (corrupt)'
+  $ mv tmp .hg/store/data/beta.i
+
+Expected to fail:
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+   beta@1: dddc47b3ba30 in manifests not found
+  2 files, 2 changesets, 2 total revisions
+  1 integrity errors encountered!
+  (first damaged changeset appears to be 1)
+
+Expected to fail:
+
+  $ hg push
+  pushing to .*
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  transaction abort!
+  rollback completed
+  abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify
+
+  $ true
+
--- a/tests/test-push-warn	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-#!/bin/sh
-
-echo "[extensions]" >> $HGRCPATH
-echo "graphlog=" >> $HGRCPATH
-
-mkdir a
-cd a
-hg init
-echo foo > t1
-hg add t1
-hg commit -m "1"
-
-cd ..
-hg clone a b
-
-cd a
-echo foo > t2
-hg add t2
-hg commit -m "2"
-
-cd ../b
-echo foo > t3
-hg add t3
-hg commit -m "3"
-
-hg push ../a
-hg pull ../a
-hg push ../a
-hg merge
-hg commit -m "4"
-hg push ../a
-cd ..
-
-hg init c
-cd c
-for i in 0 1 2; do
-    echo $i >> foo
-    hg ci -Am $i
-done
-cd ..
-
-hg clone c d
-cd d
-for i in 0 1; do
-    hg co -C $i
-    echo d-$i >> foo
-    hg ci -m d-$i
-done
-
-HGMERGE=true hg merge 3
-hg ci -m c-d
-
-hg push ../c; echo $?
-hg push -r 2 ../c; echo $?
-hg push -r 3 ../c; echo $?
-hg push -r 3 -r 4 ../c; echo $?
-hg push -f -r 3 -r 4 ../c; echo $?
-hg push -r 5 ../c; echo $?
-hg in ../c
-
-echo % issue 450
-hg init ../e
-hg push -r 0 ../e ; echo $?
-hg push -r 1 ../e ; echo $?
-
-cd ..
-
-echo % issue 736
-hg init f
-cd f
-hg -q branch a
-echo 0 > foo
-hg -q ci -Am 0
-echo 1 > foo
-hg -q ci -m 1
-hg -q up 0
-echo 2 > foo
-hg -q ci -m 2
-hg -q up 0
-hg -q branch b
-echo 3 > foo
-hg -q ci -m 3
-cd ..
-
-hg -q clone f g
-cd g
-
-echo % push on existing branch and new branch
-hg -q up 1
-echo 4 > foo
-hg -q ci -m 4
-hg -q up 0
-echo 5 > foo
-hg -q branch c
-hg -q ci -m 5
-hg push ../f; echo $?
-hg push -r 4 -r 5 ../f; echo $?
-
-echo % multiple new branches
-hg -q branch d
-echo 6 > foo
-hg -q ci -m 6
-hg push ../f; echo $?
-hg push -r 4 -r 6 ../f; echo $?
-cd ../g
-
-echo % fail on multiple head push
-hg -q up 1
-echo 7 > foo
-hg -q ci -m 7
-hg push -r 4 -r 7 ../f; echo $?
-
-echo % push replacement head on existing branches
-hg -q up 3
-echo 8 > foo
-hg -q ci -m 8
-hg push -r 7 -r 8 ../f; echo $?
-
-echo % merge of branch a to other branch b followed by unrelated push on branch a
-hg -q up 7
-HGMERGE=true hg -q merge 8
-hg -q ci -m 9
-hg -q up 8
-echo 10 > foo
-hg -q ci -m 10
-hg push -r 9 ../f; echo $?
-hg push -r 10 ../f; echo $?
-
-echo % cheating the counting algorithm
-hg -q up 9
-HGMERGE=true hg -q merge 2
-hg -q ci -m 11
-hg -q up 1
-echo 12 > foo
-hg -q ci -m 12
-hg push -r 11 -r 12 ../f; echo $?
-
-echo % failed push of new named branch
-echo 12 > foo
-hg -q ci -m 12a
-hg -q up 11
-echo 13 > foo
-hg -q branch e
-hg -q ci -m 13d
-hg push -r 12 -r 13 ../f; echo $?
-
-echo % using --new-branch to push new named branch
-hg push --new-branch -r 12 -r 13 ../f; echo $?
-
-echo % checking prepush logic does not allow silently pushing multiple new heads
-cd ..
-hg init h
-echo init > h/init
-hg -R h ci -Am init
-echo a > h/a
-hg -R h ci -Am a
-hg clone h i
-hg -R h up 0
-echo b > h/b
-hg -R h ci -Am b
-hg -R i up 0
-echo c > i/c
-hg -R i ci -Am c
-hg -R i push h
-echo
-
-echo % check prepush logic with merged branches
-hg init j
-hg -R j branch a
-echo init > j/foo
-hg -R j ci -Am init
-hg clone j k
-echo a1 > j/foo
-hg -R j ci -m a1
-hg -R k branch b
-echo b > k/foo
-hg -R k ci -m b
-hg -R k up 0
-hg -R k merge b
-hg -R k ci -m merge
-hg -R k push -r a j
-echo
-
-echo % prepush -r should not allow you to sneak in new heads
-hg init l
-cd l
-echo a >> foo
-hg -q add foo
-hg -q branch a
-hg -q ci -ma
-hg -q up null
-echo a >> foo
-hg -q add foo
-hg -q branch b
-hg -q ci -mb
-cd ..
-hg -q clone l m -u a
-cd m
-hg -q merge b
-hg -q ci -mmb
-hg -q up 0
-echo a >> foo
-hg -q ci -ma2
-hg -q up 2
-echo a >> foo
-hg -q branch -f b
-hg -q ci -mb2
-hg -q merge 3
-hg -q ci -mma
-hg push ../l -b b
-cd ..
-
-echo % check prepush with new branch head on former topo non-head
-hg init n
-cd n
-hg branch A
-echo a >a
-hg ci -Ama
-hg branch B
-echo b >b
-hg ci -Amb
-# 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
-cd inner
-hg up B
-echo b1 >b1
-hg ci -Amb1
-# in the clone b1 is now the head of B
-cd ..
-hg up 0
-echo a2 >a2
-hg ci -Ama2
-# 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
-echo %% glog of local
-hg glog --template "{rev}: {branches} {desc}\n"
-echo %% glog of remote
-hg glog -R inner --template "{rev}: {branches} {desc}\n"
-echo %% outgoing
-hg out inner --template "{rev}: {branches} {desc}\n"
-hg push inner
-cd ..
-
-echo % check prepush with new branch head on former topo head
-hg init o
-cd o
-hg branch A
-echo a >a
-hg ci -Ama
-hg branch B
-echo b >b
-hg ci -Amb
-# b is now branch head of B, and a topological head
-hg up 0
-echo a1 >a1
-hg ci -Ama1
-# a1 is now branch head of A, and a topological head
-hg clone . inner
-cd inner
-hg up B
-echo b1 >b1
-hg ci -Amb1
-# in the clone b1 is now the head of B
-cd ..
-echo a2 >a2
-hg ci -Ama2
-# 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
-echo %% glog of local
-hg glog --template "{rev}: {branches} {desc}\n"
-echo %% glog of remote
-hg glog -R inner --template "{rev}: {branches} {desc}\n"
-echo %% outgoing
-hg out inner --template "{rev}: {branches} {desc}\n"
-hg push inner
-cd ..
-
-echo % check prepush with new branch head and new child of former branch head
-echo % but child is on different branch
-hg init p
-cd p
-hg branch A
-echo a0 >a
-hg ci -Ama0
-echo a1 >a
-hg ci -ma1
-hg up null
-hg branch B
-echo b0 >b
-hg ci -Amb0
-echo b1 >b
-hg ci -mb1
-
-hg clone . inner
-
-hg up A
-hg branch -f B
-echo a3 >a
-hg ci -ma3
-hg up 3
-hg branch -f A
-echo b3 >b
-hg ci -mb3
-
-echo %% glog of local
-hg glog --template "{rev}: {branches} {desc}\n"
-echo %% glog of remote
-hg glog -R inner --template "{rev}: {branches} {desc}\n"
-echo %% outgoing
-hg out inner --template "{rev}: {branches} {desc}\n"
-hg push inner
-hg push inner -r4 -r5
-hg in inner
-cd ..
-
-exit 0
--- a/tests/test-push-warn.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,323 +0,0 @@
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-pushing to ../a
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(you should pull and merge or use push -f to force)
-pulling from ../a
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-(run 'hg heads' to see heads, 'hg merge' to merge)
-pushing to ../a
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-pushing to ../a
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 1 changes to 1 files
-adding foo
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-merging foo
-0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-pushing to ../c
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-255
-pushing to ../c
-searching for changes
-no changes found
-0
-pushing to ../c
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-255
-pushing to ../c
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(did you forget to merge? use push -f to force)
-255
-pushing to ../c
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files (+2 heads)
-0
-pushing to ../c
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (-1 heads)
-0
-comparing with ../c
-searching for changes
-no changes found
-% issue 450
-pushing to ../e
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-0
-pushing to ../e
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-0
-% issue 736
-% push on existing branch and new branch
-pushing to ../f
-searching for changes
-abort: push creates new remote branches: c!
-(use 'hg push --new-branch' to create new remote branches)
-255
-pushing to ../f
-searching for changes
-abort: push creates new remote branches: c!
-(use 'hg push --new-branch' to create new remote branches)
-255
-% multiple new branches
-pushing to ../f
-searching for changes
-abort: push creates new remote branches: c, d!
-(use 'hg push --new-branch' to create new remote branches)
-255
-pushing to ../f
-searching for changes
-abort: push creates new remote branches: c, d!
-(use 'hg push --new-branch' to create new remote branches)
-255
-% fail on multiple head push
-pushing to ../f
-searching for changes
-abort: push creates new remote heads on branch 'a'!
-(did you forget to merge? use push -f to force)
-255
-% push replacement head on existing branches
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
-0
-% merge of branch a to other branch b followed by unrelated push on branch a
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (-1 heads)
-0
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-0
-% cheating the counting algorithm
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 2 changes to 1 files
-0
-% failed push of new named branch
-pushing to ../f
-searching for changes
-abort: push creates new remote branches: e!
-(use 'hg push --new-branch' to create new remote branches)
-255
-% using --new-branch to push new named branch
-pushing to ../f
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-0
-% checking prepush logic does not allow silently pushing multiple new heads
-adding init
-adding a
-updating to branch default
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding b
-created new head
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding c
-created new head
-pushing to h
-searching for changes
-abort: push creates new remote heads on branch 'default'!
-(you should pull and merge or use push -f to force)
-
-% check prepush logic with merged branches
-marked working directory as branch a
-adding foo
-updating to branch a
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch b
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-pushing to j
-searching for changes
-abort: push creates new remote branches: b!
-(use 'hg push --new-branch' to create new remote branches)
-
-% prepush -r should not allow you to sneak in new heads
-pushing to ../l
-searching for changes
-abort: push creates new remote heads on branch 'a'!
-(did you forget to merge? use push -f to force)
-% check prepush with new branch head on former topo non-head
-marked working directory as branch A
-adding a
-marked working directory as branch B
-adding b
-updating to branch B
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-adding b1
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding a2
-%% glog of local
-@  2: A a2
-|
-| o  1: B b
-|/
-o  0: A a
-
-%% glog of remote
-@  2: B b1
-|
-o  1: B b
-|
-o  0: A a
-
-%% outgoing
-comparing with inner
-searching for changes
-2: A a2
-pushing to inner
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-% check prepush with new branch head on former topo head
-marked working directory as branch A
-adding a
-marked working directory as branch B
-adding b
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding a1
-updating to branch A
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-adding b1
-adding a2
-%% glog of local
-@  3: A a2
-|
-o  2: A a1
-|
-| o  1: B b
-|/
-o  0: A a
-
-%% glog of remote
-@  3: B b1
-|
-| o  2: A a1
-| |
-o |  1: B b
-|/
-o  0: A a
-
-%% outgoing
-comparing with inner
-searching for changes
-3: A a2
-pushing to inner
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-% check prepush with new branch head and new child of former branch head
-% but child is on different branch
-marked working directory as branch A
-adding a
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch B
-adding b
-updating to branch B
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch B
-created new head
-1 files updated, 0 files merged, 1 files removed, 0 files unresolved
-marked working directory as branch A
-created new head
-%% glog of local
-@  5: A b3
-|
-| o  4: B a3
-| |
-o |  3: B b1
-| |
-o |  2: B b0
- /
-o  1: A a1
-|
-o  0: A a0
-
-%% glog of remote
-@  3: B b1
-|
-o  2: B b0
-
-o  1: A a1
-|
-o  0: A a0
-
-%% outgoing
-comparing with inner
-searching for changes
-4: B a3
-5: A b3
-pushing to inner
-searching for changes
-abort: push creates new remote heads on branch 'A'!
-(did you forget to merge? use push -f to force)
-pushing to inner
-searching for changes
-abort: push creates new remote heads on branch 'A'!
-(did you forget to merge? use push -f to force)
-comparing with inner
-searching for changes
-no changes found
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-push-warn.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,701 @@
+  $ echo "[extensions]" >> $HGRCPATH
+  $ echo "graphlog=" >> $HGRCPATH
+
+  $ mkdir a
+  $ cd a
+  $ hg init
+  $ echo foo > t1
+  $ hg add t1
+  $ hg commit -m "1"
+
+  $ cd ..
+  $ hg clone a b
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd a
+  $ echo foo > t2
+  $ hg add t2
+  $ hg commit -m "2"
+
+  $ cd ../b
+  $ echo foo > t3
+  $ hg add t3
+  $ hg commit -m "3"
+
+  $ hg push ../a
+  pushing to ../a
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (you should pull and merge or use push -f to force)
+
+  $ hg pull ../a
+  pulling from ../a
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg push ../a
+  pushing to ../a
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (did you forget to merge? use push -f to force)
+
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg commit -m "4"
+  $ hg push ../a
+  pushing to ../a
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 1 changes to 1 files
+
+  $ cd ..
+
+  $ hg init c
+  $ cd c
+  $ for i in 0 1 2; do
+  >     echo $i >> foo
+  >     hg ci -Am $i
+  > done
+  adding foo
+  $ cd ..
+
+  $ hg clone c d
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd d
+  $ for i in 0 1; do
+  >    hg co -C $i
+  >    echo d-$i >> foo
+  >    hg ci -m d-$i
+  > done
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  created new head
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  created new head
+
+  $ HGMERGE=true hg merge 3
+  merging foo
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg ci -m c-d
+
+  $ hg push ../c; echo $?
+  pushing to ../c
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (did you forget to merge? use push -f to force)
+  255
+
+  $ hg push -r 2 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  no changes found
+  0
+
+  $ hg push -r 3 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (did you forget to merge? use push -f to force)
+  255
+
+  $ hg push -r 3 -r 4 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (did you forget to merge? use push -f to force)
+  255
+
+  $ hg push -f -r 3 -r 4 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files (+2 heads)
+  0
+
+  $ hg push -r 5 ../c; echo $?
+  pushing to ../c
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (-1 heads)
+  0
+
+  $ hg in ../c
+  comparing with ../c
+  searching for changes
+  no changes found
+
+
+Issue 450:
+
+  $ hg init ../e
+  $ hg push -r 0 ../e ; echo $?
+  pushing to ../e
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  0
+
+  $ hg push -r 1 ../e ; echo $?
+  pushing to ../e
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  0
+
+  $ cd ..
+
+
+Issue 736:
+
+  $ hg init f
+  $ cd f
+  $ hg -q branch a
+  $ echo 0 > foo
+  $ hg -q ci -Am 0
+  $ echo 1 > foo
+  $ hg -q ci -m 1
+  $ hg -q up 0
+  $ echo 2 > foo
+  $ hg -q ci -m 2
+  $ hg -q up 0
+  $ hg -q branch b
+  $ echo 3 > foo
+  $ hg -q ci -m 3
+  $ cd ..
+
+  $ hg -q clone f g
+  $ cd g
+
+Push on existing branch and new branch:
+
+  $ hg -q up 1
+  $ echo 4 > foo
+  $ hg -q ci -m 4
+  $ hg -q up 0
+  $ echo 5 > foo
+  $ hg -q branch c
+  $ hg -q ci -m 5
+
+  $ hg push ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote branches: c!
+  (use 'hg push --new-branch' to create new remote branches)
+  255
+
+  $ hg push -r 4 -r 5 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote branches: c!
+  (use 'hg push --new-branch' to create new remote branches)
+  255
+
+
+Multiple new branches:
+
+  $ hg -q branch d
+  $ echo 6 > foo
+  $ hg -q ci -m 6
+
+  $ hg push ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote branches: c, d!
+  (use 'hg push --new-branch' to create new remote branches)
+  255
+
+  $ hg push -r 4 -r 6 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote branches: c, d!
+  (use 'hg push --new-branch' to create new remote branches)
+  255
+
+  $ cd ../g
+
+
+Fail on multiple head push:
+
+  $ hg -q up 1
+  $ echo 7 > foo
+  $ hg -q ci -m 7
+
+  $ hg push -r 4 -r 7 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote heads on branch 'a'!
+  (did you forget to merge? use push -f to force)
+  255
+
+Push replacement head on existing branches:
+
+  $ hg -q up 3
+  $ echo 8 > foo
+  $ hg -q ci -m 8
+
+  $ hg push -r 7 -r 8 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  0
+
+
+Merge of branch a to other branch b followed by unrelated push
+on branch a:
+
+  $ hg -q up 7
+  $ HGMERGE=true hg -q merge 8
+  $ hg -q ci -m 9
+  $ hg -q up 8
+  $ echo 10 > foo
+  $ hg -q ci -m 10
+
+  $ hg push -r 9 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (-1 heads)
+  0
+
+  $ hg push -r 10 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  0
+
+
+Cheating the counting algorithm:
+
+  $ hg -q up 9
+  $ HGMERGE=true hg -q merge 2
+  $ hg -q ci -m 11
+  $ hg -q up 1
+  $ echo 12 > foo
+  $ hg -q ci -m 12
+
+  $ hg push -r 11 -r 12 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 2 changes to 1 files
+  0
+
+
+Failed push of new named branch:
+
+  $ echo 12 > foo
+  $ hg -q ci -m 12a
+  $ hg -q up 11
+  $ echo 13 > foo
+  $ hg -q branch e
+  $ hg -q ci -m 13d
+
+  $ hg push -r 12 -r 13 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  abort: push creates new remote branches: e!
+  (use 'hg push --new-branch' to create new remote branches)
+  255
+
+
+Using --new-branch to push new named branch:
+
+  $ hg push --new-branch -r 12 -r 13 ../f; echo $?
+  pushing to ../f
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  0
+
+
+Checking prepush logic does not allow silently pushing 
+multiple new heads:
+
+  $ cd ..
+  $ hg init h
+  $ echo init > h/init
+  $ hg -R h ci -Am init
+  adding init
+  $ echo a > h/a
+  $ hg -R h ci -Am a
+  adding a
+  $ hg clone h i
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg -R h up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo b > h/b
+  $ hg -R h ci -Am b
+  adding b
+  created new head
+  $ hg -R i up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo c > i/c
+  $ hg -R i ci -Am c
+  adding c
+  created new head
+
+  $ hg -R i push h
+  pushing to h
+  searching for changes
+  abort: push creates new remote heads on branch 'default'!
+  (you should pull and merge or use push -f to force)
+
+
+Check prepush logic with merged branches:
+
+  $ hg init j
+  $ hg -R j branch a
+  marked working directory as branch a
+  $ echo init > j/foo
+  $ hg -R j ci -Am init
+  adding foo
+  $ hg clone j k
+  updating to branch a
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo a1 > j/foo
+  $ hg -R j ci -m a1
+  $ hg -R k branch b
+  marked working directory as branch b
+  $ echo b > k/foo
+  $ hg -R k ci -m b
+  $ hg -R k up 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg -R k merge b
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg -R k ci -m merge
+
+  $ hg -R k push -r a j
+  pushing to j
+  searching for changes
+  abort: push creates new remote branches: b!
+  (use 'hg push --new-branch' to create new remote branches)
+
+
+Prepush -r should not allow you to sneak in new heads:
+
+  $ hg init l
+  $ cd l
+  $ echo a >> foo
+  $ hg -q add foo
+  $ hg -q branch a
+  $ hg -q ci -ma
+  $ hg -q up null
+  $ echo a >> foo
+  $ hg -q add foo
+  $ hg -q branch b
+  $ hg -q ci -mb
+  $ cd ..
+  $ hg -q clone l m -u a
+  $ cd m
+  $ hg -q merge b
+  $ hg -q ci -mmb
+  $ hg -q up 0
+  $ echo a >> foo
+  $ hg -q ci -ma2
+  $ hg -q up 2
+  $ echo a >> foo
+  $ hg -q branch -f b
+  $ hg -q ci -mb2
+  $ hg -q merge 3
+  $ hg -q ci -mma
+
+  $ hg push ../l -b b
+  pushing to ../l
+  searching for changes
+  abort: push creates new remote heads on branch 'a'!
+  (did you forget to merge? use push -f to force)
+
+  $ cd ..
+
+
+Check prepush with new branch head on former topo non-head:
+
+  $ hg init n
+  $ cd n
+  $ hg branch A
+  marked working directory as branch A
+  $ echo a >a
+  $ hg ci -Ama
+  adding a
+  $ hg branch B
+  marked working directory as branch B
+  $ echo b >b
+  $ 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
+
+  $ hg clone . inner
+  updating to branch B
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd inner
+  $ hg up B
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo b1 >b1
+  $ hg ci -Amb1
+  adding b1
+
+# in the clone b1 is now the head of B
+
+  $ cd ..
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo a2 >a2
+  $ 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
+
+glog of local:
+
+  $ hg glog --template "{rev}: {branches} {desc}\n"
+  @  2: A a2
+  |
+  | o  1: B b
+  |/
+  o  0: A a
+  
+glog of remote:
+
+  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  @  2: B b1
+  |
+  o  1: B b
+  |
+  o  0: A a
+  
+outgoing:
+
+  $ hg out inner --template "{rev}: {branches} {desc}\n"
+  comparing with inner
+  searching for changes
+  2: A a2
+
+  $ hg push inner
+  pushing to inner
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+
+  $ cd ..
+
+
+Check prepush with new branch head on former topo head:
+
+  $ hg init o
+  $ cd o
+  $ hg branch A
+  marked working directory as branch A
+  $ echo a >a
+  $ hg ci -Ama
+  adding a
+  $ hg branch B
+  marked working directory as branch B
+  $ echo b >b
+  $ hg ci -Amb
+  adding b
+
+# 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
+  $ echo a1 >a1
+  $ hg ci -Ama1
+  adding a1
+
+# a1 is now branch head of A, and a topological head
+
+  $ hg clone . inner
+  updating to branch A
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd inner
+  $ hg up B
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo b1 >b1
+  $ hg ci -Amb1
+  adding b1
+
+# 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
+
+glog of local:
+
+  $ hg glog --template "{rev}: {branches} {desc}\n"
+  @  3: A a2
+  |
+  o  2: A a1
+  |
+  | o  1: B b
+  |/
+  o  0: A a
+  
+glog of remote:
+
+  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  @  3: B b1
+  |
+  | o  2: A a1
+  | |
+  o |  1: B b
+  |/
+  o  0: A a
+  
+outgoing:
+
+  $ hg out inner --template "{rev}: {branches} {desc}\n"
+  comparing with inner
+  searching for changes
+  3: A a2
+
+  $ hg push inner
+  pushing to inner
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+
+  $ cd ..
+
+
+Check prepush with new branch head and new child of former branch head
+but child is on different branch:
+
+  $ hg init p
+  $ cd p
+  $ hg branch A
+  marked working directory as branch A
+  $ echo a0 >a
+  $ hg ci -Ama0
+  adding a
+  $ echo a1 >a
+  $ hg ci -ma1
+  $ hg up null
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch B
+  marked working directory as branch B
+  $ echo b0 >b
+  $ hg ci -Amb0
+  adding b
+  $ echo b1 >b
+  $ hg ci -mb1
+
+  $ hg clone . inner
+  updating to branch B
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ hg up A
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch -f B
+  marked working directory as branch B
+  $ echo a3 >a
+  $ hg ci -ma3
+  created new head
+  $ hg up 3
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg branch -f A
+  marked working directory as branch A
+  $ echo b3 >b
+  $ hg ci -mb3
+  created new head
+
+glog of local:
+
+  $ hg glog --template "{rev}: {branches} {desc}\n"
+  @  5: A b3
+  |
+  | o  4: B a3
+  | |
+  o |  3: B b1
+  | |
+  o |  2: B b0
+   /
+  o  1: A a1
+  |
+  o  0: A a0
+  
+glog of remote:
+
+  $ hg glog -R inner --template "{rev}: {branches} {desc}\n"
+  @  3: B b1
+  |
+  o  2: B b0
+  
+  o  1: A a1
+  |
+  o  0: A a0
+  
+outgoing:
+
+  $ hg out inner --template "{rev}: {branches} {desc}\n"
+  comparing with inner
+  searching for changes
+  4: B a3
+  5: A b3
+
+  $ hg push inner
+  pushing to inner
+  searching for changes
+  abort: push creates new remote heads on branch 'A'!
+  (did you forget to merge? use push -f to force)
+
+  $ hg push inner -r4 -r5
+  pushing to inner
+  searching for changes
+  abort: push creates new remote heads on branch 'A'!
+  (did you forget to merge? use push -f to force)
+
+  $ hg in inner
+  comparing with inner
+  searching for changes
+  no changes found
+
+  $ cd ..
+
--- a/tests/test-race	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-mkdir t
-cd t
-hg init
-echo a > a
-hg add a
-hg commit -m test
-
-# do we ever miss a sub-second change?
-for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
-    hg co -qC 0
-    echo b > a
-    hg st
-done
--- a/tests/test-race.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
-M a
--- a/tests/test-rename-after-merge	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-#!/bin/sh
-
-# Test issue 746: renaming files brought by the
-# second parent of a merge was broken.
-
-echo % create source repository
-hg init t
-cd t
-echo a > a
-hg ci -Am a
-cd ..
-
-echo % fork source repository
-hg clone t t2
-cd t2
-echo b > b
-hg ci -Am b
-
-echo % update source repository
-cd ../t
-echo a >> a
-hg ci -m a2
-
-echo % merge repositories
-hg pull ../t2
-hg merge
-hg st
-
-echo % rename b as c
-hg mv b c
-hg st
-echo % rename back c as b
-hg mv c b
-hg st
-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
-echo % test issue 1476
-hg init repo1476
-cd repo1476
-echo a > a
-hg ci -Am adda
-echo b1 > b1
-echo b2 > b2
-hg ci -Am changea
-hg up -C 0
-echo c1 > c1
-echo c2 > c2
-hg ci -Am addcandd
-echo % merge heads
-hg merge
-hg mv -Af c1 c2
-echo % commit issue 1476
-hg ci -m merge
-hg log -r tip -C -v | grep copies
-hg rollback
-hg up -C .
-echo % merge heads again
-hg merge
-hg mv -Af b1 b2
-echo % commit issue 1476 with a rename on the other side
-hg ci -m merge
-hg log -r tip -C -v | grep copies
-
-
-
--- a/tests/test-rename-after-merge.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-% create source repository
-adding a
-% fork source repository
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-adding b
-% update source repository
-% merge repositories
-pulling from ../t2
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-(run 'hg heads' to see heads, 'hg merge' to merge)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-M b
-% rename b as c
-A c
-R b
-% rename back c as b
-M b
-% test issue 1476
-adding a
-adding b1
-adding b2
-0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-adding c1
-adding c2
-created new head
-% merge heads
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% commit issue 1476
-copies:      c2 (c1)
-rolling back to revision 2 (undo commit)
-2 files updated, 0 files merged, 2 files removed, 0 files unresolved
-% merge heads again
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-% commit issue 1476 with a rename on the other side
-copies:      b2 (b1)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-rename-after-merge.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,120 @@
+# Test issue 746: renaming files brought by the
+# second parent of a merge was broken.
+
+Create source repository:
+
+  $ hg init t
+  $ cd t
+  $ echo a > a
+  $ hg ci -Am a
+  adding a
+  $ cd ..
+
+Fork source repository:
+
+  $ hg clone t t2
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd t2
+  $ echo b > b
+  $ hg ci -Am b
+  adding b
+
+Update source repository:
+
+  $ cd ../t
+  $ echo a >> a
+  $ hg ci -m a2
+
+Merge repositories:
+
+  $ hg pull ../t2
+  pulling from ../t2
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg merge
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg st
+  M b
+
+Rename b as c:
+
+  $ hg mv b c
+  $ hg st
+  A c
+  R b
+
+Rename back c as b:
+
+  $ hg mv c b
+  $ hg st
+  M b
+
+  $ 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
+
+  $ hg init repo1476
+  $ cd repo1476
+  $ echo a > a
+  $ hg ci -Am adda
+  adding a
+  $ echo b1 > b1
+  $ echo b2 > b2
+  $ hg ci -Am changea
+  adding b1
+  adding b2
+  $ hg up -C 0
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ echo c1 > c1
+  $ echo c2 > c2
+  $ hg ci -Am addcandd
+  adding c1
+  adding c2
+  created new head
+
+Merge heads:
+
+  $ hg merge
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg mv -Af c1 c2
+
+Commit issue 1476:
+
+  $ hg ci -m merge
+
+  $ hg log -r tip -C -v | grep copies
+  copies:      c2 (c1)
+
+  $ hg rollback
+  rolling back to revision 2 (undo commit)
+
+  $ hg up -C .
+  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
+
+Merge heads again:
+
+  $ hg merge
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+
+  $ hg mv -Af b1 b2
+
+Commit issue 1476 with a rename on the other side:
+
+  $ hg ci -m merge
+
+  $ hg log -r tip -C -v | grep copies
+  copies:      b2 (b1)
+
--- a/tests/test-simple-update	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-set -e
-
-mkdir test
-cd test
-echo foo>foo
-hg init
-hg addremove
-hg commit -m "1"
-hg verify
-
-hg clone . ../branch
-cd ../branch
-hg co
-echo bar>>foo
-hg commit -m "2"
-
-cd ../test
-hg pull ../branch
-hg verify
-hg co
-cat foo
-hg manifest --debug
--- a/tests/test-simple-update.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-adding foo
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 1 changesets, 1 total revisions
-updating to branch default
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-pulling from ../branch
-searching for changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-(run 'hg update' to get a working copy)
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-1 files, 2 changesets, 2 total revisions
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-foo
-bar
-6f4310b00b9a147241b071a60c28a650827fb03d 644   foo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-simple-update.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,54 @@
+  $ set -e
+
+  $ mkdir test
+  $ cd test
+  $ echo foo>foo
+  $ hg init
+  $ hg addremove
+  adding foo
+  $ hg commit -m "1"
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 1 changesets, 1 total revisions
+
+  $ hg clone . ../branch
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd ../branch
+  $ hg co
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bar>>foo
+  $ hg commit -m "2"
+
+  $ cd ../test
+
+  $ hg pull ../branch
+  pulling from ../branch
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  (run 'hg update' to get a working copy)
+
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  1 files, 2 changesets, 2 total revisions
+
+  $ hg co
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cat foo
+  foo
+  bar
+
+  $ hg manifest --debug
+  6f4310b00b9a147241b071a60c28a650827fb03d 644   foo
+
--- a/tests/test-subrepo-recursion.t	Mon Sep 13 01:37:56 2010 +0000
+++ b/tests/test-subrepo-recursion.t	Tue Sep 14 16:21:01 2010 -0500
@@ -6,27 +6,33 @@
 
 Create test repository:
 
-  $ hg init
+  $ hg init repo
+  $ cd repo
   $ echo x1 > x.txt
-  $ hg add x.txt
 
   $ hg init foo
   $ cd foo
   $ echo y1 > y.txt
-  $ hg add y.txt
 
   $ hg init bar
   $ cd bar
   $ echo z1 > z.txt
-  $ hg add z.txt
 
   $ cd ..
   $ echo 'bar = bar' > .hgsub
-  $ hg add .hgsub
 
   $ cd ..
   $ echo 'foo = foo' > .hgsub
-  $ hg add .hgsub
+
+Add files --- .hgsub files must go first to trigger subrepos:
+
+  $ hg add -S .hgsub
+  $ hg add -S foo/.hgsub
+  $ hg add -S foo/bar
+  adding foo/bar/z.txt
+  $ hg add -S
+  adding x.txt
+  adding foo/y.txt
 
 Test recursive status without committing anything:
 
@@ -220,3 +226,98 @@
   @@ -1,1 +1,2 @@
    z1
   +z2
+
+Clone and test outgoing:
+
+  $ cd ..
+  $ hg clone repo repo2
+  updating to branch default
+  pulling subrepo foo from .*/test-subrepo-recursion.t/repo/foo
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 4 changesets with 7 changes to 3 files
+  pulling subrepo foo/bar from .*/test-subrepo-recursion.t/repo/foo/bar
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 3 changes to 1 files
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd repo2
+  $ hg outgoing -S
+  comparing with .*/test-subrepo-recursion.t/repo
+  searching for changes
+  no changes found
+  comparing with .*/test-subrepo-recursion.t/repo/foo
+  searching for changes
+  no changes found
+  $ echo $?
+  0
+
+Make nested change:
+
+  $ echo y4 >> foo/y.txt
+  $ hg diff
+  diff -r 65903cebad86 foo/y.txt
+  --- a/foo/y.txt
+  +++ b/foo/y.txt
+  @@ -1,3 +1,4 @@
+   y1
+   y2
+   y3
+  +y4
+  $ hg commit -m 3-4-2
+  committing subrepository foo
+  $ hg outgoing -S
+  comparing with .*/test-subrepo-recursion.t/repo
+  searching for changes
+  changeset:   3:2655b8ecc4ee
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     3-4-2
+  
+  comparing with .*/test-subrepo-recursion.t/repo/foo
+  searching for changes
+  changeset:   4:e96193d6cb36
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     3-4-2
+  
+
+Switch to original repo and setup default path:
+
+  $ cd ../repo
+  $ echo '[paths]' >> .hg/hgrc
+  $ echo 'default = ../repo2' >> .hg/hgrc
+
+Test incoming:
+
+  $ hg incoming -S
+  comparing with .*/test-subrepo-recursion.t/repo2
+  searching for changes
+  changeset:   3:2655b8ecc4ee
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     3-4-2
+  
+  comparing with .*/test-subrepo-recursion.t/repo2/foo
+  searching for changes
+  changeset:   4:e96193d6cb36
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     3-4-2
+  
+  $ hg incoming -S --bundle incoming.hg
+  abort: cannot combine --bundle and --subrepos
+
+Test missing subrepo:
+
+  $ rm -r foo
+  $ hg status
+  warning: unknown revision '65903cebad86f1a84bd4f1134f62fa7dcb7a1c98' in foo
--- a/tests/test-unrelated-pull	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-mkdir a
-cd a
-hg init
-echo 123 > a
-hg add a
-hg commit -m "a" -u a
-
-cd ..
-mkdir b
-cd b
-hg init
-echo 321 > b
-hg add b
-hg commit -m "b" -u b
-
-hg pull ../a
-hg pull -f ../a
-hg heads
--- a/tests/test-unrelated-pull.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-pulling from ../a
-searching for changes
-abort: repository is unrelated
-pulling from ../a
-searching for changes
-warning: repository is unrelated
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files (+1 heads)
-(run 'hg heads' to see heads, 'hg merge' to merge)
-changeset:   1:9a79c33a9db3
-tag:         tip
-parent:      -1:000000000000
-user:        a
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     a
-
-changeset:   0:01f8062b2de5
-user:        b
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     b
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-unrelated-pull.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,43 @@
+  $ mkdir a
+  $ cd a
+  $ hg init
+  $ echo 123 > a
+  $ hg add a
+  $ hg commit -m "a" -u a
+
+  $ cd ..
+  $ mkdir b
+  $ cd b
+  $ hg init
+  $ echo 321 > b
+  $ hg add b
+  $ hg commit -m "b" -u b
+
+  $ hg pull ../a
+  pulling from ../a
+  searching for changes
+  abort: repository is unrelated
+
+  $ hg pull -f ../a
+  pulling from ../a
+  searching for changes
+  warning: repository is unrelated
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+
+  $ hg heads
+  changeset:   1:9a79c33a9db3
+  tag:         tip
+  parent:      -1:000000000000
+  user:        a
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     a
+  
+  changeset:   0:01f8062b2de5
+  user:        b
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     b
+  
--- a/tests/test-up-issue1456	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-rm -rf a
-hg init a
-cd a
-
-echo foo > foo
-hg ci -qAm0
-chmod +x foo
-hg ci -m1
-hg co -q 0
-echo dirty > foo
-hg up -c
-hg up -q
-cat foo
-hg st -A
-
-echo '% validate update of standalone execute bit change'
-hg up -C 0
-chmod -x foo
-hg ci -m removeexec
-hg up -C 0
-hg up
-hg st
--- a/tests/test-up-issue1456.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-abort: uncommitted local changes
-dirty
-M foo
-% validate update of standalone execute bit change
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-nothing changed
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-update-branches	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-#!/bin/sh
-
-# Construct the following history tree:
-#
-# @  5:e1bb631146ca  b1
-# |
-# o  4:a4fdb3b883c4 0:b608b9236435  b1
-# |
-# | o  3:4b57d2520816 1:44592833ba9f
-# | |
-# | | o  2:063f31070f65
-# | |/
-# | o  1:44592833ba9f
-# |/
-# o  0:b608b9236435
-
-hg init
-echo foo > foo
-echo zero > a
-hg ci -qAm0
-echo one > a ; hg ci -m1
-echo two > a ; hg ci -m2
-hg up -q 1
-echo three > a ; hg ci -qm3
-hg up -q 0
-hg branch -q b1
-echo four > a ; hg ci -qm4
-echo five > a ; hg ci -qm5
-
-echo % initial repo state
-echo
-hg --config 'extensions.graphlog=' \
-    glog --template '{rev}:{node|short} {parents} {branches}\n'
-
-# Test helper functions.
-
-revtest () {
-    msg=$1
-    dirtyflag=$2   # 'clean' or 'dirty'
-    startrev=$3
-    targetrev=$4
-    opt=$5
-    echo % revtest $msg $startrev $targetrev
-    hg up -qC $startrev
-    test $dirtyflag = dirty && echo dirty > foo
-    hg up $opt $targetrev
-    hg parent --template 'parent={rev}\n'
-    hg stat
-}    
-
-norevtest () {
-    msg=$1
-    dirtyflag=$2   # 'clean' or 'dirty'
-    startrev=$3
-    opt=$4
-    echo % norevtest $msg $startrev
-    hg up -qC $startrev
-    test $dirtyflag = dirty && echo dirty > foo
-    hg up $opt
-    hg parent --template 'parent={rev}\n'
-    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.
-
-norevtest 'none clean linear' clean 4
-norevtest 'none clean same'   clean 2
-
-revtest 'none clean linear' clean 1 2
-revtest 'none clean same'   clean 2 3
-revtest 'none clean cross'  clean 3 4
-
-revtest 'none dirty linear' dirty 1 2
-revtest 'none dirty same'   dirty 2 3
-revtest 'none dirty cross'  dirty 3 4
-
-revtest '-C dirty linear'   dirty 1 2 -C
-revtest '-c dirty linear'   dirty 1 2 -c
-norevtest '-c clean same'   clean 2 -c
-revtest '-cC dirty linear'  dirty 1 2 -cC
--- a/tests/test-update-branches.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-% initial repo state
-
-@  5:e1bb631146ca  b1
-|
-o  4:a4fdb3b883c4 0:b608b9236435  b1
-|
-| o  3:4b57d2520816 1:44592833ba9f
-| |
-| | o  2:063f31070f65
-| |/
-| o  1:44592833ba9f
-|/
-o  0:b608b9236435
-
-% norevtest none clean linear 4
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-parent=5
-% norevtest none clean same 2
-abort: crosses branches (use 'hg merge' or use 'hg update -c')
-parent=2
-% revtest none clean linear 1 2
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-parent=2
-% revtest none clean same 2 3
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-parent=3
-% revtest none clean cross 3 4
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-parent=4
-% revtest none dirty linear 1 2
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-parent=2
-M foo
-% revtest none dirty same 2 3
-abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
-parent=2
-M foo
-% revtest none dirty cross 3 4
-abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
-parent=3
-M foo
-% revtest -C dirty linear 1 2
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-parent=2
-% revtest -c dirty linear 1 2
-abort: uncommitted local changes
-parent=1
-M foo
-% norevtest -c clean same 2
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-parent=3
-% revtest -cC dirty linear 1 2
-abort: cannot specify both -c/--check and -C/--clean
-parent=1
-M foo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-update-branches.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,130 @@
+# Construct the following history tree:
+#
+# @  5:e1bb631146ca  b1
+# |
+# o  4:a4fdb3b883c4 0:b608b9236435  b1
+# |
+# | o  3:4b57d2520816 1:44592833ba9f
+# | |
+# | | o  2:063f31070f65
+# | |/
+# | o  1:44592833ba9f
+# |/
+# o  0:b608b9236435
+
+  $ hg init
+  $ echo foo > foo
+  $ echo zero > a
+  $ hg ci -qAm0
+  $ echo one > a ; hg ci -m1
+  $ echo two > a ; hg ci -m2
+  $ hg up -q 1
+  $ echo three > a ; hg ci -qm3
+  $ hg up -q 0
+  $ hg branch -q b1
+  $ echo four > a ; hg ci -qm4
+  $ echo five > a ; hg ci -qm5
+
+Initial repo state:
+
+  $ hg --config 'extensions.graphlog=' \
+  >    glog --template '{rev}:{node|short} {parents} {branches}\n'
+  @  5:e1bb631146ca  b1
+  |
+  o  4:a4fdb3b883c4 0:b608b9236435  b1
+  |
+  | o  3:4b57d2520816 1:44592833ba9f
+  | |
+  | | o  2:063f31070f65
+  | |/
+  | o  1:44592833ba9f
+  |/
+  o  0:b608b9236435
+  
+
+Test helper functions:
+
+  $ revtest () {
+  >     msg=$1
+  >     dirtyflag=$2   # 'clean' or 'dirty'
+  >     startrev=$3
+  >     targetrev=$4
+  >     opt=$5
+  >     hg up -qC $startrev
+  >     test $dirtyflag = dirty && echo dirty > foo
+  >     hg up $opt $targetrev
+  >     hg parent --template 'parent={rev}\n'
+  >     hg stat
+  > }    
+
+  $ norevtest () {
+  >     msg=$1
+  >     dirtyflag=$2   # 'clean' or 'dirty'
+  >     startrev=$3
+  >     opt=$4
+  >     hg up -qC $startrev
+  >     test $dirtyflag = dirty && echo dirty > foo
+  >     hg up $opt
+  >     hg parent --template 'parent={rev}\n'
+  >     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.
+
+  $ norevtest 'none clean linear' clean 4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=5
+
+  $ norevtest 'none clean same'   clean 2
+  abort: crosses branches (use 'hg merge' or use 'hg update -c')
+  parent=2
+
+
+  $ revtest 'none clean linear' clean 1 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+
+  $ revtest 'none clean same'   clean 2 3
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=3
+
+  $ revtest 'none clean cross'  clean 3 4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=4
+
+
+  $ revtest 'none dirty linear' dirty 1 2
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+  M foo
+
+  $ revtest 'none dirty same'   dirty 2 3
+  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+  parent=2
+  M foo
+
+  $ revtest 'none dirty cross'  dirty 3 4
+  abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)
+  parent=3
+  M foo
+
+
+  $ revtest '-C dirty linear'   dirty 1 2 -C
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=2
+
+  $ revtest '-c dirty linear'   dirty 1 2 -c
+  abort: uncommitted local changes
+  parent=1
+  M foo
+
+  $ norevtest '-c clean same'   clean 2 -c
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  parent=3
+
+  $ revtest '-cC dirty linear'  dirty 1 2 -cC
+  abort: cannot specify both -c/--check and -C/--clean
+  parent=1
+  M foo
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-update-issue1456.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,31 @@
+  $ rm -rf a
+  $ hg init a
+  $ cd a
+
+  $ echo foo > foo
+  $ hg ci -qAm0
+  $ chmod +x foo
+  $ hg ci -m1
+  $ hg co -q 0
+  $ echo dirty > foo
+  $ hg up -c
+  abort: uncommitted local changes
+  $ hg up -q
+  $ cat foo
+  dirty
+  $ hg st -A
+  M foo
+
+Validate update of standalone execute bit change:
+
+  $ hg up -C 0
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ chmod -x foo
+  $ hg ci -m removeexec
+  nothing changed
+  $ hg up -C 0
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg up
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg st
+
--- a/tests/test-update-reverse	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-hg init
-touch a
-hg add a
-hg commit -m "Added a"
-
-touch main
-hg add main
-hg commit -m "Added main"
-hg checkout 0
-
-echo Main should be gone
-ls
-
-touch side1
-hg add side1
-hg commit -m "Added side1"
-touch side2
-hg add side2
-hg commit -m "Added side2"
-
-hg log
-
-echo Should have two heads, side2 and main
-hg heads
-
-echo Should show "a side1 side2"
-ls
-
-hg update --debug -C 1
-echo Should only show "a main"
-ls
-
--- a/tests/test-update-reverse.out	Mon Sep 13 01:37:56 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-Main should be gone
-a
-created new head
-changeset:   3:91ebc10ed028
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     Added side2
-
-changeset:   2:b932d7dbb1e1
-parent:      0:c2eda428b523
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     Added side1
-
-changeset:   1:71a760306caf
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     Added main
-
-changeset:   0:c2eda428b523
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     Added a
-
-Should have two heads, side2 and main
-changeset:   3:91ebc10ed028
-tag:         tip
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     Added side2
-
-changeset:   1:71a760306caf
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     Added main
-
-Should show a side1 side2
-a
-side1
-side2
-resolving manifests
- overwrite True partial False
- ancestor 91ebc10ed028+ local 91ebc10ed028+ remote 71a760306caf
- side2: other deleted -> r
- side1: other deleted -> r
- main: remote created -> g
-updating: side1 1/3 files (33.33%)
-removing side1
-updating: side2 2/3 files (66.67%)
-removing side2
-updating: main 3/3 files (100.00%)
-getting main
-1 files updated, 0 files merged, 2 files removed, 0 files unresolved
-Should only show a main
-a
-main
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-update-reverse.t	Tue Sep 14 16:21:01 2010 -0500
@@ -0,0 +1,85 @@
+  $ hg init
+
+  $ touch a
+  $ hg add a
+  $ hg commit -m "Added a"
+
+  $ touch main
+  $ hg add main
+  $ hg commit -m "Added main"
+  $ hg checkout 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
+'main' should be gone:
+
+  $ ls
+  a
+
+  $ touch side1
+  $ hg add side1
+  $ hg commit -m "Added side1"
+  created new head
+  $ touch side2
+  $ hg add side2
+  $ hg commit -m "Added side2"
+
+  $ hg log
+  changeset:   3:91ebc10ed028
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added side2
+  
+  changeset:   2:b932d7dbb1e1
+  parent:      0:c2eda428b523
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added side1
+  
+  changeset:   1:71a760306caf
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added main
+  
+  changeset:   0:c2eda428b523
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added a
+  
+
+  $ hg heads
+  changeset:   3:91ebc10ed028
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added side2
+  
+  changeset:   1:71a760306caf
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Added main
+  
+  $ ls
+  a
+  side1
+  side2
+
+  $ hg update --debug -C 1
+  resolving manifests
+   overwrite True partial False
+   ancestor 91ebc10ed028+ local 91ebc10ed028+ remote 71a760306caf
+   side2: other deleted -> r
+   side1: other deleted -> r
+   main: remote created -> g
+  updating: side1 1/3 files (33.33%)
+  removing side1
+  updating: side2 2/3 files (66.67%)
+  removing side2
+  updating: main 3/3 files (100.00%)
+  getting main
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+
+  $ ls
+  a
+  main
+