Show More
@@ -649,6 +649,7 b' def log(ui, repo, f=None, **opts):' | |||||
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 | |||
@@ -851,10 +852,19 b' def tag(ui, repo, name, rev = None, **op' | |||||
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 | |
857 |
|
863 | |||
|
864 | if opts['local']: | |||
|
865 | repo.opener("localtags", "a").write("%s %s\n" % (r, name)) | |||
|
866 | return | |||
|
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: | |
@@ -862,11 +872,6 b' def tag(ui, repo, name, rev = None, **op' | |||||
862 | ui.status("(please commit .hgtags manually)\n") |
|
872 | ui.status("(please commit .hgtags manually)\n") | |
863 | return -1 |
|
873 | return -1 | |
864 |
|
874 | |||
865 | if rev: |
|
|||
866 | r = hg.hex(repo.lookup(rev)) |
|
|||
867 | else: |
|
|||
868 | r = hg.hex(repo.changelog.tip()) |
|
|||
869 |
|
||||
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)) | |
@@ -1000,7 +1005,8 b' table = {' | |||||
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, [(' |
|
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]'), |
@@ -438,6 +438,13 b' class localrepository:' | |||||
438 | '''return a mapping of tag to node''' |
|
438 | '''return a mapping of tag to node''' | |
439 | if not self.tagscache: |
|
439 | if not self.tagscache: | |
440 | self.tagscache = {} |
|
440 | self.tagscache = {} | |
|
441 | def addtag(self, k, n): | |||
|
442 | try: | |||
|
443 | bin_n = bin(n) | |||
|
444 | except TypeError: | |||
|
445 | bin_n = '' | |||
|
446 | self.tagscache[k.strip()] = bin_n | |||
|
447 | ||||
441 | try: |
|
448 | try: | |
442 | # read each head of the tags file, ending with the tip |
|
449 | # read each head of the tags file, ending with the tip | |
443 | # and add each tag found to the map, with "newer" ones |
|
450 | # and add each tag found to the map, with "newer" ones | |
@@ -449,22 +456,20 b' class localrepository:' | |||||
449 | for l in fl.revision(r).splitlines(): |
|
456 | for l in fl.revision(r).splitlines(): | |
450 | if l: |
|
457 | if l: | |
451 | n, k = l.split(" ", 1) |
|
458 | n, k = l.split(" ", 1) | |
452 |
|
|
459 | addtag(self, k, n) | |
453 | bin_n = bin(n) |
|
|||
454 | except TypeError: |
|
|||
455 | bin_n = '' |
|
|||
456 | self.tagscache[k.strip()] = bin_n |
|
|||
457 | except KeyError: |
|
460 | except KeyError: | |
458 | pass |
|
461 | pass | |
459 | for k, n in self.ui.configitems("tags"): |
|
462 | ||
460 |
|
|
463 | try: | |
461 | bin_n = bin(n) |
|
464 | f = self.opener("localtags") | |
462 |
|
|
465 | for l in f: | |
463 |
|
|
466 | n, k = l.split(" ", 1) | |
464 | self.tagscache[k] = bin_n |
|
467 | addtag(self, k, n) | |
465 |
|
468 | except IOError: | ||
|
469 | pass | |||
|
470 | ||||
466 | self.tagscache['tip'] = self.changelog.tip() |
|
471 | self.tagscache['tip'] = self.changelog.tip() | |
467 |
|
472 | |||
468 | return self.tagscache |
|
473 | return self.tagscache | |
469 |
|
474 | |||
470 | def tagslist(self): |
|
475 | def tagslist(self): |
General Comments 0
You need to be logged in to leave comments.
Login now