diff -r 5dfb18b98a55 -r c3f6e97c71b1 hgext/evolve.py --- a/hgext/evolve.py Fri Jun 26 00:07:13 2015 -0700 +++ b/hgext/evolve.py Tue Jun 30 18:32:12 2015 -0700 @@ -1178,10 +1178,10 @@ # cluster handling nodes = set(mark[1]) nodes.add(mark[0]) - _updateclustermap(nodes, mark, clustersmap) + _updateclustermap(nodes, mark, clustersmap) # same with parent data nodes.update(parents) - _updateclustermap(nodes, mark, pclustersmap) + _updateclustermap(nodes, mark, pclustersmap) # freezing the result for c in clustersmap.values(): @@ -1415,6 +1415,24 @@ rdependencies[succ].add(r) return dependencies, rdependencies +def _dedupedivergents(repo, revs): + """Dedupe the divergents revs in revs to get one from each group with the + lowest revision numbers + """ + repo = repo.unfiltered() + res = set() + # To not reevaluate divergents of the same group once one is encountered + discarded = set() + for rev in revs: + if rev in discarded: + continue + divergent = repo[rev] + base, others = divergentdata(divergent) + othersrevs = [o.rev() for o in others] + res.add(min([divergent.rev()] + othersrevs)) + discarded.update(othersrevs) + return res + def _selectrevs(repo, allopt, revopt, anyopt, targetcat): """select troubles in repo matching according to given options""" revs = set() @@ -1424,6 +1442,9 @@ revs = scmutil.revrange(repo, revopt) & revs elif not anyopt and targetcat == 'unstable': revs = set(_aspiringdescendant(repo, repo.revs('(.::) - obsolete()::'))) + if targetcat == 'divergent': + # Pick one divergent per group of divergents + revs = _dedupedivergents(repo, revs) elif anyopt: revs = repo.revs('first(%s())' % (targetcat)) elif targetcat == 'unstable': @@ -1849,12 +1870,6 @@ ui.write_err(msg) return 2 other = others[0] - if divergent.phase() <= phases.public: - msg = _("skipping %s: we can't resolve divergence from the public side\n") % divergent - ui.write_err(msg) - hint = _("(%s is public, try from %s)\n" % (divergent, other)) - ui.write_err(hint) - return 2 if len(other.parents()) > 1: msg = _("skipping %s: divergent changeset can't be a merge (yet)\n" % divergent) ui.write_err(msg) @@ -2253,7 +2268,7 @@ # create markers obsolete.createmarkers(repo, relations, metadata=metadata) - + # informs that changeset have been pruned ui.status(_('%i changesets pruned\n') % len(precs)) @@ -2609,9 +2624,8 @@ def fold(ui, repo, *revs, **opts): """fold multiple revisions into a single one - Folds a set of revisions with the parent of the working directory. - All revisions linearly between the given revisions and the parent - of the working directory will also be folded. + By default, folds all the revisions linearly between the given revisions + and the parent of the working directory. Use --exact for folding only the specified revisions while ignoring the parent of the working directory. In this case, the given revisions must @@ -2632,9 +2646,13 @@ See :hg:`help phases` for more about draft revisions and :hg:`help revsets` for more about the `draft()` keyword - - Fold revisions 3, 4, 5, and 6 with the working directory parent:: - - hg fold 3:6 + - Fold revisions between 3 and 6 with the working directory parent:: + + hg fold 3::6 + + - Fold revisions 3 and 4: + + hg fold "3 + 4" --exact - Only fold revisions linearly between foo and @:: @@ -3333,7 +3351,7 @@ if new_format == repo.obsstore._version: msg = _('New format is the same as the old format, not upgrading!') raise util.Abort(msg) - f = repo.sopener('obsstore', 'wb', atomictemp=True) + f = repo.svfs('obsstore', 'wb', atomictemp=True) origmarkers = repo.obsstore._all known = set() markers = []