changeset 3331:f472cf9a71af

merge with crew
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 11 Oct 2006 16:41:52 +0200
parents 49966b5ab16f (current diff) 319358e6bd96 (diff)
children a5209a1e53d8
files tests/test-merge1.out
diffstat 22 files changed, 357 insertions(+), 459 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Wed Oct 11 16:35:09 2006 +0200
+++ b/mercurial/context.py	Wed Oct 11 16:41:52 2006 +0200
@@ -8,7 +8,7 @@
 from node import *
 from i18n import gettext as _
 from demandload import demandload
-demandload(globals(), "ancestor bdiff repo revlog util")
+demandload(globals(), "ancestor bdiff repo revlog util os")
 
 class changectx(object):
     """A changecontext object makes access to data related to a particular
@@ -191,6 +191,9 @@
     def data(self): return self._filelog.read(self._filenode)
     def renamed(self): return self._filelog.renamed(self._filenode)
     def path(self): return self._path
+    def size(self): return self._filelog.size(self._filerev)
+
+    def cmp(self, text): return self._filelog.cmp(self._filenode, text)
 
     def parents(self):
         p = self._path
@@ -327,7 +330,7 @@
         self._node = None
 
     def __str__(self):
-        return "."
+        return str(self._parents[0]) + "+"
 
     def __nonzero__(self):
         return True
@@ -414,7 +417,9 @@
             self._changectx = workingctx(repo)
             return self._changectx
         elif name == '_repopath':
-            self._repopath = self._repo.dirstate.copied(p) or self._path
+            self._repopath = (self._repo.dirstate.copied(self._path)
+                              or self._path)
+            return self._repopath
         elif name == '_filelog':
             self._filelog = self._repo.file(self._repopath)
             return self._filelog
@@ -425,7 +430,7 @@
         return True
 
     def __str__(self):
-        return "%s@." % self.path()
+        return "%s@%s" % (self.path(), self._changectx)
 
     def filectx(self, fileid):
         '''opens an arbitrary revision of the file without
@@ -449,7 +454,7 @@
         '''return parent filectxs, following copies if necessary'''
         p = self._path
         rp = self._repopath
-        pcl = self._workingctx._parents
+        pcl = self._changectx._parents
         fl = self._filelog
         pl = [ (rp, pcl[0]._manifest.get(rp, nullid), fl) ]
         if len(pcl) > 1:
@@ -463,3 +468,6 @@
     def children(self):
         return []
 
+    def size(self): return os.stat(self._repo.wjoin(self._path)).st_size
+
+    def cmp(self, text): return self._repo.wread(self._path) == text
--- a/mercurial/hg.py	Wed Oct 11 16:35:09 2006 +0200
+++ b/mercurial/hg.py	Wed Oct 11 16:41:52 2006 +0200
@@ -201,30 +201,55 @@
             dest_lock.release()
 
         if update:
-            _merge.update(dest_repo, dest_repo.changelog.tip())
+            _update(dest_repo, dest_repo.changelog.tip())
     if dir_cleanup:
         dir_cleanup.close()
 
     return src_repo, dest_repo
 
+def _showstats(repo, stats):
+    stats = ((stats[0], _("updated")),
+             (stats[1], _("merged")),
+             (stats[2], _("removed")),
+             (stats[3], _("unresolved")))
+    note = ", ".join([_("%d files %s") % s for s in stats])
+    repo.ui.status("%s\n" % note)
+
+def _update(repo, node): return update(repo, node)
+
 def update(repo, node):
     """update the working directory to node, merging linear changes"""
-    return _merge.update(repo, node)
+    stats = _merge.update(repo, node, False, False, None, None)
+    _showstats(repo, stats)
+    if stats[3]:
+        repo.ui.status(_("There are unresolved merges with"
+                         " locally modified files.\n"))
+    return stats[3]
 
 def clean(repo, node, wlock=None, show_stats=True):
     """forcibly switch the working directory to node, clobbering changes"""
-    return _merge.update(repo, node, force=True, wlock=wlock,
-                         show_stats=show_stats)
+    stats = _merge.update(repo, node, False, True, None, wlock)
+    if show_stats: _showstats(repo, stats)
+    return stats[3]
 
 def merge(repo, node, force=None, remind=True, wlock=None):
     """branch merge with node, resolving changes"""
-    return _merge.update(repo, node, branchmerge=True, force=force,
-                         remind=remind, wlock=wlock)
+    stats = _merge.update(repo, node, True, force, False, wlock)
+    _showstats(repo, stats)
+    if stats[3]:
+        pl = repo.parents()
+        repo.ui.status(_("There are unresolved merges,"
+                         " you can redo the full merge using:\n"
+                         "  hg update -C %s\n"
+                         "  hg merge %s\n"
+                         % (pl[0].rev(), pl[1].rev())))
+    elif remind:
+        repo.ui.status(_("(branch merge, don't forget to commit)\n"))
+    return stats[3]
 
 def revert(repo, node, choose, wlock):
     """revert changes to revision in node without updating dirstate"""
-    return _merge.update(repo, node, force=True, partial=choose,
-                         show_stats=False, wlock=wlock)
+    return _merge.update(repo, node, False, True, choose, wlock)[3]
 
 def verify(repo):
     """verify the consistency of a repository"""
--- a/mercurial/hgweb/hgweb_mod.py	Wed Oct 11 16:35:09 2006 +0200
+++ b/mercurial/hgweb/hgweb_mod.py	Wed Oct 11 16:41:52 2006 +0200
@@ -59,12 +59,6 @@
             if i in allowed or self.repo.ui.configbool("web", "allow" + i):
                 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
 
-    def listfiles(self, files, mf):
-        for f in files[:self.maxfiles]:
-            yield self.t("filenodelink", node=hex(mf[f]), file=f)
-        if len(files) > self.maxfiles:
-            yield self.t("fileellipses")
-
     def listfilediffs(self, files, changeset):
         for f in files[:self.maxfiles]:
             yield self.t("filedifflink", node=hex(changeset), file=f)
@@ -436,9 +430,9 @@
                     continue
 
                 yield {"file": full,
-                       "filenode": hex(fnode),
                        "parity": self.stripes(parity),
                        "basename": f,
+                       "size": ctx.filectx(full).size(),
                        "permissions": mf.execf(full)}
                 parity += 1
 
@@ -653,38 +647,31 @@
                 def firstitem(query):
                     return query.split('&', 1)[0].split(';', 1)[0]
 
-                root = req.env.get('REQUEST_URI', '').split('?', 1)[0]
-                pi = req.env.get('PATH_INFO', '')
-                if pi:
-                    root = root[:-len(pi)]
-                
-                if req.env.has_key('REPO_NAME'):
-                    base = '/' + req.env['REPO_NAME']
-                else:
-                    base = root
+                def normurl(url):
+                    inner = '/'.join([x for x in url.split('/') if x])
+                    tl = len(url) > 1 and url.endswith('/') and '/' or ''
 
+                    return '%s%s%s' % (url.startswith('/') and '/' or '',
+                                       inner, tl)
+
+                root = normurl(req.env.get('REQUEST_URI', '').split('?', 1)[0])
+                pi = normurl(req.env.get('PATH_INFO', ''))
                 if pi:
-                    while pi.startswith('//'):
-                        pi = pi[1:]
-                    if pi.startswith(base):
-                        if len(pi) > len(base):
-                            base += '/'
-                            query = pi[len(base):]
-                        else:
-                            if req.env.has_key('REPO_NAME'):
-                                # We are using hgwebdir
-                                base += '/'
-                            else:
-                                base += '?'
-                            query = firstitem(req.env['QUERY_STRING'])
+                    # strip leading /
+                    pi = pi[1:]
+                    if pi:
+                        root = root[:-len(pi)]
+                    if req.env.has_key('REPO_NAME'):
+                        rn = req.env['REPO_NAME'] + '/'
+                        root += rn
+                        query = pi[len(rn):]
                     else:
-                        base += '/'
-                        query = pi[1:]
+                        query = pi
                 else:
-                    base += '?'
+                    root += '?'
                     query = firstitem(req.env['QUERY_STRING'])
 
-                return (root + base, query)
+                return (root, query)
 
             req.url, query = spliturl(req)
 
--- a/mercurial/hgweb/hgwebdir_mod.py	Wed Oct 11 16:35:09 2006 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Oct 11 16:41:52 2006 +0200
@@ -69,13 +69,18 @@
         def footer(**map):
             yield tmpl("footer", motd=self.motd, **map)
 
+        url = req.env['REQUEST_URI'].split('?')[0]
+        if not url.endswith('/'):
+            url += '/'
+
         style = self.style
         if req.form.has_key('style'):
             style = req.form['style'][0]
         mapfile = style_map(templater.templatepath(), style)
         tmpl = templater.templater(mapfile, templater.common_filters,
                                    defaults={"header": header,
-                                             "footer": footer})
+                                             "footer": footer,
+                                             "url": url})
 
         def archivelist(ui, nodeid, url):
             allowed = ui.configlist("web", "allow_archive")
--- a/mercurial/localrepo.py	Wed Oct 11 16:35:09 2006 +0200
+++ b/mercurial/localrepo.py	Wed Oct 11 16:41:52 2006 +0200
@@ -461,20 +461,18 @@
                             self.wreload,
                             desc=_('working directory of %s') % self.origroot)
 
-    def checkfilemerge(self, filename, text, filelog, manifest1, manifest2):
+    def filecommit(self, fn, manifest1, manifest2, linkrev, transaction, changelist):
         """
-        Determine whether a new filenode is needed and what parent
-        and rename information is needed for a file commit.
+        commit an individual file as part of a larger transaction
+        """
 
-        Returns (old entry, file parent 1, file parent 2, metadata)
-
-        If old entry is not None, a commit is not needed.
-        """
-        fp1 = manifest1.get(filename, nullid)
-        fp2 = manifest2.get(filename, nullid)
+        t = self.wread(fn)
+        fl = self.file(fn)
+        fp1 = manifest1.get(fn, nullid)
+        fp2 = manifest2.get(fn, nullid)
 
         meta = {}
-        cp = self.dirstate.copied(filename)
+        cp = self.dirstate.copied(fn)
         if cp:
             meta["copy"] = cp
             if not manifest2: # not a branch merge
@@ -486,21 +484,22 @@
                 meta["copyrev"] = hex(manifest2.get(cp))
                 fp2 = nullid
             self.ui.debug(_(" %s: copy %s:%s\n") %
-                          (filename, cp, meta["copyrev"]))
+                          (fn, cp, meta["copyrev"]))
             fp1 = nullid
         elif fp2 != nullid:
             # is one parent an ancestor of the other?
-            fpa = filelog.ancestor(fp1, fp2)
+            fpa = fl.ancestor(fp1, fp2)
             if fpa == fp1:
                 fp1, fp2 = fp2, nullid
             elif fpa == fp2:
                 fp2 = nullid
 
             # is the file unmodified from the parent? report existing entry
-            if fp2 == nullid and not filelog.cmp(fp1, text):
-                return (fp1, None, None, {})
+            if fp2 == nullid and not fl.cmp(fp1, t):
+                return fp1
 
-        return (None, fp1, fp2, meta)
+        changelist.append(fn)
+        return fl.add(t, meta, transaction, linkrev, fp1, fp2)
 
     def rawcommit(self, files, text, user, date, p1=None, p2=None, wlock=None):
         orig_parent = self.dirstate.parents()[0] or nullid
@@ -524,19 +523,8 @@
         linkrev = self.changelog.count()
         for f in files:
             try:
-                t = self.wread(f)
+                m1[f] = self.filecommit(f, m1, m2, linkrev, tr, changed)
                 m1.set(f, util.is_exec(self.wjoin(f), m1.execf(f)))
-                r = self.file(f)
-
-                entry, fp1, fp2, meta = self.checkfilemerge(f, t, r, m1, m2)
-                if entry:
-                    m1[f] = entry
-                    continue
-
-                m1[f] = r.add(t, meta, tr, linkrev, fp1, fp2)
-                changed.append(f)
-                if update_dirstate:
-                    self.dirstate.update([f], "n")
             except IOError:
                 try:
                     del m1[f]
@@ -603,31 +591,18 @@
         for f in commit:
             self.ui.note(f + "\n")
             try:
+                new[f] = self.filecommit(f, m1, m2, linkrev, tr, changed)
                 m1.set(f, util.is_exec(self.wjoin(f), m1.execf(f)))
-                t = self.wread(f)
             except IOError:
                 self.ui.warn(_("trouble committing %s!\n") % f)
                 raise
 
-            r = self.file(f)
-
-            entry, fp1, fp2, meta = self.checkfilemerge(f, t, r, m1, m2)
-            if entry:
-                new[f] = entry
-                continue
-
-            new[f] = r.add(t, meta, tr, linkrev, fp1, fp2)
-            # remember what we've added so that we can later calculate
-            # the files to pull from a set of changesets
-            changed.append(f)
-
         # update manifest
         m1.update(new)
         for f in remove:
             if f in m1:
                 del m1[f]
-        mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0],
-                               (new, remove))
+        mn = self.manifest.add(m1, tr, linkrev, c1[0], c2[0], (new, remove))
 
         # add changeset
         new = new.keys()
--- a/mercurial/merge.py	Wed Oct 11 16:35:09 2006 +0200
+++ b/mercurial/merge.py	Wed Oct 11 16:41:52 2006 +0200
@@ -10,20 +10,12 @@
 from demandload import *
 demandload(globals(), "errno util os tempfile")
 
-def filemerge(repo, fw, fo, fd, my, other, p1, p2, move):
+def filemerge(repo, fw, fo, wctx, mctx):
     """perform a 3-way merge in the working directory
 
-    fw = filename in the working directory and first parent
+    fw = filename in the working directory
     fo = filename in other parent
-    fd = destination filename
-    my = fileid in first parent
-    other = fileid in second parent
-    p1, p2 = hex changeset ids for merge command
-    move = whether to move or copy the file to the destination
-
-    TODO:
-      if fw is copied in the working directory, we get confused
-      implement move and fd
+    wctx, mctx = working and merge changecontexts
     """
 
     def temp(prefix, ctx):
@@ -34,8 +26,12 @@
         f.close()
         return name
 
-    fcm = repo.filectx(fw, fileid=my)
-    fco = repo.filectx(fo, fileid=other)
+    fcm = wctx.filectx(fw)
+    fco = mctx.filectx(fo)
+
+    if not fco.cmp(fcm.data()): # files identical?
+        return 0
+
     fca = fcm.ancestor(fco)
     if not fca:
         fca = repo.filectx(fw, fileid=-1)
@@ -43,40 +39,36 @@
     b = temp("base", fca)
     c = temp("other", fco)
 
-    repo.ui.note(_("resolving %s\n") % fw)
+    if fw != fo:
+        repo.ui.status(_("merging %s and %s\n") % (fw, fo))
+    else:
+        repo.ui.status(_("merging %s\n") % fw)
+
     repo.ui.debug(_("my %s other %s ancestor %s\n") % (fcm, fco, fca))
 
     cmd = (os.environ.get("HGMERGE") or repo.ui.config("ui", "merge")
            or "hgmerge")
     r = util.system('%s "%s" "%s" "%s"' % (cmd, a, b, c), cwd=repo.root,
                     environ={'HG_FILE': fw,
-                             'HG_MY_NODE': p1,
-                             'HG_OTHER_NODE': p2})
+                             'HG_MY_NODE': str(wctx.parents()[0]),
+                             'HG_OTHER_NODE': str(mctx)})
     if r:
         repo.ui.warn(_("merging %s failed!\n") % fw)
-    else:
-        if fd != fw:
-            repo.ui.debug(_("copying %s to %s\n") % (fw, fd))
-            repo.wwrite(fd, repo.wread(fw))
-            if move:
-                repo.ui.debug(_("removing %s\n") % fw)
-                os.unlink(a)
 
     os.unlink(b)
     os.unlink(c)
     return r
 
-def checkunknown(repo, m2, wctx):
-    """
-    check for collisions between unknown files and files in m2
-    """
+def checkunknown(wctx, mctx):
+    "check for collisions between unknown files and files in mctx"
+    man = mctx.manifest()
     for f in wctx.unknown():
-        if f in m2:
-            if repo.file(f).cmp(m2[f], repo.wread(f)):
+        if f in man:
+            if mctx.filectx(f).cmp(wctx.filectx(f).data()):
                 raise util.Abort(_("'%s' already exists in the working"
                                    " dir and differs from remote") % f)
 
-def forgetremoved(m2, wctx):
+def forgetremoved(wctx, mctx):
     """
     Forget removed files
 
@@ -88,17 +80,15 @@
     """
 
     action = []
-
+    man = mctx.manifest()
     for f in wctx.deleted() + wctx.removed():
-        if f not in m2:
+        if f not in man:
             action.append((f, "f"))
 
     return action
 
 def nonoverlap(d1, d2):
-    """
-    Return list of elements in d1 not in d2
-    """
+    "Return list of elements in d1 not in d2"
 
     l = []
     for d in d1:
@@ -109,9 +99,7 @@
     return l
 
 def findold(fctx, limit):
-    """
-    find files that path was copied from, back to linkrev limit
-    """
+    "find files that path was copied from, back to linkrev limit"
 
     old = {}
     orig = fctx.path()
@@ -174,10 +162,24 @@
 
     return copy
 
-def manifestmerge(ui, m1, m2, ma, copy, overwrite, backwards, partial):
+def manifestmerge(repo, p1, p2, pa, overwrite, partial):
+    """
+    Merge p1 and p2 with ancestor ma and generate merge action list
+
+    overwrite = whether we clobber working files
+    partial = function to filter file lists
     """
-    Merge manifest m1 with m2 using ancestor ma and generate merge action list
-    """
+
+    repo.ui.note(_("resolving manifests\n"))
+    repo.ui.debug(_(" overwrite %s partial %s\n") % (overwrite, bool(partial)))
+    repo.ui.debug(_(" ancestor %s local %s remote %s\n") % (pa, p1, p2))
+
+    m1 = p1.manifest()
+    m2 = p2.manifest()
+    ma = pa.manifest()
+    backwards = (pa == p2)
+    action = []
+    copy = {}
 
     def fmerge(f, f2=None, fa=None):
         """merge executable flags"""
@@ -187,11 +189,12 @@
         a, b, c = ma.execf(fa), m1.execf(f), m2.execf(f2)
         return ((a^b) | (a^c)) ^ a
 
-    action = []
+    def act(msg, m, f, *args):
+        repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
+        action.append((f, m) + args)
 
-    def act(msg, f, m, *args):
-        ui.debug(" %s: %s -> %s\n" % (f, msg, m))
-        action.append((f, m) + args)
+    if not (backwards or overwrite):
+        copy = findcopies(repo, m1, m2, pa.rev())
 
     # Compare manifests
     for f, n in m1.iteritems():
@@ -203,43 +206,42 @@
                 a = ma.get(f, nullid)
                 # are both different from the ancestor?
                 if not overwrite and n != a and m2[f] != a:
-                    act("versions differ", f, "m", fmerge(f), n[:20], m2[f])
+                    act("versions differ", "m", f, f, f, fmerge(f), False)
                 # are we clobbering?
                 # is remote's version newer?
                 # or are we going back in time and clean?
                 elif overwrite or m2[f] != a or (backwards and not n[20:]):
-                    act("remote is newer", f, "g", m2.execf(f), m2[f])
+                    act("remote is newer", "g", f, m2.execf(f))
                 # local is newer, not overwrite, check mode bits
                 elif fmerge(f) != m1.execf(f):
-                    act("update permissions", f, "e", m2.execf(f))
+                    act("update permissions", "e", f, m2.execf(f))
             # contents same, check mode bits
             elif m1.execf(f) != m2.execf(f):
                 if overwrite or fmerge(f) != m1.execf(f):
-                    act("update permissions", f, "e", m2.execf(f))
+                    act("update permissions", "e", f, m2.execf(f))
         elif f in copy:
             f2 = copy[f]
             if f in ma: # case 3,20 A/B/A
-                act("remote moved",
-                    f, "c", f2, f2, m1[f], m2[f2], fmerge(f, f2, f), True)
+                act("remote moved", "m", f, f2, f2, fmerge(f, f2, f), True)
             else:
                 if f2 in m1: # case 2 A,B/B/B
-                    act("local copied",
-                        f, "c", f2, f, m1[f], m2[f2], fmerge(f, f2, f2), False)
+                    act("local copied", "m",
+                        f, f2, f, fmerge(f, f2, f2), False)
                 else: # case 4,21 A/B/B
-                    act("local moved",
-                        f, "c", f2, f, m1[f], m2[f2], fmerge(f, f2, f2), False)
+                    act("local moved", "m",
+                        f, f2, f, fmerge(f, f2, f2), False)
         elif f in ma:
             if n != ma[f] and not overwrite:
-                if ui.prompt(
+                if repo.ui.prompt(
                     (_(" local changed %s which remote deleted\n") % f) +
                     _("(k)eep or (d)elete?"), _("[kd]"), _("k")) == _("d"):
-                    act("prompt delete", f, "r")
+                    act("prompt delete", "r", f)
             else:
-                act("other deleted", f, "r")
+                act("other deleted", "r", f)
         else:
             # file is created on branch or in working directory
             if (overwrite and n[20:] != "u") or (backwards and not n[20:]):
-                act("remote deleted", f, "r")
+                act("remote deleted", "r", f)
 
     for f, n in m2.iteritems():
         if partial and not partial(f):
@@ -251,22 +253,23 @@
             if f2 not in m2: # already seen
                 continue
             # rename case 1, A/A,B/A
-            act("remote copied",
-                f2, "c", f, f, m1[f2], m2[f], fmerge(f2, f, f2), False)
+            act("remote copied", "m", f2, f, f, fmerge(f2, f, f2), False)
         elif f in ma:
             if overwrite or backwards:
-                act("recreating", f, "g", m2.execf(f), n)
+                act("recreating", "g", f, m2.execf(f))
             elif n != ma[f]:
-                if ui.prompt(
+                if repo.ui.prompt(
                     (_("remote changed %s which local deleted\n") % f) +
                     _("(k)eep or (d)elete?"), _("[kd]"), _("k")) == _("k"):
-                    act("prompt recreating", f, "g", m2.execf(f), n)
+                    act("prompt recreating", "g", f, m2.execf(f))
         else:
-            act("remote created", f, "g", m2.execf(f), n)
+            act("remote created", "g", f, m2.execf(f))
 
     return action
 
-def applyupdates(repo, action, xp1, xp2):
+def applyupdates(repo, action, wctx, mctx):
+    "apply the merge action list to the working directory"
+
     updated, merged, removed, unresolved = 0, 0, 0, 0
     action.sort()
     for a in action:
@@ -283,34 +286,35 @@
                     repo.ui.warn(_("update failed to remove %s: %s!\n") %
                                  (f, inst.strerror))
             removed +=1
-        elif m == "c": # copy
-            f2, fd, my, other, flag, move = a[2:]
-            repo.ui.status(_("merging %s and %s to %s\n") % (f, f2, fd))
-            if filemerge(repo, f, f2, fd, my, other, xp1, xp2, move):
+        elif m == "m": # merge
+            f2, fd, flag, move = a[2:]
+            if filemerge(repo, f, f2, wctx, mctx):
                 unresolved += 1
+            else:
+                merged += 1
+                if f != fd:
+                    repo.ui.debug(_("copying %s to %s\n") % (f, fd))
+                    repo.wwrite(fd, repo.wread(f))
+                    if move:
+                        repo.ui.debug(_("removing %s\n") % f)
+                        os.unlink(repo.wjoin(f))
             util.set_exec(repo.wjoin(fd), flag)
-            merged += 1
-        elif m == "m": # merge
-            flag, my, other = a[2:]
-            repo.ui.status(_("merging %s\n") % f)
-            if filemerge(repo, f, f, f, my, other, xp1, xp2, False):
-                unresolved += 1
-            util.set_exec(repo.wjoin(f), flag)
-            merged += 1
         elif m == "g": # get
-            flag, node = a[2:]
+            flag = a[2]
             repo.ui.note(_("getting %s\n") % f)
-            t = repo.file(f).read(node)
+            t = mctx.filectx(f).data()
             repo.wwrite(f, t)
             util.set_exec(repo.wjoin(f), flag)
             updated += 1
         elif m == "e": # exec
-            flag = a[2:]
+            flag = a[2]
             util.set_exec(repo.wjoin(f), flag)
 
     return updated, merged, removed, unresolved
 
-def recordupdates(repo, action, branchmerge):
+def recordupdates(repo, action, branchmerge, mctx):
+    "record merge actions to the dirstate"
+
     for a in action:
         f, m = a[:2]
         if m == "r": # remove
@@ -326,22 +330,7 @@
             else:
                 repo.dirstate.update([f], 'n')
         elif m == "m": # merge
-            flag, my, other = a[2:]
-            if branchmerge:
-                # We've done a branch merge, mark this file as merged
-                # so that we properly record the merger later
-                repo.dirstate.update([f], 'm')
-            else:
-                # We've update-merged a locally modified file, so
-                # we set the dirstate to emulate a normal checkout
-                # of that file some time in the past. Thus our
-                # merge will appear as a normal local file
-                # modification.
-                fl = repo.file(f)
-                f_len = fl.size(fl.rev(other))
-                repo.dirstate.update([f], 'n', st_size=f_len, st_mtime=-1)
-        elif m == "c": # copy
-            f2, fd, my, other, flag, move = a[2:]
+            f2, fd, flag, move = a[2:]
             if branchmerge:
                 # We've done a branch merge, mark this file as merged
                 # so that we properly record the merger later
@@ -352,114 +341,71 @@
                 # of that file some time in the past. Thus our
                 # merge will appear as a normal local file
                 # modification.
-                fl = repo.file(f)
-                f_len = fl.size(fl.rev(other))
+                f_len = mctx.filectx(f).size()
                 repo.dirstate.update([fd], 'n', st_size=f_len, st_mtime=-1)
-            if move:
-                repo.dirstate.update([f], 'r')
-            if f != fd:
-                repo.dirstate.copy(f, fd)
-            else:
-                repo.dirstate.copy(f2, fd)
+            if f != f2: # copy/rename
+                if move:
+                    repo.dirstate.update([f], 'r')
+                if f != fd:
+                    repo.dirstate.copy(f, fd)
+                else:
+                    repo.dirstate.copy(f2, fd)
 
-def update(repo, node, branchmerge=False, force=False, partial=None,
-           wlock=None, show_stats=True, remind=True):
+def update(repo, node, branchmerge, force, partial, wlock):
+    """
+    Perform a merge between the working directory and the given node
 
-    overwrite = force and not branchmerge
-    forcemerge = force and branchmerge
+    branchmerge = whether to merge between branches
+    force = whether to force branch merging or file overwriting
+    partial = a function to filter file lists (dirstate not updated)
+    wlock = working dir lock, if already held
+    """
 
     if not wlock:
         wlock = repo.wlock()
 
-    ### check phase
-
+    overwrite = force and not branchmerge
+    forcemerge = force and branchmerge
     wc = repo.workingctx()
     pl = wc.parents()
+    p1, p2 = pl[0], repo.changectx(node)
+    pa = p1.ancestor(p2)
+    fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
+
+    ### check phase
     if not overwrite and len(pl) > 1:
         raise util.Abort(_("outstanding uncommitted merges"))
-
-    p1, p2 = pl[0], repo.changectx(node)
-    pa = p1.ancestor(p2)
-
-    # are we going backwards?
-    backwards = (pa == p2)
-
-    # is there a linear path from p1 to p2?
-    if pa == p1 or pa == p2:
+    if pa == p1 or pa == p2: # is there a linear path from p1 to p2?
         if branchmerge:
             raise util.Abort(_("there is nothing to merge, just use "
                                "'hg update' or look at 'hg heads'"))
     elif not (overwrite or branchmerge):
         raise util.Abort(_("update spans branches, use 'hg merge' "
                            "or 'hg update -C' to lose changes"))
-
     if branchmerge and not forcemerge:
         if wc.modified() or wc.added() or wc.removed():
             raise util.Abort(_("outstanding uncommitted changes"))
 
-    m1 = wc.manifest()
-    m2 = p2.manifest()
-    ma = pa.manifest()
-
-    # resolve the manifest to determine which files
-    # we care about merging
-    repo.ui.note(_("resolving manifests\n"))
-    repo.ui.debug(_(" overwrite %s branchmerge %s partial %s\n") %
-                  (overwrite, branchmerge, bool(partial)))
-    repo.ui.debug(_(" ancestor %s local %s remote %s\n") % (p1, p2, pa))
-
+    ### calculate phase
     action = []
-    copy = {}
-
     if not force:
-        checkunknown(repo, m2, wc)
+        checkunknown(wc, p2)
     if not branchmerge:
-        action += forgetremoved(m2, wc)
-    if not (backwards or overwrite):
-        copy = findcopies(repo, m1, m2, pa.rev())
-
-    action += manifestmerge(repo.ui, m1, m2, ma, copy,
-                            overwrite, backwards, partial)
+        action += forgetremoved(wc, p2)
+    action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
 
     ### apply phase
-
-    if not branchmerge:
-        # we don't need to do any magic, just jump to the new rev
-        p1, p2 = p2, repo.changectx(nullid)
-
-    xp1, xp2 = str(p1), str(p2)
-    if not p2: xp2 = ''
+    if not branchmerge: # just jump to the new rev
+        fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
+    if not partial:
+        repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
 
-    repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
-
-    updated, merged, removed, unresolved = applyupdates(repo, action, xp1, xp2)
-
-    # update dirstate
-    if not partial:
-        recordupdates(repo, action, branchmerge)
-        repo.dirstate.setparents(p1.node(), p2.node())
+    stats = applyupdates(repo, action, wc, p2)
 
-    if show_stats:
-        stats = ((updated, _("updated")),
-                 (merged - unresolved, _("merged")),
-                 (removed, _("removed")),
-                 (unresolved, _("unresolved")))
-        note = ", ".join([_("%d files %s") % s for s in stats])
-        repo.ui.status("%s\n" % note)
     if not partial:
-        if branchmerge:
-            if unresolved:
-                repo.ui.status(_("There are unresolved merges,"
-                                " you can redo the full merge using:\n"
-                                "  hg update -C %s\n"
-                                "  hg merge %s\n"
-                                % (p1.rev(), p2.rev())))
-            elif remind:
-                repo.ui.status(_("(branch merge, don't forget to commit)\n"))
-        elif unresolved:
-            repo.ui.status(_("There are unresolved merges with"
-                             " locally modified files.\n"))
+        recordupdates(repo, action, branchmerge, p2)
+        repo.dirstate.setparents(fp1, fp2)
+        repo.hook('update', parent1=xp1, parent2=xp2, error=stats[3])
 
-    repo.hook('update', parent1=xp1, parent2=xp2, error=unresolved)
-    return unresolved
+    return stats
 
--- a/mercurial/patch.py	Wed Oct 11 16:35:09 2006 +0200
+++ b/mercurial/patch.py	Wed Oct 11 16:41:52 2006 +0200
@@ -467,6 +467,7 @@
         to = None
         tn = None
         dodiff = True
+        header = []
         if f in mmap:
             to = getfile(f).read(mmap[f])
         if f not in removed:
@@ -480,7 +481,6 @@
                     header.append('new mode %s\n' % nmode)
 
             a, b = f, f
-            header = []
             if f in added:
                 if node2:
                     mode = gitmode(mmap2.execf(f))
@@ -510,11 +510,12 @@
                     nmode = gitmode(util.is_exec(repo.wjoin(f), mmap.execf(f)))
                 addmodehdr(header, omode, nmode)
             r = None
-            if dodiff:
-                header.insert(0, 'diff --git a/%s b/%s\n' % (a, b))
+            header.insert(0, 'diff --git a/%s b/%s\n' % (a, b))
+        if dodiff:
+            text = mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts)
+            if text or len(header) > 1:
                 fp.write(''.join(header))
-        if dodiff:
-            fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, opts=opts))
+            fp.write(text)
 
 def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False,
            opts=None):
--- a/templates/gitweb/manifest.tmpl	Wed Oct 11 16:35:09 2006 +0200
+++ b/templates/gitweb/manifest.tmpl	Wed Oct 11 16:41:52 2006 +0200
@@ -23,6 +23,7 @@
 <table cellspacing="0">
 <tr class="light">
 <td style="font-family:monospace">drwxr-xr-x</td>
+<td style="font-family:monospace"></td>
 <td><a href="{url}file/#node|short##up|urlescape#{getentries}">[up]</a></td>
 <td class="link">&nbsp;</td>
 </tr>
--- a/templates/gitweb/map	Wed Oct 11 16:35:09 2006 +0200
+++ b/templates/gitweb/map	Wed Oct 11 16:41:52 2006 +0200
@@ -14,8 +14,8 @@
 searchentry = changelogentry.tmpl
 changeset = changeset.tmpl
 manifest = manifest.tmpl
-manifestdirentry = '<tr class="parity#parity#"><td style="font-family:monospace">drwxr-xr-x</td><td><a href="#url#file/#node|short##path|urlescape#{getentries}">#basename|escape#/</a></td><td class="link"><a href="#url#file/#node|short##path|urlescape#{getentries}">manifest</a></td></tr>'
-manifestfileentry = '<tr class="parity#parity#"><td style="font-family:monospace">#permissions|permissions#</td><td class="list"><a class="list" href="#url#file/#node|short#/#file|urlescape#{getentries}">#basename|escape#</a></td><td class="link"><a href="#url#file/#node|short#/#file|urlescape#{getentries}">file</a> | <a href="#url#log/#node|short#/#file|urlescape#{getentries}">revisions</a> | <a href="#url#annotate/#node|short#/#file|urlescape#{getentries}">annotate</a></td></tr>'
+manifestdirentry = '<tr class="parity#parity#"><td style="font-family:monospace">drwxr-xr-x</td><td style="font-family:monospace"></td><td><a href="#url#file/#node|short##path|urlescape#{getentries}">#basename|escape#/</a></td><td class="link"><a href="#url#file/#node|short##path|urlescape#{getentries}">manifest</a></td></tr>'
+manifestfileentry = '<tr class="parity#parity#"><td style="font-family:monospace">#permissions|permissions#</td><td style="font-family:monospace" align=right>#size#</td><td class="list"><a class="list" href="#url#file/#node|short#/#file|urlescape#{getentries}">#basename|escape#</a></td><td class="link"><a href="#url#file/#node|short#/#file|urlescape#{getentries}">file</a> | <a href="#url#log/#node|short#/#file|urlescape#{getentries}">revisions</a> | <a href="#url#annotate/#node|short#/#file|urlescape#{getentries}">annotate</a></td></tr>'
 filerevision = filerevision.tmpl
 fileannotate = fileannotate.tmpl
 filelog = filelog.tmpl
--- a/templates/manifest.tmpl	Wed Oct 11 16:35:09 2006 +0200
+++ b/templates/manifest.tmpl	Wed Oct 11 16:41:52 2006 +0200
@@ -16,7 +16,9 @@
 <table cellpadding="0" cellspacing="0">
 <tr class="parity1">
   <td><tt>drwxr-xr-x</tt>&nbsp;
+  <td>&nbsp;
   <td><a href="#url#file/#node|short##up|urlescape#{getentries}">[up]</a>
+</tr>
 #dentries%manifestdirentry#
 #fentries%manifestfileentry#
 </table>
--- a/templates/map	Wed Oct 11 16:35:09 2006 +0200
+++ b/templates/map	Wed Oct 11 16:41:52 2006 +0200
@@ -14,8 +14,8 @@
 searchentry = changelogentry.tmpl
 changeset = changeset.tmpl
 manifest = manifest.tmpl
-manifestdirentry = '<tr class="parity#parity#"><td><tt>drwxr-xr-x</tt>&nbsp;<td><a href="#url#file/#node|short##path|urlescape#{getentries}">#basename|escape#/</a>'
-manifestfileentry = '<tr class="parity#parity#"><td><tt>#permissions|permissions#</tt>&nbsp;<td><a href="#url#file/#node|short#/#file|urlescape#{getentries}">#basename|escape#</a>'
+manifestdirentry = '<tr class="parity#parity#"><td><tt>drwxr-xr-x</tt>&nbsp;<td>&nbsp;<td><a href="#url#file/#node|short##path|urlescape#{getentries}">#basename|escape#/</a>'
+manifestfileentry = '<tr class="parity#parity#"><td><tt>#permissions|permissions#</tt>&nbsp;<td align=right><tt>#size#</tt>&nbsp;<td><a href="#url#file/#node|short#/#file|urlescape#{getentries}">#basename|escape#</a>'
 filerevision = filerevision.tmpl
 fileannotate = fileannotate.tmpl
 filediff = filediff.tmpl
--- a/tests/run-tests.py	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/run-tests.py	Wed Oct 11 16:41:52 2006 +0200
@@ -32,6 +32,11 @@
     help="print a test coverage report inc. standard libraries")
 parser.add_option("-C", "--annotate", action="store_true",
     help="output files annotated with coverage")
+parser.add_option("-r", "--retest", action="store_true",
+    help="retest failed tests")
+parser.add_option("-f", "--first", action="store_true",
+    help="exit on the first test failure")
+
 parser.set_defaults(timeout=180)
 (options, args) = parser.parse_args()
 verbose = options.verbose
@@ -360,11 +365,16 @@
             if (test.startswith("test-") and '~' not in test and
                 ('.' not in test or test.endswith('.py') or
                  test.endswith('.bat'))):
+                if options.retest and not os.path.exists(test + ".err"):
+                    skipped += 1
+                    continue
                 ret = run_one(test)
                 if ret is None:
                     skipped += 1
                 elif not ret:
                     failed += 1
+                    if options.first:
+                        break
                 tests += 1
 
         print "\n# Ran %d tests, %d skipped, %d failed." % (tests, skipped,
--- a/tests/test-commit.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-commit.out	Wed Oct 11 16:41:52 2006 +0200
@@ -13,4 +13,5 @@
 abort: date exceeds 32 bits: 111111111111
 transaction abort!
 rollback completed
+trouble committing bar!
 abort: No such file or directory: .../test/bar
--- a/tests/test-filebranch.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-filebranch.out	Wed Oct 11 16:41:52 2006 +0200
@@ -19,7 +19,6 @@
 resolving manifests
 getting bar
 merging foo
-resolving foo
 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 we shouldn't have anything but foo in merge state here
--- a/tests/test-flags.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-flags.out	Wed Oct 11 16:41:52 2006 +0200
@@ -45,7 +45,6 @@
 
 resolving manifests
 merging a
-resolving a
 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 pulling from ../test2
--- a/tests/test-merge-revert.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-merge-revert.out	Wed Oct 11 16:41:52 2006 +0200
@@ -11,7 +11,6 @@
 ? file1.orig
 016807e6fdaf tip
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-merging file1
 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
 ? file1.orig
 016807e6fdaf tip
--- a/tests/test-merge1.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-merge1.out	Wed Oct 11 16:41:52 2006 +0200
@@ -1,7 +1,5 @@
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 %% no merges expected
-merging for b
-merging b
 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 diff -r d9e5953b9dec b
@@ -31,8 +29,6 @@
 %% merge fails
 abort: outstanding uncommitted changes
 %% merge expected!
-merging for b
-merging b
 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 diff -r c1dd73cbf59f b
--- a/tests/test-merge7.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-merge7.out	Wed Oct 11 16:41:52 2006 +0200
@@ -22,12 +22,11 @@
 (run 'hg heads' to see heads, 'hg merge' to merge)
 merge: warning: conflicts during merge
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor 451c744aabcc local a070d41e8360 remote faaea63e63a9
+ overwrite None partial False
+ ancestor faaea63e63a9 local 451c744aabcc+ remote a070d41e8360
  test.txt: versions differ -> m
 merging test.txt
-resolving test.txt
-my test.txt@451c744aabcc other test.txt@a070d41e8360 ancestor test.txt@faaea63e63a9
+my test.txt@451c744aabcc+ other test.txt@a070d41e8360 ancestor test.txt@faaea63e63a9
 merging test.txt failed!
 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
 There are unresolved merges, you can redo the full merge using:
--- a/tests/test-rename-merge1.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-rename-merge1.out	Wed Oct 11 16:41:52 2006 +0200
@@ -2,13 +2,12 @@
 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
 merge
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor f26ec4fc3fa3 local 8e765a822af2 remote af1939970a1c
- a: remote moved -> c
+ overwrite None partial False
+ ancestor af1939970a1c local f26ec4fc3fa3+ remote 8e765a822af2
+ a: remote moved -> m
  b2: remote created -> g
-merging a and b to b
-resolving a
-my a@f26ec4fc3fa3 other b@8e765a822af2 ancestor a@af1939970a1c
+merging a and b
+my a@f26ec4fc3fa3+ other b@8e765a822af2 ancestor a@af1939970a1c
 copying a to b
 removing a
 getting b2
--- a/tests/test-rename-merge2.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-rename-merge2.out	Wed Oct 11 16:41:52 2006 +0200
@@ -2,17 +2,15 @@
 test L:up a   R:nc a b W:       - 1  get local a to b
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor e300d1c794ec local 735846fee2d7 remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local e300d1c794ec+ remote 735846fee2d7
  rev: versions differ -> m
- a: remote copied -> c
-merging a and b to b
-resolving a
-my a@e300d1c794ec other b@735846fee2d7 ancestor a@924404dff337
+ a: remote copied -> m
+merging a and b
+my a@e300d1c794ec+ other b@735846fee2d7 ancestor a@924404dff337
 copying a to b
 merging rev
-resolving rev
-my rev@e300d1c794ec other rev@735846fee2d7 ancestor rev@924404dff337
+my rev@e300d1c794ec+ other rev@735846fee2d7 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -25,18 +23,16 @@
 test L:nc a b R:up a   W:       - 2  get rem change to a and b
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ac809aeed39a local f4db7e329e71 remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local ac809aeed39a+ remote f4db7e329e71
  a: remote is newer -> g
- b: local copied -> c
+ b: local copied -> m
  rev: versions differ -> m
 getting a
-merging b and a to b
-resolving b
-my b@ac809aeed39a other a@f4db7e329e71 ancestor a@924404dff337
+merging b and a
+my b@ac809aeed39a+ other a@f4db7e329e71 ancestor a@924404dff337
 merging rev
-resolving rev
-my rev@ac809aeed39a other rev@f4db7e329e71 ancestor rev@924404dff337
+my rev@ac809aeed39a+ other rev@f4db7e329e71 ancestor rev@924404dff337
 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -49,18 +45,16 @@
 test L:up a   R:nm a b W:       - 3  get local a change to b, remove a
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor e300d1c794ec local e03727d2d66b remote 924404dff337
- a: remote moved -> c
+ overwrite None partial False
+ ancestor 924404dff337 local e300d1c794ec+ remote e03727d2d66b
+ a: remote moved -> m
  rev: versions differ -> m
-merging a and b to b
-resolving a
-my a@e300d1c794ec other b@e03727d2d66b ancestor a@924404dff337
+merging a and b
+my a@e300d1c794ec+ other b@e03727d2d66b ancestor a@924404dff337
 copying a to b
 removing a
 merging rev
-resolving rev
-my rev@e300d1c794ec other rev@e03727d2d66b ancestor rev@924404dff337
+my rev@e300d1c794ec+ other rev@e03727d2d66b ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -72,16 +66,14 @@
 test L:nm a b R:up a   W:       - 4  get remote change to b
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ecf3cb2a4219 local f4db7e329e71 remote 924404dff337
- b: local moved -> c
+ overwrite None partial False
+ ancestor 924404dff337 local ecf3cb2a4219+ remote f4db7e329e71
+ b: local moved -> m
  rev: versions differ -> m
-merging b and a to b
-resolving b
-my b@ecf3cb2a4219 other a@f4db7e329e71 ancestor a@924404dff337
+merging b and a
+my b@ecf3cb2a4219+ other a@f4db7e329e71 ancestor a@924404dff337
 merging rev
-resolving rev
-my rev@ecf3cb2a4219 other rev@f4db7e329e71 ancestor rev@924404dff337
+my rev@ecf3cb2a4219+ other rev@f4db7e329e71 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -93,39 +85,31 @@
 test L:       R:nc a b W:       - 5  get b
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor 94b33a1b7f2d local 735846fee2d7 remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local 94b33a1b7f2d+ remote 735846fee2d7
  rev: versions differ -> m
- a: remote copied -> c
-merging a and b to b
-resolving a
-my a@924404dff337 other b@735846fee2d7 ancestor a@924404dff337
+ a: remote copied -> m
 copying a to b
 merging rev
-resolving rev
-my rev@94b33a1b7f2d other rev@735846fee2d7 ancestor rev@924404dff337
+my rev@94b33a1b7f2d+ other rev@735846fee2d7 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
-M a
 M b
   a
+C a
 --------------
 
 --------------
 test L:nc a b R:       W:       - 6  nothing
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ac809aeed39a local 97c705ade336 remote 924404dff337
- b: local copied -> c
+ overwrite None partial False
+ ancestor 924404dff337 local ac809aeed39a+ remote 97c705ade336
+ b: local copied -> m
  rev: versions differ -> m
-merging b and a to b
-resolving b
-my b@ac809aeed39a other a@924404dff337 ancestor a@924404dff337
 merging rev
-resolving rev
-my rev@ac809aeed39a other rev@97c705ade336 ancestor rev@924404dff337
+my rev@ac809aeed39a+ other rev@97c705ade336 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -138,18 +122,14 @@
 test L:       R:nm a b W:       - 7  get b
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor 94b33a1b7f2d local e03727d2d66b remote 924404dff337
- a: remote moved -> c
+ overwrite None partial False
+ ancestor 924404dff337 local 94b33a1b7f2d+ remote e03727d2d66b
+ a: remote moved -> m
  rev: versions differ -> m
-merging a and b to b
-resolving a
-my a@924404dff337 other b@e03727d2d66b ancestor a@924404dff337
 copying a to b
 removing a
 merging rev
-resolving rev
-my rev@94b33a1b7f2d other rev@e03727d2d66b ancestor rev@924404dff337
+my rev@94b33a1b7f2d+ other rev@e03727d2d66b ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -161,16 +141,12 @@
 test L:nm a b R:       W:       - 8  nothing
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ecf3cb2a4219 local 97c705ade336 remote 924404dff337
- b: local moved -> c
+ overwrite None partial False
+ ancestor 924404dff337 local ecf3cb2a4219+ remote 97c705ade336
+ b: local moved -> m
  rev: versions differ -> m
-merging b and a to b
-resolving b
-my b@ecf3cb2a4219 other a@924404dff337 ancestor a@924404dff337
 merging rev
-resolving rev
-my rev@ecf3cb2a4219 other rev@97c705ade336 ancestor rev@924404dff337
+my rev@ecf3cb2a4219+ other rev@97c705ade336 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -182,16 +158,14 @@
 test L:um a b R:um a b W:       - 9  do merge with ancestor in a
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ec03c2ca8642 local 79cc6877a3b7 remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local ec03c2ca8642+ remote 79cc6877a3b7
  b: versions differ -> m
  rev: versions differ -> m
 merging b
-resolving b
-my b@ec03c2ca8642 other b@79cc6877a3b7 ancestor a@924404dff337
+my b@ec03c2ca8642+ other b@79cc6877a3b7 ancestor a@924404dff337
 merging rev
-resolving rev
-my rev@ec03c2ca8642 other rev@79cc6877a3b7 ancestor rev@924404dff337
+my rev@ec03c2ca8642+ other rev@79cc6877a3b7 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -202,14 +176,13 @@
 test L:nm a b R:nm a c W:       - 11 get c, keep b
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ecf3cb2a4219 local e6abcc1a30c2 remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local ecf3cb2a4219+ remote e6abcc1a30c2
  rev: versions differ -> m
  c: remote created -> g
 getting c
 merging rev
-resolving rev
-my rev@ecf3cb2a4219 other rev@e6abcc1a30c2 ancestor rev@924404dff337
+my rev@ecf3cb2a4219+ other rev@e6abcc1a30c2 ancestor rev@924404dff337
 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -221,16 +194,14 @@
 test L:nc a b R:up b   W:       - 12 merge b no ancestor
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ac809aeed39a local af30c7647fc7 remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local ac809aeed39a+ remote af30c7647fc7
  b: versions differ -> m
  rev: versions differ -> m
 merging b
-resolving b
-my b@ac809aeed39a other b@af30c7647fc7 ancestor b@000000000000
+my b@ac809aeed39a+ other b@af30c7647fc7 ancestor b@000000000000
 merging rev
-resolving rev
-my rev@ac809aeed39a other rev@af30c7647fc7 ancestor rev@924404dff337
+my rev@ac809aeed39a+ other rev@af30c7647fc7 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -242,18 +213,16 @@
 test L:up b   R:nm a b W:       - 13 merge b no ancestor
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor 59318016310c local e03727d2d66b remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local 59318016310c+ remote e03727d2d66b
  a: other deleted -> r
  b: versions differ -> m
  rev: versions differ -> m
 removing a
 merging b
-resolving b
-my b@59318016310c other b@e03727d2d66b ancestor b@000000000000
+my b@59318016310c+ other b@e03727d2d66b ancestor b@000000000000
 merging rev
-resolving rev
-my rev@59318016310c other rev@e03727d2d66b ancestor rev@924404dff337
+my rev@59318016310c+ other rev@e03727d2d66b ancestor rev@924404dff337
 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -264,18 +233,16 @@
 test L:nc a b R:up a b W:       - 14 merge b no ancestor
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ac809aeed39a local 8dbce441892a remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local ac809aeed39a+ remote 8dbce441892a
  a: remote is newer -> g
  b: versions differ -> m
  rev: versions differ -> m
 getting a
 merging b
-resolving b
-my b@ac809aeed39a other b@8dbce441892a ancestor b@000000000000
+my b@ac809aeed39a+ other b@8dbce441892a ancestor b@000000000000
 merging rev
-resolving rev
-my rev@ac809aeed39a other rev@8dbce441892a ancestor rev@924404dff337
+my rev@ac809aeed39a+ other rev@8dbce441892a ancestor rev@924404dff337
 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -287,18 +254,16 @@
 test L:up b   R:nm a b W:       - 15 merge b no ancestor, remove a
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor 59318016310c local e03727d2d66b remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local 59318016310c+ remote e03727d2d66b
  a: other deleted -> r
  b: versions differ -> m
  rev: versions differ -> m
 removing a
 merging b
-resolving b
-my b@59318016310c other b@e03727d2d66b ancestor b@000000000000
+my b@59318016310c+ other b@e03727d2d66b ancestor b@000000000000
 merging rev
-resolving rev
-my rev@59318016310c other rev@e03727d2d66b ancestor rev@924404dff337
+my rev@59318016310c+ other rev@e03727d2d66b ancestor rev@924404dff337
 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -309,18 +274,16 @@
 test L:nc a b R:up a b W:       - 16 get a, merge b no ancestor
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ac809aeed39a local 8dbce441892a remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local ac809aeed39a+ remote 8dbce441892a
  a: remote is newer -> g
  b: versions differ -> m
  rev: versions differ -> m
 getting a
 merging b
-resolving b
-my b@ac809aeed39a other b@8dbce441892a ancestor b@000000000000
+my b@ac809aeed39a+ other b@8dbce441892a ancestor b@000000000000
 merging rev
-resolving rev
-my rev@ac809aeed39a other rev@8dbce441892a ancestor rev@924404dff337
+my rev@ac809aeed39a+ other rev@8dbce441892a ancestor rev@924404dff337
 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -332,16 +295,14 @@
 test L:up a b R:nc a b W:       - 17 keep a, merge b no ancestor
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor 0b76e65c8289 local 735846fee2d7 remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local 0b76e65c8289+ remote 735846fee2d7
  b: versions differ -> m
  rev: versions differ -> m
 merging b
-resolving b
-my b@0b76e65c8289 other b@735846fee2d7 ancestor b@000000000000
+my b@0b76e65c8289+ other b@735846fee2d7 ancestor b@000000000000
 merging rev
-resolving rev
-my rev@0b76e65c8289 other rev@735846fee2d7 ancestor rev@924404dff337
+my rev@0b76e65c8289+ other rev@735846fee2d7 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -353,18 +314,16 @@
 test L:nm a b R:up a b W:       - 18 merge b no ancestor
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ecf3cb2a4219 local 8dbce441892a remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local ecf3cb2a4219+ remote 8dbce441892a
  b: versions differ -> m
  rev: versions differ -> m
  a: prompt recreating -> g
 getting a
 merging b
-resolving b
-my b@ecf3cb2a4219 other b@8dbce441892a ancestor b@000000000000
+my b@ecf3cb2a4219+ other b@8dbce441892a ancestor b@000000000000
 merging rev
-resolving rev
-my rev@ecf3cb2a4219 other rev@8dbce441892a ancestor rev@924404dff337
+my rev@ecf3cb2a4219+ other rev@8dbce441892a ancestor rev@924404dff337
 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -376,16 +335,14 @@
 test L:up a b R:nm a b W:       - 19 merge b no ancestor, prompt remove a
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor 0b76e65c8289 local e03727d2d66b remote 924404dff337
+ overwrite None partial False
+ ancestor 924404dff337 local 0b76e65c8289+ remote e03727d2d66b
  b: versions differ -> m
  rev: versions differ -> m
 merging b
-resolving b
-my b@0b76e65c8289 other b@e03727d2d66b ancestor b@000000000000
+my b@0b76e65c8289+ other b@e03727d2d66b ancestor b@000000000000
 merging rev
-resolving rev
-my rev@0b76e65c8289 other rev@e03727d2d66b ancestor rev@924404dff337
+my rev@0b76e65c8289+ other rev@e03727d2d66b ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -397,18 +354,16 @@
 test L:up a   R:um a b W:       - 20 merge a and b to b, remove a
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor e300d1c794ec local 79cc6877a3b7 remote 924404dff337
- a: remote moved -> c
+ overwrite None partial False
+ ancestor 924404dff337 local e300d1c794ec+ remote 79cc6877a3b7
+ a: remote moved -> m
  rev: versions differ -> m
-merging a and b to b
-resolving a
-my a@e300d1c794ec other b@79cc6877a3b7 ancestor a@924404dff337
+merging a and b
+my a@e300d1c794ec+ other b@79cc6877a3b7 ancestor a@924404dff337
 copying a to b
 removing a
 merging rev
-resolving rev
-my rev@e300d1c794ec other rev@79cc6877a3b7 ancestor rev@924404dff337
+my rev@e300d1c794ec+ other rev@79cc6877a3b7 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -420,16 +375,14 @@
 test L:um a b R:up a   W:       - 21 merge a and b to b
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ec03c2ca8642 local f4db7e329e71 remote 924404dff337
- b: local moved -> c
+ overwrite None partial False
+ ancestor 924404dff337 local ec03c2ca8642+ remote f4db7e329e71
+ b: local moved -> m
  rev: versions differ -> m
-merging b and a to b
-resolving b
-my b@ec03c2ca8642 other a@f4db7e329e71 ancestor a@924404dff337
+merging b and a
+my b@ec03c2ca8642+ other a@f4db7e329e71 ancestor a@924404dff337
 merging rev
-resolving rev
-my rev@ec03c2ca8642 other rev@f4db7e329e71 ancestor rev@924404dff337
+my rev@ec03c2ca8642+ other rev@f4db7e329e71 ancestor rev@924404dff337
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
@@ -441,18 +394,16 @@
 test L:nm a b R:up a c W:       - 23 get c, keep b
 --------------
 resolving manifests
- overwrite None branchmerge True partial False
- ancestor ecf3cb2a4219 local 2b958612230f remote 924404dff337
- b: local moved -> c
+ overwrite None partial False
+ ancestor 924404dff337 local ecf3cb2a4219+ remote 2b958612230f
+ b: local moved -> m
  rev: versions differ -> m
  c: remote created -> g
-merging b and a to b
-resolving b
-my b@ecf3cb2a4219 other a@2b958612230f ancestor a@924404dff337
+merging b and a
+my b@ecf3cb2a4219+ other a@2b958612230f ancestor a@924404dff337
 getting c
 merging rev
-resolving rev
-my rev@ecf3cb2a4219 other rev@2b958612230f ancestor rev@924404dff337
+my rev@ecf3cb2a4219+ other rev@2b958612230f ancestor rev@924404dff337
 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 --------------
--- a/tests/test-up-local-change.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-up-local-change.out	Wed Oct 11 16:41:52 2006 +0200
@@ -15,13 +15,12 @@
 summary:     1
 
 resolving manifests
- overwrite False branchmerge False partial False
- ancestor 33aaa84a386b local 802f095af299 remote 33aaa84a386b
+ overwrite False partial False
+ ancestor 33aaa84a386b local 33aaa84a386b+ remote 802f095af299
  a: versions differ -> m
  b: remote created -> g
 merging a
-resolving a
-my a@33aaa84a386b other a@802f095af299 ancestor a@33aaa84a386b
+my a@33aaa84a386b+ other a@802f095af299 ancestor a@33aaa84a386b
 getting b
 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 changeset:   1:802f095af299
@@ -31,8 +30,8 @@
 summary:     2
 
 resolving manifests
- overwrite False branchmerge False partial False
- ancestor 802f095af299 local 33aaa84a386b remote 33aaa84a386b
+ overwrite False partial False
+ ancestor 33aaa84a386b local 802f095af299+ remote 33aaa84a386b
  b: remote deleted -> r
 removing b
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -49,13 +48,12 @@
 summary:     1
 
 resolving manifests
- overwrite False branchmerge False partial False
- ancestor 33aaa84a386b local 802f095af299 remote 33aaa84a386b
+ overwrite False partial False
+ ancestor 33aaa84a386b local 33aaa84a386b+ remote 802f095af299
  a: versions differ -> m
  b: remote created -> g
 merging a
-resolving a
-my a@33aaa84a386b other a@802f095af299 ancestor a@33aaa84a386b
+my a@33aaa84a386b+ other a@802f095af299 ancestor a@33aaa84a386b
 getting b
 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
 changeset:   1:802f095af299
@@ -100,16 +98,14 @@
 abort: outstanding uncommitted changes
 failed
 resolving manifests
- overwrite False branchmerge True partial False
- ancestor 802f095af299 local 030602aee63d remote 33aaa84a386b
+ overwrite False partial False
+ ancestor 33aaa84a386b local 802f095af299+ remote 030602aee63d
  a: versions differ -> m
  b: versions differ -> m
 merging a
-resolving a
-my a@802f095af299 other a@030602aee63d ancestor a@33aaa84a386b
+my a@802f095af299+ other a@030602aee63d ancestor a@33aaa84a386b
 merging b
-resolving b
-my b@802f095af299 other b@030602aee63d ancestor b@000000000000
+my b@802f095af299+ other b@030602aee63d ancestor b@000000000000
 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
 (branch merge, don't forget to commit)
 changeset:   1:802f095af299
@@ -137,5 +133,4 @@
 adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
-merging a
 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-update-reverse.out	Wed Oct 11 16:35:09 2006 +0200
+++ b/tests/test-update-reverse.out	Wed Oct 11 16:41:52 2006 +0200
@@ -40,8 +40,8 @@
 side1
 side2
 resolving manifests
- overwrite True branchmerge False partial False
- ancestor ded32b0db104 local 221226fb2bd8 remote 537353581d3d
+ overwrite True partial False
+ ancestor 537353581d3d local ded32b0db104+ remote 221226fb2bd8
  side2: remote deleted -> r
  side1: remote deleted -> r
  main: remote created -> g