##// END OF EJS Templates
From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>...
mpm@selenic.com -
r401:af4848f8 default
parent child Browse files
Show More
@@ -0,0 +1,13 b''
1 #!/bin/sh -x
2
3 hg init
4 echo a > a
5 hg add a
6 hg commit -t "test" -u test -d "0 0"
7 hg history
8 hg tag -u test -d "0 0" "bleah"
9 hg history
10
11 echo foo >> .hgtags
12 hg tag -u test -d "0 0" "bleah2" || echo "failed"
13
@@ -0,0 +1,31 b''
1 + hg init
2 + echo a
3 + hg add a
4 + hg commit -t test -u test -d '0 0'
5 + hg history
6 changeset: 0:acb14030fe0a21b60322c440ad2d20cf7685a376
7 tag: tip
8 user: test
9 date: Thu Jan 1 00:00:00 1970
10 summary: test
11
12 + hg tag -u test -d '0 0' bleah
13 + hg history
14 changeset: 1:863197ef03781c4fc00276d83eb66c4cb9cd91df
15 tag: tip
16 user: test
17 date: Thu Jan 1 00:00:00 1970
18 summary: Added tag bleah for changeset acb14030fe0a21b60322c440ad2d20cf7685a376
19
20 changeset: 0:acb14030fe0a21b60322c440ad2d20cf7685a376
21 tag: bleah
22 user: test
23 date: Thu Jan 1 00:00:00 1970
24 summary: test
25
26 + echo foo
27 + hg tag -u test -d '0 0' bleah2
28 abort: working copy of .hgtags is changed!
29 (please commit .hgtags manually)
30 + echo failed
31 failed
@@ -566,6 +566,35 b' def status(ui, repo):'
566 for f in d: print "R", f
566 for f in d: print "R", f
567 for f in u: print "?", f
567 for f in u: print "?", f
568
568
569 def tag(ui, repo, name, rev = None, **opts):
570 """add a tag for the current tip or a given revision"""
571
572 if name == "tip":
573 ui.warn("abort: 'tip' is a reserved name!\n")
574 return -1
575
576 (c, a, d, u) = repo.diffdir(repo.root)
577 for x in (c, a, d, u):
578 if ".hgtags" in x:
579 ui.warn("abort: working copy of .hgtags is changed!\n")
580 ui.status("(please commit .hgtags manually)\n")
581 return -1
582
583 if rev:
584 r = hg.hex(repo.lookup(rev))
585 else:
586 r = hg.hex(repo.changelog.tip())
587
588 add = 0
589 if not os.path.exists(repo.wjoin(".hgtags")): add = 1
590 repo.wfile(".hgtags", "a").write("%s %s\n" % (r, name))
591 if add: repo.add([".hgtags"])
592
593 if not opts['text']:
594 opts['text'] = "Added tag %s for changeset %s" % (name, r)
595
596 repo.commit([".hgtags"], opts['text'], opts['user'], opts['date'])
597
569 def tags(ui, repo):
598 def tags(ui, repo):
570 """list repository tags"""
599 """list repository tags"""
571
600
@@ -667,6 +696,10 b' table = {'
667 ('t', 'templates', "", 'template map')],
696 ('t', 'templates', "", 'template map')],
668 "hg serve [options]"),
697 "hg serve [options]"),
669 "status": (status, [], 'hg status'),
698 "status": (status, [], 'hg status'),
699 "tag": (tag, [('t', 'text', "", 'commit text'),
700 ('d', 'date', "", 'date'),
701 ('u', 'user', "", 'user')],
702 'hg tag [options] <name> [rev]'),
670 "tags": (tags, [], 'hg tags'),
703 "tags": (tags, [], 'hg tags'),
671 "tip": (tip, [], 'hg tip'),
704 "tip": (tip, [], 'hg tip'),
672 "undo": (undo, [], 'hg undo'),
705 "undo": (undo, [], 'hg undo'),
@@ -26,6 +26,7 b' hg commands:'
26 remove remove the specified files on the next commit
26 remove remove the specified files on the next commit
27 serve export the repository via HTTP
27 serve export the repository via HTTP
28 status show changed files in the working directory
28 status show changed files in the working directory
29 tag add a tag for the current tip or a given revision
29 tags list repository tags
30 tags list repository tags
30 tip show the tip revision
31 tip show the tip revision
31 undo undo the last transaction
32 undo undo the last transaction
@@ -74,6 +75,7 b' hg commands:'
74 remove remove the specified files on the next commit
75 remove remove the specified files on the next commit
75 serve export the repository via HTTP
76 serve export the repository via HTTP
76 status show changed files in the working directory
77 status show changed files in the working directory
78 tag add a tag for the current tip or a given revision
77 tags list repository tags
79 tags list repository tags
78 tip show the tip revision
80 tip show the tip revision
79 undo undo the last transaction
81 undo undo the last transaction
General Comments 0
You need to be logged in to leave comments. Login now