Pierre-Yves David avatar Pierre-Yves David committed f017211

evolve: rename conflicting into divergent

Comments (0)

Files changed (4)

 
 # 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
 #
     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()'):
                 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
 
     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
 
     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')
         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)
 
 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
     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)
 
 
     """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
     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
 
 
 
     - 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.
 
       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
 
         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
 
     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]
 
     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)
     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,
 /!\ * 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['.']
         lockmod.release(lock, wlock)
 
 
-def conflictingdata(ctx):
+def divergentdata(ctx):
     """return base, other part of a conflict
 
     This only return the first one.

tests/test-obsolete.t

   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
   $ 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''
   |

tests/test-stabilize-result.t

   $ 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
   |
   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
   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 &&

tests/test-uncommit.t

   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 .
   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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.