diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1022,9 +1022,8 @@ def tag(ui, repo, name, rev=None, **opts ui.status("(please commit .hgtags manually)\n") return -1 - add = not os.path.exists(repo.wjoin(".hgtags")) repo.wfile(".hgtags", "ab").write("%s %s\n" % (r, name)) - if add: + if repo.dirstate.state(".hgtags") == '?': repo.add([".hgtags"]) if not opts['text']: