diff hgext/uncommit.py @ 35210:9e339c97fabb

unamend: drop unused vars, query after taking lock, use ctx.hex() for extras This is the followup of review on D821. Differential Revision: https://phab.mercurial-scm.org/D1579
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 03 Dec 2017 00:29:51 +0530
parents 9dadcb99cc17
children 98f97eb20597
line wrap: on
line diff
--- a/hgext/uncommit.py	Fri Dec 01 22:40:55 2017 -0500
+++ b/hgext/uncommit.py	Sun Dec 03 00:29:51 2017 +0530
@@ -212,11 +212,11 @@
     """
 
     unfi = repo.unfiltered()
+    with repo.wlock(), repo.lock(), repo.transaction('unamend'):
 
-    # identify the commit from which to unamend
-    curctx = repo['.']
+        # identify the commit from which to unamend
+        curctx = repo['.']
 
-    with repo.wlock(), repo.lock(), repo.transaction('unamend'):
         if not curctx.mutable():
             raise error.Abort(_('cannot unamend public changesets'))
 
@@ -235,7 +235,7 @@
         # add an extra so that we get a new hash
         # note: allowing unamend to undo an unamend is an intentional feature
         extras = predctx.extra()
-        extras['unamend_source'] = curctx.node()
+        extras['unamend_source'] = curctx.hex()
 
         def filectxfn(repo, ctx_, path):
             try:
@@ -259,14 +259,7 @@
             newprednode = repo.commitctx(newctx)
 
         newpredctx = repo[newprednode]
-
-        changedfiles = []
-        wctx = repo[None]
-        wm = wctx.manifest()
-        cm = newpredctx.manifest()
         dirstate = repo.dirstate
-        diff = cm.diff(wm)
-        changedfiles.extend(diff.iterkeys())
 
         with dirstate.parentchange():
             dirstate.setparents(newprednode, node.nullid)