comparison mercurial/commands.py @ 609:2acf1f5df2e6

[PATCH] hg tag: local tag support in file .hg/localtags -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] hg tag: local tag support in file .hg/localtags From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> Support local tags in .hg/localtags Also minor cleanups in related functions manifest hash: 553b2e896fed3c9055ed18482ce15cfaa4fc41ce -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCyYdJywK+sNU5EO8RAhohAKC2I3U44EXi+k4ofo5AWHBOg+94bgCfcbzs VQ2yWkPPHZycjtswOBmepa8= =v5AX -----END PGP SIGNATURE-----
author Matt Mackall <mpm@selenic.com>
date Mon, 04 Jul 2005 11:00:25 -0800
parents 94744f6fe0e7
children 4c02464cb9f0
comparison
equal deleted inserted replaced
608:d2994b5298fb 609:2acf1f5df2e6
647 else: 647 else:
648 a = revs.pop(0) 648 a = revs.pop(0)
649 b = revs.pop(0) 649 b = revs.pop(0)
650 off = a > b and -1 or 1 650 off = a > b and -1 or 1
651 revlist.extend(range(a, b + off, off)) 651 revlist.extend(range(a, b + off, off))
652
652 for i in revlist or range(log.count() - 1, -1, -1): 653 for i in revlist or range(log.count() - 1, -1, -1):
653 show_changeset(ui, repo, filelog=filelog, rev=i) 654 show_changeset(ui, repo, filelog=filelog, rev=i)
654 655
655 def manifest(ui, repo, rev = []): 656 def manifest(ui, repo, rev = []):
656 """output the latest or given revision of the project manifest""" 657 """output the latest or given revision of the project manifest"""
849 """add a tag for the current tip or a given revision""" 850 """add a tag for the current tip or a given revision"""
850 851
851 if name == "tip": 852 if name == "tip":
852 ui.warn("abort: 'tip' is a reserved name!\n") 853 ui.warn("abort: 'tip' is a reserved name!\n")
853 return -1 854 return -1
855 if rev:
856 r = hg.hex(repo.lookup(rev))
857 else:
858 r = hg.hex(repo.changelog.tip())
859
854 if name.find(revrangesep) >= 0: 860 if name.find(revrangesep) >= 0:
855 ui.warn("abort: '%s' cannot be used in a tag name\n" % revrangesep) 861 ui.warn("abort: '%s' cannot be used in a tag name\n" % revrangesep)
856 return -1 862 return -1
863
864 if opts['local']:
865 repo.opener("localtags", "a").write("%s %s\n" % (r, name))
866 return
857 867
858 (c, a, d, u) = repo.changes(None, None) 868 (c, a, d, u) = repo.changes(None, None)
859 for x in (c, a, d, u): 869 for x in (c, a, d, u):
860 if ".hgtags" in x: 870 if ".hgtags" in x:
861 ui.warn("abort: working copy of .hgtags is changed!\n") 871 ui.warn("abort: working copy of .hgtags is changed!\n")
862 ui.status("(please commit .hgtags manually)\n") 872 ui.status("(please commit .hgtags manually)\n")
863 return -1 873 return -1
864
865 if rev:
866 r = hg.hex(repo.lookup(rev))
867 else:
868 r = hg.hex(repo.changelog.tip())
869 874
870 add = 0 875 add = 0
871 if not os.path.exists(repo.wjoin(".hgtags")): add = 1 876 if not os.path.exists(repo.wjoin(".hgtags")): add = 1
872 repo.wfile(".hgtags", "a").write("%s %s\n" % (r, name)) 877 repo.wfile(".hgtags", "a").write("%s %s\n" % (r, name))
873 if add: repo.add([".hgtags"]) 878 if add: repo.add([".hgtags"])
998 ('a', 'address', '', 'interface address'), 1003 ('a', 'address', '', 'interface address'),
999 ('n', 'name', os.getcwd(), 'repository name'), 1004 ('n', 'name', os.getcwd(), 'repository name'),
1000 ('t', 'templates', "", 'template map')], 1005 ('t', 'templates', "", 'template map')],
1001 "hg serve [options]"), 1006 "hg serve [options]"),
1002 "^status": (status, [], 'hg status'), 1007 "^status": (status, [], 'hg status'),
1003 "tag": (tag, [('t', 'text', "", 'commit text'), 1008 "tag": (tag, [('l', 'local', None, 'make the tag local'),
1009 ('t', 'text', "", 'commit text'),
1004 ('d', 'date', "", 'date code'), 1010 ('d', 'date', "", 'date code'),
1005 ('u', 'user', "", 'user')], 1011 ('u', 'user', "", 'user')],
1006 'hg tag [options] <name> [rev]'), 1012 'hg tag [options] <name> [rev]'),
1007 "tags": (tags, [], 'hg tags'), 1013 "tags": (tags, [], 'hg tags'),
1008 "tip": (tip, [], 'hg tip'), 1014 "tip": (tip, [], 'hg tip'),