hgext/evolve.py
branchstable
changeset 593 26f76b38f879
parent 588 89c8550019d0
child 594 7f89b31fcb26
child 611 bd0f49f2ec83
--- a/hgext/evolve.py	Tue Oct 23 16:49:29 2012 +0200
+++ b/hgext/evolve.py	Tue Oct 23 17:32:22 2012 +0200
@@ -510,7 +510,7 @@
 #####################################################################
 
 # there is two kind of trouble not handled by core right now:
-# - latecomer: (successors for public changeset)
+# - bumped: (successors for public changeset)
 # - divergent: (two changeset try to succeed to the same precursors)
 #
 # This section add support for those two addition trouble
@@ -522,8 +522,8 @@
 ### Cache computation
 latediff = 1  # flag to prevent taking late comer fix into account
 
-@cachefor('latecomer')
-def _computelatecomerset(repo):
+@cachefor('bumped')
+def _computebumpedset(repo):
     """the set of rev trying to obsolete public revision"""
     candidates = _allsuccessors(repo, repo.revs('public()'),
                                                 haltonflags=latediff)
@@ -553,11 +553,12 @@
 ### changectx method
 
 @eh.addattr(context.changectx, 'latecomer')
-def latecomer(ctx):
-    """is the changeset latecomer (Try to succeed to public change)"""
+@eh.addattr(context.changectx, 'bumped')
+def bumped(ctx):
+    """is the changeset bumped (Try to succeed to public change)"""
     if ctx.node() is None:
         return False
-    return ctx.rev() in getobscache(ctx._repo, 'latecomer')
+    return ctx.rev() in getobscache(ctx._repo, 'bumped')
 
 @eh.addattr(context.changectx, 'conflicting')
 @eh.addattr(context.changectx, 'divergent')
@@ -570,12 +571,13 @@
 ### revset symbol
 
 @eh.revset('latecomer')
-def revsetlatecomer(repo, subset, x):
-    """``latecomer()``
+@eh.revset('bumped')
+def revsetbumped(repo, subset, x):
+    """``bumped()``
     Changesets marked as successors of public changesets.
     """
-    args = revset.getargs(x, 0, 0, 'latecomer takes no arguments')
-    lates = getobscache(repo, 'latecomer')
+    args = revset.getargs(x, 0, 0, 'bumped takes no arguments')
+    lates = getobscache(repo, 'bumped')
     return [r for r in subset if r in lates]
 
 @eh.revset('conflicting')
@@ -596,15 +598,15 @@
 def wrapcheckheads(orig, repo, remote, outgoing, *args, **kwargs):
     """wrap mercurial.discovery.checkheads
 
-    * prevent latecomer and unstable to be pushed
+    * prevent bumped and unstable to be pushed
     """
     # do not push instability
     for h in outgoing.missingheads:
         # Checking heads is enough, obsolete descendants are either
         # obsolete or unstable.
         ctx = repo[h]
-        if ctx.latecomer():
-            raise util.Abort(_("push includes a latecomer changeset: %s!")
+        if ctx.bumped():
+            raise util.Abort(_("push includes a bumped changeset: %s!")
                              % ctx)
         if ctx.divergent():
             raise util.Abort(_("push includes a divergent changeset: %s!")
@@ -716,13 +718,13 @@
 def troubles(ctx):
     """Return a tuple listing all the troubles that affect a changeset
 
-    Troubles may be "unstable", "latecomer" or "divergent".
+    Troubles may be "unstable", "bumped" or "divergent".
     """
     troubles = []
     if ctx.unstable():
         troubles.append('unstable')
-    if ctx.latecomer():
-        troubles.append('latecomer')
+    if ctx.bumped():
+        troubles.append('bumped')
     if ctx.divergent():
         troubles.append('divergent')
     return tuple(troubles)
@@ -730,12 +732,12 @@
 ### Troubled revset symbol
 
 @eh.revset('troubled')
-def revsetlatecomer(repo, subset, x):
+def revsetbumped(repo, subset, x):
     """``troubled()``
     Changesets with troubles.
     """
     _ = revset.getargs(x, 0, 0, 'troubled takes no arguments')
-    return repo.revs('%ld and (unstable() + latecomer() + divergent())',
+    return repo.revs('%ld and (unstable() + bumped() + divergent())',
                      subset)
 
 
@@ -1045,18 +1047,18 @@
 def warnobserrors(orig, ui, repo, *args, **kwargs):
     """display warning is the command resulted in more instable changeset"""
     priorunstables = len(repo.revs('unstable()'))
-    priorlatecomers = len(repo.revs('latecomer()'))
+    priorbumpeds = len(repo.revs('bumped()'))
     priordivergents = len(repo.revs('divergent()'))
     ret = orig(ui, repo, *args, **kwargs)
     # workaround phase stupidity
     phases._filterunknown(ui, repo.changelog, repo._phasecache.phaseroots)
     newunstables = len(repo.revs('unstable()')) - priorunstables
-    newlatecomers = len(repo.revs('latecomer()')) - priorlatecomers
+    newbumpeds = len(repo.revs('bumped()')) - priorbumpeds
     newdivergents = len(repo.revs('divergent()')) - priordivergents
     if newunstables > 0:
         ui.warn(_('%i new unstable changesets\n') % newunstables)
-    if newlatecomers > 0:
-        ui.warn(_('%i new latecomer changesets\n') % newlatecomers)
+    if newbumpeds > 0:
+        ui.warn(_('%i new bumped changesets\n') % newbumpeds)
     if newdivergents > 0:
         ui.warn(_('%i new divergent changesets\n') % newdivergents)
     return ret
@@ -1097,10 +1099,10 @@
 
     ret = orig(ui, repo, *args, **kwargs)
     nbunstable = len(getobscache(repo, 'unstable'))
-    nblatecomer = len(getobscache(repo, 'latecomer'))
+    nbbumped = len(getobscache(repo, 'bumped'))
     nbdivergent = len(getobscache(repo, 'unstable'))
     write('unstable: %i changesets\n', nbunstable)
-    write('latecomer: %i changesets\n', nblatecomer)
+    write('bumped: %i changesets\n', nbbumped)
     write('divergent: %i changesets\n', nbdivergent)
     return ret
 
@@ -1454,7 +1456,7 @@
     """Solve trouble in your repository
 
     - rebase unstable changeset to make it stable again,
-    - create proper diff from latecomer changeset,
+    - create proper diff from bumped changeset,
     - merge divergent changeset.
 
     By default, take the first troubles changeset that looks relevant.
@@ -1496,8 +1498,8 @@
     troubles = tr.troubles()
     if 'unstable' in troubles:
         return _solveunstable(ui, repo, tr, opts['dry_run'])
-    elif 'latecomer' in troubles:
-        return _solvelatecomer(ui, repo, tr, opts['dry_run'])
+    elif 'bumped' in troubles:
+        return _solvebumped(ui, repo, tr, opts['dry_run'])
     elif 'divergent' in troubles:
         return _solvedivergent(ui, repo, tr, opts['dry_run'])
     else:
@@ -1513,7 +1515,7 @@
     if tr is None and pickany:
         troubled = list(repo.set('unstable()'))
         if not troubled:
-            troubled = list(repo.set('latecomer()'))
+            troubled = list(repo.set('bumped()'))
         if not troubled:
             troubled = list(repo.set('divergent()'))
         if troubled:
@@ -1586,13 +1588,13 @@
         finally:
             lock.release()
 
-def _solvelatecomer(ui, repo, latecomer, dryrun=False):
-    """Stabilize a latecomer changeset"""
-    # For now we deny latecomer merge
-    if len(latecomer.parents()) > 1:
-        raise util.Abort('late comer stabilization is confused by latecomer'
-                         ' %s being a merge' % latecomer)
-    prec = repo.set('last(allprecursors(%d) and public())', latecomer).next()
+def _solvebumped(ui, repo, bumped, dryrun=False):
+    """Stabilize a bumped changeset"""
+    # For now we deny bumped merge
+    if len(bumped.parents()) > 1:
+        raise util.Abort('late comer stabilization is confused by bumped'
+                         ' %s being a merge' % bumped)
+    prec = repo.set('last(allprecursors(%d) and public())', bumped).next()
     # For now we deny target merge
     if len(prec.parents()) > 1:
         raise util.Abort('late comer evolution is confused by precursors'
@@ -1601,54 +1603,54 @@
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
     repo.ui.status(_('recreate:'))
     if not ui.quiet:
-        displayer.show(latecomer)
+        displayer.show(bumped)
     repo.ui.status(_('atop:'))
     if not ui.quiet:
         displayer.show(prec)
     if dryrun:
-        todo = 'hg rebase --rev %s --dest %s;\n' % (latecomer, prec.p1())
+        todo = 'hg rebase --rev %s --dest %s;\n' % (bumped, prec.p1())
         repo.ui.write(todo)
         repo.ui.write('hg update %s;\n' % prec)
-        repo.ui.write('hg revert --all --rev %s;\n' % latecomer)
-        repo.ui.write('hg commit --msg "latecomer update to %s"')
+        repo.ui.write('hg revert --all --rev %s;\n' % bumped)
+        repo.ui.write('hg commit --msg "bumped update to %s"')
         return 0
     wlock = repo.wlock()
     try:
         newid = tmpctx = None
-        tmpctx = latecomer
+        tmpctx = bumped
         lock = repo.lock()
         try:
-            bmupdate = _bookmarksupdater(repo, latecomer.node())
+            bmupdate = _bookmarksupdater(repo, bumped.node())
             # Basic check for common parent. Far too complicated and fragile
-            tr = repo.transaction('latecomer-stabilize')
+            tr = repo.transaction('bumped-stabilize')
             try:
-                if not list(repo.set('parents(%d) and parents(%d)', latecomer, prec)):
+                if not list(repo.set('parents(%d) and parents(%d)', bumped, prec)):
                     # Need to rebase the changeset at the right place
                     repo.ui.status(_('rebasing to destination parent: %s\n') % prec.p1())
                     try:
-                        tmpid = relocate(repo, latecomer, prec.p1())
+                        tmpid = relocate(repo, bumped, prec.p1())
                         if tmpid is not None:
                             tmpctx = repo[tmpid]
-                            createmarkers(repo, [(latecomer, (tmpctx,))])
+                            createmarkers(repo, [(bumped, (tmpctx,))])
                     except MergeFailure:
-                        repo.opener.write('graftstate', latecomer.hex() + '\n')
+                        repo.opener.write('graftstate', bumped.hex() + '\n')
                         repo.ui.write_err(_('evolution failed!\n'))
                         repo.ui.write_err(_('fix conflict and run "hg evolve --continue"\n'))
                         raise
                 # Create the new commit context
                 repo.ui.status(_('computing new diff\n'))
                 files = set()
-                copied = copies.pathcopies(prec, latecomer)
+                copied = copies.pathcopies(prec, bumped)
                 precmanifest = prec.manifest()
-                for key, val in latecomer.manifest().iteritems():
+                for key, val in bumped.manifest().iteritems():
                     if precmanifest.pop(key, None) != val:
                         files.add(key)
                 files.update(precmanifest)  # add missing files
                 # commit it
                 if files: # something to commit!
                     def filectxfn(repo, ctx, path):
-                        if path in latecomer:
-                            fctx = latecomer[path]
+                        if path in bumped:
+                            fctx = bumped[path]
                             flags = fctx.flags()
                             mctx = context.memfilectx(fctx.path(), fctx.data(),
                                                       islink='l' in flags,
@@ -1656,24 +1658,24 @@
                                                       copied=copied.get(path))
                             return mctx
                         raise IOError()
-                    text = 'latecomer update to %s:\n\n' % prec
-                    text += latecomer.description()
+                    text = 'bumped update to %s:\n\n' % prec
+                    text += bumped.description()
 
                     new = context.memctx(repo,
                                          parents=[prec.node(), node.nullid],
                                          text=text,
                                          files=files,
                                          filectxfn=filectxfn,
-                                         user=latecomer.user(),
-                                         date=latecomer.date(),
-                                         extra=latecomer.extra())
+                                         user=bumped.user(),
+                                         date=bumped.date(),
+                                         extra=bumped.extra())
 
                     newid = repo.commitctx(new)
                 if newid is None:
                     createmarkers(repo, [(tmpctx, ())])
                     newid = prec.node()
                 else:
-                    phases.retractboundary(repo, latecomer.phase(), [newid])
+                    phases.retractboundary(repo, bumped.phase(), [newid])
                     createmarkers(repo, [(tmpctx, (repo[newid],))],
                                            flag=latediff)
                 bmupdate(newid)