# HG changeset patch # User Pierre-Yves David # Date 1430762166 25200 # Node ID 31e96036acd31c3e7acc987f47c7f2bac6fd98dd # Parent 1218ad94a351b8294a4627a0ec9a27b68206c5b9# Parent 508f9911b042852c29f89d7cedda975cb1a78a39 merge with stable bunch of cleanup on stable diff -r 508f9911b042 -r 31e96036acd3 README --- a/README Mon Apr 20 13:39:18 2015 -0700 +++ b/README Mon May 04 10:56:06 2015 -0700 @@ -55,6 +55,8 @@ - minor documentation cleanup - support -i option for `hg amend` if commit supports it (3.4) +- fix the `debugrecordpruneparents` utility +- fix some possible crash during command abort (release non-existant transaction) 5.1.4 -- 2015-04-23 diff -r 508f9911b042 -r 31e96036acd3 hgext/evolve.py --- a/hgext/evolve.py Mon Apr 20 13:39:18 2015 -0700 +++ b/hgext/evolve.py Mon May 04 10:56:06 2015 -0700 @@ -28,6 +28,8 @@ from StringIO import StringIO import struct import re +import socket +import errno sha1re = re.compile(r'\b[0-9a-f]{6,40}\b') import mercurial @@ -46,7 +48,6 @@ # Flags for enabling optional parts of evolve commandopt = 'allnewcommands' -from mercurial import base85 from mercurial import bookmarks from mercurial import cmdutil from mercurial import commands @@ -62,7 +63,6 @@ from mercurial import node from mercurial import phases from mercurial import patch -from mercurial import pushkey from mercurial import revset from mercurial import scmutil from mercurial import templatekw @@ -72,7 +72,6 @@ from mercurial import wireproto from mercurial import localrepo from mercurial.hgweb import hgweb_mod -from mercurial import bundle2 cmdtable = {} command = cmdutil.command(cmdtable) @@ -537,7 +536,7 @@ """``suspended()`` Obsolete changesets with non-obsolete descendants. """ - args = revset.getargs(x, 0, 0, 'suspended takes no arguments') + revset.getargs(x, 0, 0, 'suspended takes no arguments') suspended = getrevs(repo, 'suspended') return [r for r in subset if r in suspended] @@ -588,7 +587,6 @@ """:obsolete: String. The obsolescence level of the node, could be ``stable``, ``unstable``, ``suspended`` or ``extinct``. """ - rev = ctx.rev() if ctx.obsolete(): if ctx.extinct(): return 'extinct' @@ -677,7 +675,6 @@ and ex.hint is None): ex.hint = hint raise - return result def summaryhook(ui, repo): def write(fmt, count): @@ -1036,11 +1033,10 @@ rev = nm.get(mark[0]) if rev is not None: ctx = unfi[rev] - meta = obsolete.decodemeta(mark[3]) - for i, p in enumerate(ctx.parents(), 1): - meta['p%i' % i] = p.hex() + parents = tuple(p.node() for p in ctx.parents()) before = len(store._all) - store.create(tr, mark[0], mark[1], mark[2], metadata=meta) + store.create(tr, mark[0], mark[1], mark[2], marks[3], + parents=parents) if len(store._all) - before: ui.write('created new markers for %i\n' % rev) ui.progress(pgop, idx, total=pgtotal) @@ -1315,8 +1311,6 @@ elif 'bumped' in troubles: return _solvebumped(ui, repo, tro, dryrunopt, confirmopt, progresscb) elif 'divergent' in troubles: - repo = repo.unfiltered() - tro = repo[tro.rev()] return _solvedivergent(ui, repo, tro, dryrunopt, confirmopt, progresscb) else: @@ -2148,10 +2142,7 @@ repo._bookmarks.write() return result finally: - if lock is not None: - lock.release() - if wlock is not None: - wlock.release() + lockmod.release(lock, wlock) @eh.wrapcommand('strip', extension='strip', opts=[ ('', 'bundle', None, _("delete the commit entirely and move it to a " @@ -2200,40 +2191,37 @@ return 1 if not duplicate and repo.revs('public() and %ld', revs): raise util.Abort("can't touch public revision") - wlock = lock = None + wlock = lock = tr = None try: wlock = repo.wlock() lock = repo.lock() tr = repo.transaction('touch') revs.sort() # ensure parent are run first newmapping = {} - try: - for r in revs: - ctx = repo[r] - extra = ctx.extra().copy() - extra['__touch-noise__'] = random.randint(0, 0xffffffff) - # search for touched parent - p1 = ctx.p1().node() - p2 = ctx.p2().node() - p1 = newmapping.get(p1, p1) - p2 = newmapping.get(p2, p2) - new, unusedvariable = rewrite(repo, ctx, [], ctx, - [p1, p2], - commitopts={'extra': extra}) - # store touched version to help potential children - newmapping[ctx.node()] = new - if not duplicate: - obsolete.createmarkers(repo, [(ctx, (repo[new],))]) - phases.retractboundary(repo, tr, ctx.phase(), [new]) - if ctx in repo[None].parents(): - repo.dirstate.beginparentchange() - repo.dirstate.setparents(new, node.nullid) - repo.dirstate.endparentchange() - tr.close() - finally: - tr.release() + for r in revs: + ctx = repo[r] + extra = ctx.extra().copy() + extra['__touch-noise__'] = random.randint(0, 0xffffffff) + # search for touched parent + p1 = ctx.p1().node() + p2 = ctx.p2().node() + p1 = newmapping.get(p1, p1) + p2 = newmapping.get(p2, p2) + new, unusedvariable = rewrite(repo, ctx, [], ctx, + [p1, p2], + commitopts={'extra': extra}) + # store touched version to help potential children + newmapping[ctx.node()] = new + if not duplicate: + obsolete.createmarkers(repo, [(ctx, (repo[new],))]) + phases.retractboundary(repo, tr, ctx.phase(), [new]) + if ctx in repo[None].parents(): + repo.dirstate.beginparentchange() + repo.dirstate.setparents(new, node.nullid) + repo.dirstate.endparentchange() + tr.close() finally: - lockmod.release(lock, wlock) + lockmod.release(tr, lock, wlock) @command('^fold|squash', [('r', 'rev', [], _("revision to fold")), @@ -2611,8 +2599,6 @@ pushop.ui.debug('try to push obsolete markers to remote\n') repo = pushop.repo remote = pushop.remote - unfi = repo.unfiltered() - cl = unfi.changelog if (obsolete.isenabled(repo, obsolete.exchangeopt) and repo.obsstore and 'obsolete' in remote.listkeys('namespaces')): markers = pushop.outobsmarkers @@ -2691,18 +2677,16 @@ @eh.addattr(localrepo.localpeer, 'evoext_pushobsmarkers_0') def local_pushobsmarkers(peer, obsfile): data = obsfile.read() - lock = peer._repo.lock() + tr = lock = None try: + lock = peer._repo.lock() tr = peer._repo.transaction('pushkey: obsolete markers') - try: - new = peer._repo.obsstore.mergemarkers(tr, data) - if new is not None: - obsexcmsg(peer._repo.ui, "%i obsolescence markers added\n" % new, True) - tr.close() - finally: - tr.release() + new = peer._repo.obsstore.mergemarkers(tr, data) + if new is not None: + obsexcmsg(peer._repo.ui, "%i obsolescence markers added\n" % new, True) + tr.close() finally: - lock.release() + lockmod.release(tr, lock) peer._repo.hook('evolve_pushobsmarkers') def srv_pushobsmarkers(repo, proto): @@ -2712,18 +2696,16 @@ proto.getfile(fp) data = fp.getvalue() fp.close() - lock = repo.lock() + tr = lock = None try: + lock = repo.lock() tr = repo.transaction('pushkey: obsolete markers') - try: - new = repo.obsstore.mergemarkers(tr, data) - if new is not None: - obsexcmsg(repo.ui, "%i obsolescence markers added\n" % new, True) - tr.close() - finally: - tr.release() + new = repo.obsstore.mergemarkers(tr, data) + if new is not None: + obsexcmsg(repo.ui, "%i obsolescence markers added\n" % new, True) + tr.close() finally: - lock.release() + lockmod.release(tr, lock) repo.hook('evolve_pushobsmarkers') return wireproto.pushres(0) @@ -2733,7 +2715,6 @@ Its a separed functio to play around with strategy for that.""" repo = pullop.repo - cl = pullop.repo.changelog remote = pullop.remote unfi = repo.unfiltered() revs = unfi.revs('::(%ln - null)', pullop.common)