merge bumped rename
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 23 Oct 2012 17:43:22 +0200
changeset 594 7f89b31fcb26
parent 592 35c46a780dd6 (current diff)
parent 593 26f76b38f879 (diff)
child 596 5527e4fe4418
merge bumped rename (drop several part of the code because bumped is now in core)
hgext/evolve.py
tests/test-obsolete.t
--- a/docs/obs-concept.rst	Tue Oct 23 17:13:30 2012 +0200
+++ b/docs/obs-concept.rst	Tue Oct 23 17:43:22 2012 +0200
@@ -314,15 +314,15 @@
 * Public changesets are excluded from the obsolete set (public
   changesets are never hidden or candidate to garbage collection)
 
-* *newer* version of a public changeset are called **latecomer** and
+* *newer* version of a public changeset are called **bumped** and
   highlighted as an error case.
 
 .. figure:: ./figures/explain-troubles-concurrent-10-sumup.*
 
 Solving such an error is easy. Because we know what changeset a
-*latecomer* tries to rewrite, we can easily compute a smaller
+*bumped* tries to rewrite, we can easily compute a smaller
 changeset containing only the change from the old *public* to the new
-*latecomer*.
+*bumped*.
 
 .. figure:: ./figures/explain-troubles-concurrent-15-solution.*
 
--- a/docs/obs-terms.rst	Tue Oct 23 17:13:30 2012 +0200
+++ b/docs/obs-terms.rst	Tue Oct 23 17:43:22 2012 +0200
@@ -107,15 +107,15 @@
 |                     | (a.k.a. divergent   and  |                             |
 |                     | unstable)                +-----------------------------+
 |                     |                          |                             |
-|                     | (possible alternative    | **latecomer**               |
+|                     | (possible alternative    | **bumped**                  |
 |                     | names: unsettled,        |                             |
-|                     | troublesome              | *latecomer* is a changeset  |
+|                     | troublesome              | *bumped* is a changeset     |
 |                     |                          | that tries to be successor  |
 |                     |                          | of  public changesets.      |
 |                     |                          |                             |
 |                     |                          | Public changeset can't      |
 |                     |                          | be deleted and replace      |
-|                     |                          | *latecomer*                 |
+|                     |                          | *bumped*                    |
 |                     |                          | need to be converted into   |
 |                     |                          | an overlay to this public   |
 |                     |                          | changeset.                  |
@@ -179,13 +179,6 @@
 |                                                                              |
 +------------------------------------------------------------------------------+
 
-.. note:: I'm not very happy with the naming of:
-
-          - "ok" changeset
-          - latecomer
-          - divergent
-
-          Any better idea are welcome.
 
 
 Command and operation name
@@ -233,7 +226,7 @@
 ```````````````
 
 Automatically resolve *troublesome* changesets
-(*unstable*, *latecomer* and *divergent*)
+(*unstable*, *bumped* and *divergent*)
 
 This is an important name as hg pull/push will suggest it the same way it
 suggest merging when you add heads.
--- a/hgext/evolve.py	Tue Oct 23 17:13:30 2012 +0200
+++ b/hgext/evolve.py	Tue Oct 23 17:43:22 2012 +0200
@@ -329,7 +329,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
@@ -341,13 +341,6 @@
 ### Cache computation
 latediff = 1  # flag to prevent taking late comer fix into account
 
-@cachefor('latecomer')
-def _computelatecomerset(repo):
-    """the set of rev trying to obsolete public revision"""
-    candidates = _allsuccessors(repo, repo.revs('public()'),
-                                                haltonflags=latediff)
-    query = '%ld - obsolete() - public()'
-    return set(repo.revs(query, candidates))
 
 @cachefor('divergent')
 def _computedivergentset(repo):
@@ -373,10 +366,8 @@
 
 @eh.addattr(context.changectx, 'latecomer')
 def latecomer(ctx):
-    """is the changeset latecomer (Try to succeed to public change)"""
-    if ctx.node() is None:
-        return False
-    return ctx.rev() in getrevs(ctx._repo, 'latecomer')
+    """is the changeset bumped (Try to succeed to public change)"""
+    return ctx.bumped()
 
 @eh.addattr(context.changectx, 'conflicting')
 @eh.addattr(context.changectx, 'divergent')
@@ -388,14 +379,7 @@
 
 ### revset symbol
 
-@eh.revset('latecomer')
-def revsetlatecomer(repo, subset, x):
-    """``latecomer()``
-    Changesets marked as successors of public changesets.
-    """
-    args = revset.getargs(x, 0, 0, 'latecomer takes no arguments')
-    lates = getrevs(repo, 'latecomer')
-    return [r for r in subset if r in lates]
+eh.revset('latecomer')(revset.symbols['bumped'])
 
 @eh.revset('conflicting')
 @eh.revset('divergent')
@@ -415,16 +399,13 @@
 def wrapcheckheads(orig, repo, remote, outgoing, *args, **kwargs):
     """wrap mercurial.discovery.checkheads
 
-    * prevent latecomer and unstable to be pushed
+    * prevent divergent 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!")
-                             % ctx)
         if ctx.divergent():
             raise util.Abort(_("push includes a divergent changeset: %s!")
                              % ctx)
@@ -498,13 +479,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)
@@ -512,12 +493,12 @@
 ### Troubled revset symbol
 
 @eh.revset('troubled')
-def revsetlatecomer(repo, subset, x):
+def revsettroubled(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)
 
 
@@ -817,18 +798,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
@@ -869,10 +850,10 @@
 
     ret = orig(ui, repo, *args, **kwargs)
     nbunstable = len(getrevs(repo, 'unstable'))
-    nblatecomer = len(getrevs(repo, 'latecomer'))
+    nbbumped = len(getrevs(repo, 'bumped'))
     nbdivergent = len(getrevs(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
 
@@ -1091,7 +1072,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.
@@ -1133,8 +1114,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:
@@ -1150,7 +1131,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:
@@ -1223,13 +1204,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'
@@ -1238,54 +1219,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,
@@ -1293,24 +1274,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)
--- a/tests/test-evolve.t	Tue Oct 23 17:13:30 2012 +0200
+++ b/tests/test-evolve.t	Tue Oct 23 17:43:22 2012 +0200
@@ -296,12 +296,12 @@
   6	feature-A: a nifty feature - test
   0	: base - test
 
-phase change turning obsolete changeset public issue a latecomer warning
+phase change turning obsolete changeset public issue a bumped warning
 
   $ hg phase --public 7
-  1 new latecomer changesets
+  1 new bumped changesets
 
-all solving latecomer troubled
+all solving bumped troubled
 
   $ hg glog
   @  8	feature-B: another feature that rox - test
@@ -316,9 +316,9 @@
   recreate:[8] another feature that rox
   atop:[7] another feature
   computing new diff
-  commited as 8d77fa12ab0c
+  commited as 53ff506edef1
   $ hg glog
-  @  9	feature-B: latecomer update to 5f4744038ed5: - test
+  @  9	feature-B: bumped update to 5f4744038ed5: - test
   |
   o  7	: another feature - test
   |
@@ -334,7 +334,7 @@
   @@ -3,1 +3,1 @@
   -Zwei
   +deux
-  $ hg log -r 'latecomer()' # no more latecomer
+  $ hg log -r 'bumped()' # no more bumped
 
   $ cd ..
 
--- a/tests/test-obsolete.t	Tue Oct 23 17:13:30 2012 +0200
+++ b/tests/test-obsolete.t	Tue Oct 23 17:43:22 2012 +0200
@@ -404,7 +404,7 @@
   $ hg debugobsolete `getid 0` `getid 9`
 83b5778897ad try to obsolete immutable changeset 1f0dee641bb7
 # at core level the warning is not issued
-# this is now a big issue now that we have latecomer warning
+# this is now a big issue now that we have bumped warning
   $ qlog -r 'obsolete()'
   3
   - 0d3f46688ccc
@@ -532,12 +532,12 @@
   added 1 changesets with 1 changes to 1 files (+1 heads)
   $ cd ..
 
-check latecomer detection
+check bumped detection
 (make an obsolete changeset public)
 
   $ cd local
   $ hg phase --public 11
-  1 new latecomer changesets
+  1 new bumped changesets
   $ hg log -G --template='{rev} - ({phase}) {node|short} {desc}\n'
   @  12 - (draft) 6db5e282cb91 add obsol_d'''
   |
@@ -551,7 +551,7 @@
   |
   o  0 - (public) 1f0dee641bb7 add a
   
-  $ hg log -r 'latecomer()'
+  $ hg log -r 'bumped()'
   changeset:   12:6db5e282cb91
   tag:         tip
   parent:      10:2033b4e49474
@@ -641,7 +641,7 @@
   branch: default
   commit: (clean)
   update: (9|11) new changesets, (9|10) branch heads \(merge\) (re)
-  latecomer: 1 changesets
+  bumped: 1 changesets
   $ hg debugobsolete `getid a7a6f2b5d8a5` `getid 50f11e5e3a63`
   $ hg log -r 'conflicting()'
   changeset:   12:6db5e282cb91
--- a/tests/test-stabilize-result.t	Tue Oct 23 17:13:30 2012 +0200
+++ b/tests/test-stabilize-result.t	Tue Oct 23 17:43:22 2012 +0200
@@ -131,7 +131,7 @@
 Make precursors public
 
   $ hg phase --public 8
-  1 new latecomer changesets
+  1 new bumped changesets
   $ glog
   @  12:15c83af6f3a3@default(draft) bk:[] newer a
   |
@@ -152,15 +152,15 @@
   hg rebase --rev 15c83af6f3a3 --dest e8cc1b534401;
   hg update e3183e9c0961;
   hg revert --all --rev 15c83af6f3a3;
-  hg commit --msg "latecomer update to %s" (no-eol)
+  hg commit --msg "bumped update to %s" (no-eol)
   $ hg evolve --any
   recreate:[12] newer a
   atop:[8] newer a
   rebasing to destination parent: e8cc1b534401
   computing new diff
-  commited as 1d94fef80e85
+  commited as eeeb8f6e7648
   $ glog
-  @  14:1d94fef80e85@default(draft) bk:[] latecomer update to e3183e9c0961:
+  @  14:eeeb8f6e7648@default(draft) bk:[] bumped update to e3183e9c0961:
   |
   | o  9:355c5cda4de1@default(draft) bk:[] add c
   | |
@@ -190,7 +190,7 @@
   $ glog
   @  15:7391601a4bfa@default(draft) bk:[] More addition
   |
-  | o  14:1d94fef80e85@default(draft) bk:[] latecomer update to e3183e9c0961:
+  | o  14:eeeb8f6e7648@default(draft) bk:[] bumped update to e3183e9c0961:
   | |
   o |  9:355c5cda4de1@default(draft) bk:[] add c
   | |
@@ -216,7 +216,7 @@
   |
   | o  17:4754d61bc2db@default(draft) bk:[] More addition
   |/
-  | o  14:1d94fef80e85@default(draft) bk:[] latecomer update to e3183e9c0961:
+  | o  14:eeeb8f6e7648@default(draft) bk:[] bumped update to e3183e9c0961:
   | |
   o |  9:355c5cda4de1@default(draft) bk:[] add c
   | |
@@ -251,7 +251,7 @@
   $ glog
   @  22:ac6d600735a4@default(draft) bk:[] More addition
   |
-  | o  14:1d94fef80e85@default(draft) bk:[] latecomer update to e3183e9c0961:
+  | o  14:eeeb8f6e7648@default(draft) bk:[] bumped update to e3183e9c0961:
   | |
   o |  9:355c5cda4de1@default(draft) bk:[] add c
   | |