hgkw/keyword.py
changeset 278 232df68a0bcc
parent 277 c848b8e3089a
child 280 2088e409d360
--- a/hgkw/keyword.py	Wed Oct 17 23:53:59 2007 +0200
+++ b/hgkw/keyword.py	Thu Oct 18 09:38:05 2007 +0200
@@ -104,9 +104,11 @@
 except AttributeError:
     bail_if_changed = commands.bail_if_changed
 
-def _pathto(repo, cwd, f):
+def _pathto(repo, f, cwd=None):
     '''kwfiles behaves similar to status, using pathto since 78b6add1f966.'''
     try:
+        if cwd is None:
+            cwd = repo.getcwd()
         return repo.pathto(f, cwd)
     except AttributeError:
         return f
@@ -350,13 +352,10 @@
                     break
             if not f in files and match(f) and _iskwfile(ui, man, f):
                 files.append(f)
-        if fdict:
-            ffiles = fdict.keys()
-            ffiles.sort()
-            cwd = repo.getcwd()
-            for f in ffiles:
-                ui.warn(_('%s: No such file in working copy\n')
-                        % _pathto(repo, cwd, f))
+        ffiles = fdict.keys()
+        ffiles.sort()
+        for f in ffiles:
+            ui.warn(_('%s: No such file in working copy\n') % _pathto(repo, f))
         # 7th argument sets commit to False
         _overwrite(ui, repo, files, ctx.node(), man, expand, False)
     finally:
@@ -406,11 +405,11 @@
     if not ignore:
         format = ('%s\n', 'K %s\n')[flag]
         for k in kwfiles:
-            ui.write(format % _pathto(repo, cwd, k))
+            ui.write(format % _pathto(repo, k, cwd))
     if allf or ignore:
         format = ('%s\n', 'I %s\n')[flag]
         for i in [f for f in files if f not in kwfiles]:
-            ui.write(format % _pathto(repo, cwd, i))
+            ui.write(format % _pathto(repo, i, cwd))
 
 def demo(ui, repo, *args, **opts):
     '''print [keywordmaps] configuration and an expansion example