Mercurial > hg
comparison hgext/hgk.py @ 3059:3dab573a4330
hgk: use short changeset hashes
this fixes the missing tags on hgk window
author | TK Soh <teekaysoh@yahoo.com> |
---|---|
date | Thu, 24 Aug 2006 16:12:23 -0500 |
parents | abcd6ae3cf5a |
children | aa1cee5b8afb |
comparison
equal
deleted
inserted
replaced
3058:11e3396e3a2b | 3059:3dab573a4330 |
---|---|
85 date1 = date(change) | 85 date1 = date(change) |
86 empty = "0" * 40; | 86 empty = "0" * 40; |
87 | 87 |
88 for f in modified: | 88 for f in modified: |
89 # TODO get file permissions | 89 # TODO get file permissions |
90 print ":100664 100664 %s %s M\t%s\t%s" % (hg.hex(mmap[f]), | 90 print ":100664 100664 %s %s M\t%s\t%s" % (hg.short(mmap[f]), |
91 hg.hex(mmap2[f]), f, f) | 91 hg.short(mmap2[f]), |
92 f, f) | |
92 for f in added: | 93 for f in added: |
93 print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.hex(mmap2[f]), f, f) | 94 print ":000000 100664 %s %s N\t%s\t%s" % (empty, |
95 hg.short(mmap2[f]), | |
96 f, f) | |
94 for f in removed: | 97 for f in removed: |
95 print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f) | 98 print ":100664 000000 %s %s D\t%s\t%s" % (hg.short(mmap[f]), |
99 empty, | |
100 f, f) | |
96 ## | 101 ## |
97 | 102 |
98 while True: | 103 while True: |
99 if opts['stdin']: | 104 if opts['stdin']: |
100 try: | 105 try: |
122 break | 127 break |
123 | 128 |
124 def catcommit(repo, n, prefix, changes=None): | 129 def catcommit(repo, n, prefix, changes=None): |
125 nlprefix = '\n' + prefix; | 130 nlprefix = '\n' + prefix; |
126 (p1, p2) = repo.changelog.parents(n) | 131 (p1, p2) = repo.changelog.parents(n) |
127 (h, h1, h2) = map(hg.hex, (n, p1, p2)) | 132 (h, h1, h2) = map(hg.short, (n, p1, p2)) |
128 (i1, i2) = map(repo.changelog.rev, (p1, p2)) | 133 (i1, i2) = map(repo.changelog.rev, (p1, p2)) |
129 if not changes: | 134 if not changes: |
130 changes = repo.changelog.read(n) | 135 changes = repo.changelog.read(n) |
131 print "tree %s" % (hg.hex(changes[0])) | 136 print "tree %s" % (hg.short(changes[0])) |
132 if i1 != -1: print "parent %s" % (h1) | 137 if i1 != -1: print "parent %s" % (h1) |
133 if i2 != -1: print "parent %s" % (h2) | 138 if i2 != -1: print "parent %s" % (h2) |
134 date_ar = changes[2] | 139 date_ar = changes[2] |
135 date = int(float(date_ar[0])) | 140 date = int(float(date_ar[0])) |
136 lines = changes[4].splitlines() | 141 lines = changes[4].splitlines() |
152 def base(ui, repo, node1, node2): | 157 def base(ui, repo, node1, node2): |
153 """Output common ancestor information""" | 158 """Output common ancestor information""" |
154 node1 = repo.lookup(node1) | 159 node1 = repo.lookup(node1) |
155 node2 = repo.lookup(node2) | 160 node2 = repo.lookup(node2) |
156 n = repo.changelog.ancestor(node1, node2) | 161 n = repo.changelog.ancestor(node1, node2) |
157 print hg.hex(n) | 162 print hg.short(n) |
158 | 163 |
159 def catfile(ui, repo, type=None, r=None, **opts): | 164 def catfile(ui, repo, type=None, r=None, **opts): |
160 """cat a specific revision""" | 165 """cat a specific revision""" |
161 # in stdin mode, every line except the commit is prefixed with two | 166 # in stdin mode, every line except the commit is prefixed with two |
162 # spaces. This way the our caller can find the commit without magic | 167 # spaces. This way the our caller can find the commit without magic |
274 if mask: | 279 if mask: |
275 parentstr = "" | 280 parentstr = "" |
276 if parents: | 281 if parents: |
277 pp = repo.changelog.parents(n) | 282 pp = repo.changelog.parents(n) |
278 if pp[0] != hg.nullid: | 283 if pp[0] != hg.nullid: |
279 parentstr += " " + hg.hex(pp[0]) | 284 parentstr += " " + hg.short(pp[0]) |
280 if pp[1] != hg.nullid: | 285 if pp[1] != hg.nullid: |
281 parentstr += " " + hg.hex(pp[1]) | 286 parentstr += " " + hg.short(pp[1]) |
282 if not full: | 287 if not full: |
283 print hg.hex(n) + parentstr | 288 print hg.short(n) + parentstr |
284 elif full is "commit": | 289 elif full is "commit": |
285 print hg.hex(n) + parentstr | 290 print hg.short(n) + parentstr |
286 catcommit(repo, n, ' ', changes) | 291 catcommit(repo, n, ' ', changes) |
287 else: | 292 else: |
288 (p1, p2) = repo.changelog.parents(n) | 293 (p1, p2) = repo.changelog.parents(n) |
289 (h, h1, h2) = map(hg.hex, (n, p1, p2)) | 294 (h, h1, h2) = map(hg.short, (n, p1, p2)) |
290 (i1, i2) = map(repo.changelog.rev, (p1, p2)) | 295 (i1, i2) = map(repo.changelog.rev, (p1, p2)) |
291 | 296 |
292 date = changes[2][0] | 297 date = changes[2][0] |
293 print "%s %s:%s" % (date, h, mask), | 298 print "%s %s:%s" % (date, h, mask), |
294 mask = is_reachable(want_sha1, reachable, p1) | 299 mask = is_reachable(want_sha1, reachable, p1) |