hgkw/keyword.py
changeset 250 b28a2832cba4
parent 248 2c222367dab3
child 251 b37f2f065a9c
--- a/hgkw/keyword.py	Fri Sep 21 20:22:21 2007 +0100
+++ b/hgkw/keyword.py	Sun Sep 23 12:22:13 2007 +0100
@@ -80,8 +80,8 @@
         Or, better, use bundle/unbundle to share changes.
 '''
 
-from mercurial import commands, cmdutil, context, fancyopts, filelog
-from mercurial import localrepo, revlog, templater, util, hg
+from mercurial import commands, cmdutil, context, fancyopts
+from mercurial import filelog, localrepo, revlog, templater, util
 from mercurial.i18n import gettext as _
 import getopt, re, shutil, sys, tempfile, time
 
@@ -326,8 +326,6 @@
         lock = repo.lock()
         bail_if_changed(repo)
         ctx = repo.changectx()
-        if not ctx:
-            raise hg.RepoError(_('no revision checked out'))
         kwfmatcher = _keywordmatcher(ui, repo)
         if kwfmatcher is None:
             ui.warn(_('no files configured for keyword expansion\n'))
@@ -337,12 +335,10 @@
             cwd = repo.getcwd()
             files = [util.canonpath(repo.root, cwd, f) for f in files]
         files = _weedcandidates(man, kwfmatcher, files)
-        if not files:
-            ui.warn(_('files not configured for expansion or untracked\n'))
-            return
-        kwt = kwtemplater(ui, repo, expand, node=ctx.node())
-        # 3rd argument sets commit to False
-        kwt.overwrite(files, man, False)
+        if files:
+            kwt = kwtemplater(ui, repo, expand, node=ctx.node())
+            # 3rd argument sets commit to False
+            kwt.overwrite(files, man, False)
     finally:
         del wlock, lock