Mercurial > hg
changeset 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 | 11e3396e3a2b |
children | 713de12d9ce5 |
files | contrib/hgk hgext/hgk.py |
diffstat | 2 files changed, 22 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/hgk Tue Sep 05 01:15:46 2006 +0200 +++ b/contrib/hgk Thu Aug 24 16:12:23 2006 -0500 @@ -100,7 +100,7 @@ set ids [string range $cmit 0 [expr {$j - 1}]] set ok 1 foreach id $ids { - if {![regexp {^[0-9a-f]{40}$} $id]} { + if {![regexp {^[0-9a-f]{12}$} $id]} { set ok 0 break } @@ -261,7 +261,7 @@ catch { set fd [open $f r] set line [read $fd 40] - if {[regexp {^[0-9a-f]{40}} $line id]} { + if {[regexp {^[0-9a-f]{12}} $line id]} { set name "$dname[file tail $f]" set otherrefids($name) $id lappend idotherrefs($id) $name @@ -1743,7 +1743,7 @@ } return } - if {![regexp {^[0-9a-f]{40}} $line id]} { + if {![regexp {^[0-9a-f]{12}} $line id]} { error_popup "Can't parse git-diff-tree output: $line" stopfindproc return @@ -1856,7 +1856,7 @@ } return } - if {[regexp {^([0-9a-f]{40}) \(from ([0-9a-f]{40})\)} $line match id p]} { + if {[regexp {^([0-9a-f]{12}) \(from ([0-9a-f]{12})\)} $line match id p]} { # start of a new string of diffs donefilediff set fdiffids [list $id $p] @@ -2014,7 +2014,7 @@ set start [$ctext index "end - 1c"] $ctext insert end $text $ctext insert end "\n" - set links [regexp -indices -all -inline {[0-9a-f]{40}} $text] + set links [regexp -indices -all -inline {[0-9a-f]{12}} $text] foreach l $links { set s [lindex $l 0] set e [lindex $l 1]
--- a/hgext/hgk.py Tue Sep 05 01:15:46 2006 +0200 +++ b/hgext/hgk.py Thu Aug 24 16:12:23 2006 -0500 @@ -87,12 +87,17 @@ for f in modified: # TODO get file permissions - print ":100664 100664 %s %s M\t%s\t%s" % (hg.hex(mmap[f]), - hg.hex(mmap2[f]), f, f) + print ":100664 100664 %s %s M\t%s\t%s" % (hg.short(mmap[f]), + hg.short(mmap2[f]), + f, f) for f in added: - print ":000000 100664 %s %s N\t%s\t%s" % (empty, hg.hex(mmap2[f]), f, f) + print ":000000 100664 %s %s N\t%s\t%s" % (empty, + hg.short(mmap2[f]), + f, f) for f in removed: - print ":100664 000000 %s %s D\t%s\t%s" % (hg.hex(mmap[f]), empty, f, f) + print ":100664 000000 %s %s D\t%s\t%s" % (hg.short(mmap[f]), + empty, + f, f) ## while True: @@ -124,11 +129,11 @@ def catcommit(repo, n, prefix, changes=None): nlprefix = '\n' + prefix; (p1, p2) = repo.changelog.parents(n) - (h, h1, h2) = map(hg.hex, (n, p1, p2)) + (h, h1, h2) = map(hg.short, (n, p1, p2)) (i1, i2) = map(repo.changelog.rev, (p1, p2)) if not changes: changes = repo.changelog.read(n) - print "tree %s" % (hg.hex(changes[0])) + print "tree %s" % (hg.short(changes[0])) if i1 != -1: print "parent %s" % (h1) if i2 != -1: print "parent %s" % (h2) date_ar = changes[2] @@ -154,7 +159,7 @@ node1 = repo.lookup(node1) node2 = repo.lookup(node2) n = repo.changelog.ancestor(node1, node2) - print hg.hex(n) + print hg.short(n) def catfile(ui, repo, type=None, r=None, **opts): """cat a specific revision""" @@ -276,17 +281,17 @@ if parents: pp = repo.changelog.parents(n) if pp[0] != hg.nullid: - parentstr += " " + hg.hex(pp[0]) + parentstr += " " + hg.short(pp[0]) if pp[1] != hg.nullid: - parentstr += " " + hg.hex(pp[1]) + parentstr += " " + hg.short(pp[1]) if not full: - print hg.hex(n) + parentstr + print hg.short(n) + parentstr elif full is "commit": - print hg.hex(n) + parentstr + print hg.short(n) + parentstr catcommit(repo, n, ' ', changes) else: (p1, p2) = repo.changelog.parents(n) - (h, h1, h2) = map(hg.hex, (n, p1, p2)) + (h, h1, h2) = map(hg.short, (n, p1, p2)) (i1, i2) = map(repo.changelog.rev, (p1, p2)) date = changes[2][0]