[PATCH] keyword: move common code out of commit condition

Christian Ebert blacktrash at gmx.net
Fri Nov 14 13:52:48 CST 2008


Dirkjan,

Thanks for polishing up my previous patch and for getting rid of
the getnode function.

All that's left for me is to get rid of 2 more lines of code ;-)

c


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1226692080 -3600
# Node ID b716a1aaae0513ce93639da3740576bb0b5c3c7e
# Parent  9f1370130a45f3300f2cd4ed3b2cd16fa170058d
keyword: move common code out of commit condition

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -165,14 +165,12 @@
 
     def overwrite(self, node, expand, files):
         '''Overwrites selected files expanding/shrinking keywords.'''
+        ctx = self.repo[node]
+        mf = ctx.manifest()
         if node is not None:     # commit
-            ctx = self.repo[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[None]
-            mf = ctx.manifest()
             notify = self.ui.note
         candidates = [f for f in files if self.iskwfile(f, ctx.flags)]
         if candidates:



More information about the Mercurial-devel mailing list