# HG changeset patch # User Pierre-Yves David # Date 1446221059 0 # Node ID 324cd13838f10ce74d6ff4fa988d301ebc135150 # Parent 4f7e0e0318a58601b17a2c6addaaa5710378087d evolve: have dirstate collaborate with transaction With 3.6, dirstate update can work with transaction to ensure proper rollback. We do it if the mercurial version permit it. diff -r 4f7e0e0318a5 -r 324cd13838f1 README --- a/README Fri Oct 09 16:21:30 2015 -0700 +++ b/README Fri Oct 30 16:04:19 2015 +0000 @@ -55,6 +55,7 @@ - split: add a new command to split changesets - add some progress data during changesets discovery +- take advantage of dirstate/transaction collaboration 5.2.1 -- diff -r 4f7e0e0318a5 -r 324cd13838f1 hgext/evolve.py --- a/hgext/evolve.py Fri Oct 09 16:21:30 2015 -0700 +++ b/hgext/evolve.py Fri Oct 30 16:04:19 2015 +0000 @@ -961,7 +961,7 @@ except util.Abort, exc: repo.dirstate.beginparentchange() repo.setparents(repo['.'].node(), nullid) - repo.dirstate.write() + writedirstate(repo.dirstate, tr) # fix up dirstate for copies and renames copies.duplicatecopies(repo, dest.rev(), orig.p1().rev()) repo.dirstate.endparentchange() @@ -1022,6 +1022,15 @@ except AttributeError: return repo._bookmarkcurrent +### dirstate compatibility layer < hg 3.6 + +def writedirstate(dirstate, tr): + if dirstate.write.func_defaults is not None: # mercurial 3.6 and above + return dirstate.write(tr) + return dirstate.write() + + + ### new command ############################# metadataopts = [