--- 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)