context: avoid using None for working parent stable
authorMatt Mackall <mpm@selenic.com>
Wed, 25 Jun 2008 17:35:20 -0500
branchstable
changeset 467 1dfcc2e2cdb3
parent 466 ddb8a222249b
child 468 235800d4708a
context: avoid using None for working parent [ original upstream description ]
hgkw/keyword.py
--- a/hgkw/keyword.py	Wed Jun 25 17:34:28 2008 -0500
+++ b/hgkw/keyword.py	Wed Jun 25 17:35:20 2008 -0500
@@ -173,12 +173,14 @@
 
     def overwrite(self, node, expand, files):
         '''Overwrites selected files expanding/shrinking keywords.'''
-        ctx = self.repo.changectx(node)
-        mf = ctx.manifest()
         if node is not None:     # commit
+            ctx = self.repo.changectx(node)
+            mf = ctx.manifest()
             files = [f for f in ctx.files() if f in mf]
             notify = self.ui.debug
         else:                    # kwexpand/kwshrink
+            ctx = self.repo.changectx('.')
+            mf = ctx.manifest()
             notify = self.ui.note
         candidates = [f for f in files if self.iskwfile(f, mf.linkf)]
         if candidates:
@@ -513,7 +515,7 @@
         comparing against working dir.'''
         if node2 is not None:
             kwt.matcher = util.never
-        elif node1 is not None and node1 != repo.changectx().node():
+        elif node1 is not None and node1 != repo.changectx('.').node():
             kwt.restrict = True
         patch_diff(repo, node1, node2, match, fp, changes, opts)