[PATCH 1 of 2 STABLE V2] tag: don't check .hgtags status if --local passed

Kevin Bullock kbullock+mercurial at ringworld.org
Tue Dec 14 11:44:51 CST 2010


# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1292296830 21600
# Branch stable
# Node ID d3e7418583b79096a6e6a6c02e3329de02a1fe1a
# Parent  ecf7d6e0eef048771314ce1c85bbd4aed7391bca
tag: don't check .hgtags status if --local passed

Local tags don't create a commit, so we don't need to check the status
of .hgtags.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -296,10 +296,11 @@
 
         date: date tuple to use if committing'''
 
-        for x in self.status()[:5]:
-            if '.hgtags' in x:
-                raise util.Abort(_('working copy of .hgtags is changed '
-                                   '(please commit .hgtags manually)'))
+        if not local:
+            for x in self.status()[:5]:
+                if '.hgtags' in x:
+                    raise util.Abort(_('working copy of .hgtags is changed '
+                                       '(please commit .hgtags manually)'))
 
         self.tags() # instantiate the cache
         self._tag(names, node, message, local, user, date)
diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -196,3 +196,15 @@
   $ hg log -l1 --template "{desc}\n"
   custom tag message
   second line
+
+local tag with .hgtags modified
+
+  $ hg tag hgtags-modified
+  $ hg rollback
+  rolling back to revision 11 (undo commit)
+  $ hg st
+  M .hgtags
+  ? .hgtags.orig
+  ? editor
+  $ hg tag --local baz
+  $ hg revert --no-backup .hgtags


More information about the Mercurial-devel mailing list