[PATCH 2 of 2] keyword: retrieve added and modified files from commitctx

Christian Ebert blacktrash at gmx.net
Mon May 31 18:24:20 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1275348103 -7200
# Node ID 0d1c61172b6d1fb2a86685ca3669f7b9e7dbe7ca
# Parent  6f927a8163a2c0b961e0233391d40297b2fb7007
keyword: retrieve added and modified files from commitctx

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -194,7 +194,7 @@
         '''Overwrites selected files expanding/shrinking keywords.'''
         ctx = self.repo[node]
         mf = ctx.manifest()
-        if node is not None:     # commit, record
+        if self.record:
             candidates = [f for f in ctx.files() if f in mf]
         candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)]
         if candidates:
@@ -209,7 +209,7 @@
                 if util.binary(data):
                     continue
                 if expand:
-                    if node is None:
+                    if node is None: # kwexpand/kwshrink
                         ctx = self.repo.filectx(f, fileid=mf[f]).changectx()
                     data, found = self.substitute(data, f, ctx,
                                                   self.re_kw.subn)
@@ -499,7 +499,7 @@
             n = super(kwrepo, self).commitctx(ctx, error)
             # no lock needed, only called from repo.commit() which already locks
             if not kwt.record:
-                kwt.overwrite(n, True, None)
+                kwt.overwrite(n, True, sorted(ctx.added() + ctx.modified()))
             return n
 
     # monkeypatches


More information about the Mercurial-devel mailing list