evolve: rename conflicting into divergent stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 23 Oct 2012 15:44:24 +0200
branchstable
changeset 586 f01721161532
parent 585 f013ca072bd9
child 587 8152fedbac65
evolve: rename conflicting into divergent
hgext/evolve.py
tests/test-obsolete.t
tests/test-stabilize-result.t
tests/test-uncommit.t
--- a/hgext/evolve.py	Tue Oct 23 15:05:32 2012 +0200
+++ b/hgext/evolve.py	Tue Oct 23 15:44:24 2012 +0200
@@ -511,7 +511,7 @@
 
 # there is two kind of trouble not handled by core right now:
 # - latecomer: (successors for public changeset)
-# - conflicting: (two changeset try to succeed to the same precursors)
+# - divergent: (two changeset try to succeed to the same precursors)
 #
 # This section add support for those two addition trouble
 #
@@ -530,10 +530,10 @@
     query = '%ld - obsolete() - public()'
     return set(repo.revs(query, candidates))
 
-@cachefor('conflicting')
-def _computeconflictingset(repo):
+@cachefor('divergent')
+def _computedivergentset(repo):
     """the set of rev trying to obsolete public revision"""
-    conflicting = set()
+    divergent = set()
     obsstore = repo.obsstore
     newermap = {}
     for ctx in repo.set('(not public()) - obsolete()'):
@@ -545,10 +545,10 @@
                 newermap[prec] = newerversion(repo, prec)
             newer = [n for n in newermap[prec] if n] # filter kill
             if len(newer) > 1:
-                conflicting.add(ctx.rev())
+                divergent.add(ctx.rev())
                 break
         toprocess.update(obsstore.successors.get(prec, ()))
-    return conflicting
+    return divergent
 
 ### changectx method
 
@@ -560,11 +560,12 @@
     return ctx.rev() in getobscache(ctx._repo, 'latecomer')
 
 @eh.addattr(context.changectx, 'conflicting')
-def conflicting(ctx):
-    """is the changeset conflicting (Try to succeed to public change)"""
+@eh.addattr(context.changectx, 'divergent')
+def divergent(ctx):
+    """is the changeset divergent (Try to succeed to public change)"""
     if ctx.node() is None:
         return False
-    return ctx.rev() in getobscache(ctx._repo, 'conflicting')
+    return ctx.rev() in getobscache(ctx._repo, 'divergent')
 
 ### revset symbol
 
@@ -578,24 +579,17 @@
     return [r for r in subset if r in lates]
 
 @eh.revset('conflicting')
-def revsetconflicting(repo, subset, x):
-    """``conflicting()``
-    Changesets marked as successors of a same changeset.
-    """
-    args = revset.getargs(x, 0, 0, 'conflicting takes no arguments')
-    conf = getobscache(repo, 'conflicting')
-    return [r for r in subset if r in conf]
-
 @eh.revset('divergent')
 def revsetdivergent(repo, subset, x):
     """``divergent()``
     Changesets marked as successors of a same changeset.
     """
     args = revset.getargs(x, 0, 0, 'divergent takes no arguments')
-    conf = getobscache(repo, 'conflicting')
+    conf = getobscache(repo, 'divergent')
     return [r for r in subset if r in conf]
 
 
+
 ### Discovery wrapping
 
 @eh.wrapfunction(discovery, 'checkheads')
@@ -612,8 +606,8 @@
         if ctx.latecomer():
             raise util.Abort(_("push includes a latecomer changeset: %s!")
                              % ctx)
-        if ctx.conflicting():
-            raise util.Abort(_("push includes a conflicting changeset: %s!")
+        if ctx.divergent():
+            raise util.Abort(_("push includes a divergent changeset: %s!")
                              % ctx)
     return orig(repo, remote, outgoing, *args, **kwargs)
 
@@ -722,15 +716,15 @@
 def troubles(ctx):
     """Return a tuple listing all the troubles that affect a changeset
 
-    Troubles may be "unstable", "latecomer" or "conflicting".
+    Troubles may be "unstable", "latecomer" or "divergent".
     """
     troubles = []
     if ctx.unstable():
         troubles.append('unstable')
     if ctx.latecomer():
         troubles.append('latecomer')
-    if ctx.conflicting():
-        troubles.append('conflicting')
+    if ctx.divergent():
+        troubles.append('divergent')
     return tuple(troubles)
 
 ### Troubled revset symbol
@@ -741,7 +735,7 @@
     Changesets with troubles.
     """
     _ = revset.getargs(x, 0, 0, 'troubled takes no arguments')
-    return repo.revs('%ld and (unstable() + latecomer() + conflicting())',
+    return repo.revs('%ld and (unstable() + latecomer() + divergent())',
                      subset)
 
 
@@ -958,19 +952,19 @@
     """display warning is the command resulted in more instable changeset"""
     priorunstables = len(repo.revs('unstable()'))
     priorlatecomers = len(repo.revs('latecomer()'))
-    priorconflictings = len(repo.revs('conflicting()'))
+    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
-    newconflictings = len(repo.revs('conflicting()')) - priorconflictings
+    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 newconflictings > 0:
-        ui.warn(_('%i new conflicting changesets\n') % newconflictings)
+    if newdivergents > 0:
+        ui.warn(_('%i new divergent changesets\n') % newdivergents)
     return ret
 
 @eh.reposetup
@@ -1010,10 +1004,10 @@
     ret = orig(ui, repo, *args, **kwargs)
     nbunstable = len(getobscache(repo, 'unstable'))
     nblatecomer = len(getobscache(repo, 'latecomer'))
-    nbconflicting = len(getobscache(repo, 'unstable'))
+    nbdivergent = len(getobscache(repo, 'unstable'))
     write('unstable: %i changesets\n', nbunstable)
     write('latecomer: %i changesets\n', nblatecomer)
-    write('conflicting: %i changesets\n', nbconflicting)
+    write('divergent: %i changesets\n', nbdivergent)
     return ret
 
 
@@ -1367,7 +1361,7 @@
 
     - rebase unstable changeset to make it stable again,
     - create proper diff from latecomer changeset,
-    - merge conflicting changeset.
+    - merge divergent changeset.
 
     By default, take the first troubles changeset that looks relevant.
 
@@ -1377,7 +1371,7 @@
       working directory parent revision or one of its descendants and rebase
       it.
 
-    - For conflicting this mean "." if applicable.
+    - For divergent this mean "." if applicable.
 
     With --any, evolve pick any troubled changeset to solve
 
@@ -1410,8 +1404,8 @@
         return _solveunstable(ui, repo, tr, opts['dry_run'])
     elif 'latecomer' in troubles:
         return _solvelatecomer(ui, repo, tr, opts['dry_run'])
-    elif 'conflicting' in troubles:
-        return _solveconflicting(ui, repo, tr, opts['dry_run'])
+    elif 'divergent' in troubles:
+        return _solvedivergent(ui, repo, tr, opts['dry_run'])
     else:
         assert False  # WHAT? unknown troubles
 
@@ -1420,14 +1414,14 @@
     tr = _stabilizableunstable(repo, repo['.'])
     if tr is None:
         wdp = repo['.']
-        if 'conflicting' in wdp.troubles():
+        if 'divergent' in wdp.troubles():
             tr = wdp
     if tr is None and pickany:
         troubled = list(repo.set('unstable()'))
         if not troubled:
             troubled = list(repo.set('latecomer()'))
         if not troubled:
-            troubled = list(repo.set('conflicting()'))
+            troubled = list(repo.set('divergent()'))
         if troubled:
             tr = troubled[0]
 
@@ -1600,22 +1594,22 @@
     finally:
         wlock.release()
 
-def _solveconflicting(ui, repo, conflicting, dryrun=False):
-    base, others = conflictingdata(conflicting)
+def _solvedivergent(ui, repo, divergent, dryrun=False):
+    base, others = divergentdata(divergent)
     if len(others) > 1:
         raise util.Abort("We do not handle split yet")
     other = others[0]
-    if conflicting.phase() <= phases.public:
+    if divergent.phase() <= phases.public:
         raise util.Abort("We can't resolve this conflict from the public side")
     if len(other.parents()) > 1:
-        raise util.Abort("conflicting changeset can't be a merge (yet)")
-    if other.p1() not in conflicting.parents():
+        raise util.Abort("divergent changeset can't be a merge (yet)")
+    if other.p1() not in divergent.parents():
         raise util.Abort("parents are not common (not handled yet)")
 
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
     ui.status(_('merge:'))
     if not ui.quiet:
-        displayer.show(conflicting)
+        displayer.show(divergent)
     ui.status(_('with: '))
     if not ui.quiet:
         displayer.show(other)
@@ -1623,23 +1617,23 @@
     if not ui.quiet:
         displayer.show(base)
     if dryrun:
-        ui.write('hg update -c %s &&\n' % conflicting)
+        ui.write('hg update -c %s &&\n' % divergent)
         ui.write('hg merge %s &&\n' % other)
         ui.write('hg commit -m "auto merge resolving conflict between '
-                 '%s and %s"&&\n' % (conflicting, other))
+                 '%s and %s"&&\n' % (divergent, other))
         ui.write('hg up -C %s &&\n' % base)
         ui.write('hg revert --all --rev tip &&\n')
         ui.write('hg commit -m "`hg log -r %s --template={desc}`";\n'
-                 % conflicting)
+                 % divergent)
         return
     wlock = lock = None
     try:
         wlock = repo.wlock()
         lock = repo.lock()
-        if conflicting not in repo[None].parents():
+        if divergent not in repo[None].parents():
             repo.ui.status(_('updating to "local" conflict\n'))
-            hg.update(repo, conflicting.rev())
-        repo.ui.note(_('merging conflicting changeset\n'))
+            hg.update(repo, divergent.rev())
+        repo.ui.note(_('merging divergent changeset\n'))
         stats = merge.update(repo,
                              other.node(),
                              branchmerge=True,
@@ -1660,13 +1654,13 @@
 /!\ * hg ci -m "same message as the amended changeset" => new cset Y
 /!\ * hg kill -n Y W Z
 """)
-        tr = repo.transaction('stabilize-conflicting')
+        tr = repo.transaction('stabilize-divergent')
         try:
-            repo.dirstate.setparents(conflicting.node(), node.nullid)
+            repo.dirstate.setparents(divergent.node(), node.nullid)
             oldlen = len(repo)
             amend(ui, repo)
             if oldlen == len(repo):
-                new = conflicting
+                new = divergent
                 # no changes
             else:
                 new = repo['.']
@@ -1679,7 +1673,7 @@
         lockmod.release(lock, wlock)
 
 
-def conflictingdata(ctx):
+def divergentdata(ctx):
     """return base, other part of a conflict
 
     This only return the first one.
--- a/tests/test-obsolete.t	Tue Oct 23 15:05:32 2012 +0200
+++ b/tests/test-obsolete.t	Tue Oct 23 15:44:24 2012 +0200
@@ -376,7 +376,7 @@
   commit: 1 deleted, 2 unknown (clean)
   update: 4 new changesets, 4 branch heads (merge)
   unstable: 1 changesets
-  conflicting: 1 changesets
+  divergent: 1 changesets
   $ qlog
   6
   - 909a0fb57e5d
@@ -497,7 +497,7 @@
   $ hg rebase -s 7 -d 4 2>&1 | grep -v 'whole rebase' 
   nothing to rebase
   $ hg rebase -b '3' -d 4 --traceback
-  2 new conflicting changesets
+  2 new divergent changesets
   $ hg log -G --template='{rev} - {node|short} {desc}\n'
   @  11 - 9468a5f5d8b2 add obsol_d''
   |
--- a/tests/test-stabilize-result.t	Tue Oct 23 15:05:32 2012 +0200
+++ b/tests/test-stabilize-result.t	Tue Oct 23 15:44:24 2012 +0200
@@ -210,7 +210,7 @@
   $ cat a.old >> a
   $ rm a.old
   $ hg amend
-  2 new conflicting changesets
+  2 new divergent changesets
   $ glog
   @  19:3883461cc228@default(draft) bk:[] More addition
   |
@@ -240,7 +240,7 @@
   merge:[19] More addition
   with: [17] More addition
   base: [15] More addition
-  merging conflicting changeset
+  merging divergent changeset
   resolving manifests
   merging a
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
@@ -297,7 +297,7 @@
   Working directory parent is obsolete
   $ echo 'gotta break' >> a
   $ hg amend
-  1 new conflicting changesets
+  1 new divergent changesets
   $ hg evolve -qn
   hg update -c c956a4b140b6 &&
   hg merge ac6d600735a4 &&
--- a/tests/test-uncommit.t	Tue Oct 23 15:05:32 2012 +0200
+++ b/tests/test-uncommit.t	Tue Oct 23 15:44:24 2012 +0200
@@ -241,7 +241,7 @@
   Working directory parent is obsolete
   $ hg --config extensions.purge= purge
   $ hg uncommit -I 'set:added() and e'
-  2 new conflicting changesets
+  2 new divergent changesets
   $ hg st --copies
   A e
   $ hg st --copies --change .
@@ -285,7 +285,7 @@
   Working directory parent is obsolete
   $ hg --config extensions.purge= purge
   $ hg uncommit --all -X e
-  1 new conflicting changesets
+  1 new divergent changesets
   $ hg st --copies
   M b
   M d