diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -296,10 +296,11 @@ class localrepository(repo.repository): 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 @@ test custom commit messages $ 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