hgkw/keyword.py
changeset 286 0dac9b324b03
parent 285 0aa02d36b3b1
child 287 62eff490c844
--- a/hgkw/keyword.py	Wed Oct 24 00:38:27 2007 +0200
+++ b/hgkw/keyword.py	Wed Oct 24 09:43:59 2007 +0200
@@ -315,10 +315,9 @@
 
 def _overwrite(ui, repo, files, node, man, expand, commit):
     '''Passes given files to kwtemplater for overwriting.'''
-    if files:
-        files.sort()
-        kwt = kwtemplater(ui, repo, expand, node=node)
-        kwt.overwrite(files, man, commit)
+    files.sort()
+    kwt = kwtemplater(ui, repo, expand, node=node)
+    kwt.overwrite(files, man, commit)
 
 def _kwfwrite(ui, repo, expand, *pats, **opts):
     '''Selects files and passes them to _overwrite.'''
@@ -333,8 +332,9 @@
         ctx = repo.changectx()
         man = ctx.manifest()
         candidates = [f for f in clean if _iskwfile(ui, man, f)]
-        # 7th argument sets commit to False
-        _overwrite(ui, repo, candidates, ctx.node(), man, expand, False)
+        if candidates:
+            # 7th argument sets commit to False
+            _overwrite(ui, repo, candidates, ctx.node(), man, expand, False)
     finally:
         del wlock, lock
 
@@ -542,8 +542,9 @@
                     mn = self.manifest.read(cl[0])
                     candidates = [f for f in cl[3] if mn.has_key(f)
                                   and _iskwfile(ui, mn, f)]
-                    # 6th, 7th arguments set expansion, commit to True
-                    _overwrite(ui, self, candidates, node, mn, True, True)
+                    if candidates:
+                        # 6th, 7th arguments set expansion, commit to True
+                        _overwrite(ui, self, candidates, node, mn, True, True)
                 return node
             finally:
                 del _wlock, _lock