Show More
@@ -30,15 +30,29 b' proc getcommits {rargs} {' | |||||
30 | set startmsecs [clock clicks -milliseconds] |
|
30 | set startmsecs [clock clicks -milliseconds] | |
31 | set nextupdate [expr $startmsecs + 100] |
|
31 | set nextupdate [expr $startmsecs + 100] | |
32 | set ncmupdate 1 |
|
32 | set ncmupdate 1 | |
|
33 | set limit 0 | |||
|
34 | set revargs {} | |||
|
35 | for {set i 0} {$i < [llength $rargs]} {incr i} { | |||
|
36 | set opt [lindex $rargs $i] | |||
|
37 | if {$opt == "--limit"} { | |||
|
38 | incr i | |||
|
39 | set limit [lindex $rargs $i] | |||
|
40 | } else { | |||
|
41 | lappend revargs $opt | |||
|
42 | } | |||
|
43 | } | |||
33 | if [catch { |
|
44 | if [catch { | |
34 | set parse_args [concat --default HEAD $rargs] |
|
45 | set parse_args [concat --default HEAD $revargs] | |
35 | set parsed_args [split [eval exec hg debug-rev-parse $parse_args] "\n"] |
|
46 | set parsed_args [split [eval exec hg debug-rev-parse $parse_args] "\n"] | |
36 | }] { |
|
47 | } err] { | |
37 | # if git-rev-parse failed for some reason... |
|
48 | # if git-rev-parse failed for some reason... | |
38 | if {$rargs == {}} { |
|
49 | if {$rargs == {}} { | |
39 | set rargs HEAD |
|
50 | set revargs HEAD | |
40 | } |
|
51 | } | |
41 | set parsed_args $rargs |
|
52 | set parsed_args $revargs | |
|
53 | } | |||
|
54 | if {$limit > 0} { | |||
|
55 | set parsed_args [concat -n $limit $parsed_args] | |||
42 | } |
|
56 | } | |
43 | if [catch { |
|
57 | if [catch { | |
44 | set commfd [open "|hg debug-rev-list --header --topo-order --parents $parsed_args" r] |
|
58 | set commfd [open "|hg debug-rev-list --header --topo-order --parents $parsed_args" r] |
@@ -7,7 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from mercurial.demandload import * |
|
8 | from mercurial.demandload import * | |
9 | demandload(globals(), 'time sys signal os') |
|
9 | demandload(globals(), 'time sys signal os') | |
10 | demandload(globals(), 'mercurial:hg,fancyopts,commands,ui,util,patch') |
|
10 | demandload(globals(), 'mercurial:hg,fancyopts,commands,ui,util,patch,revlog') | |
11 |
|
11 | |||
12 | def difftree(ui, repo, node1=None, node2=None, *files, **opts): |
|
12 | def difftree(ui, repo, node1=None, node2=None, *files, **opts): | |
13 | """diff trees from two commits""" |
|
13 | """diff trees from two commits""" | |
@@ -217,7 +217,6 b' def revtree(args, repo, full="tree", max' | |||||
217 |
|
217 | |||
218 | # walk the repository looking for commits that are in our |
|
218 | # walk the repository looking for commits that are in our | |
219 | # reachability graph |
|
219 | # reachability graph | |
220 | #for i in range(repo.changelog.count()-1, -1, -1): |
|
|||
221 | for i, changes in chlogwalk(): |
|
220 | for i, changes in chlogwalk(): | |
222 | n = repo.changelog.node(i) |
|
221 | n = repo.changelog.node(i) | |
223 | mask = is_reachable(want_sha1, reachable, n) |
|
222 | mask = is_reachable(want_sha1, reachable, n) | |
@@ -252,6 +251,19 b' def revtree(args, repo, full="tree", max' | |||||
252 | break |
|
251 | break | |
253 | count += 1 |
|
252 | count += 1 | |
254 |
|
253 | |||
|
254 | def revparse(ui, repo, *revs, **opts): | |||
|
255 | """Parse given revisions""" | |||
|
256 | def revstr(rev): | |||
|
257 | if rev == 'HEAD': | |||
|
258 | rev = 'tip' | |||
|
259 | return revlog.hex(repo.lookup(rev)) | |||
|
260 | ||||
|
261 | for r in revs: | |||
|
262 | revrange = r.split(':', 1) | |||
|
263 | ui.write('%s\n' % revstr(revrange[0])) | |||
|
264 | if len(revrange) == 2: | |||
|
265 | ui.write('^%s\n' % revstr(revrange[1])) | |||
|
266 | ||||
255 | # git rev-list tries to order things by date, and has the ability to stop |
|
267 | # git rev-list tries to order things by date, and has the ability to stop | |
256 | # at a given commit without walking the whole repo. TODO add the stop |
|
268 | # at a given commit without walking the whole repo. TODO add the stop | |
257 | # parameter |
|
269 | # parameter | |
@@ -264,13 +276,16 b' def revlist(ui, repo, *revs, **opts):' | |||||
264 | copy = [x for x in revs] |
|
276 | copy = [x for x in revs] | |
265 | revtree(copy, repo, full, opts['max_count'], opts['parents']) |
|
277 | revtree(copy, repo, full, opts['max_count'], opts['parents']) | |
266 |
|
278 | |||
267 | def view(ui, repo, *etc): |
|
279 | def view(ui, repo, *etc, **opts): | |
268 | "start interactive history viewer" |
|
280 | "start interactive history viewer" | |
269 | os.chdir(repo.root) |
|
281 | os.chdir(repo.root) | |
270 | os.system(ui.config("hgk", "path", "hgk") + " " + " ".join(etc)) |
|
282 | optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems()]) | |
|
283 | os.system(ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))) | |||
271 |
|
284 | |||
272 | cmdtable = { |
|
285 | cmdtable = { | |
273 |
"view": (view, |
|
286 | "view": (view, | |
|
287 | [('l', 'limit', '', 'limit number of changes displayed')], | |||
|
288 | 'hg view [-l LIMIT] [REVRANGE]'), | |||
274 | "debug-diff-tree": (difftree, [('p', 'patch', None, 'generate patch'), |
|
289 | "debug-diff-tree": (difftree, [('p', 'patch', None, 'generate patch'), | |
275 | ('r', 'recursive', None, 'recursive'), |
|
290 | ('r', 'recursive', None, 'recursive'), | |
276 | ('P', 'pretty', None, 'pretty'), |
|
291 | ('P', 'pretty', None, 'pretty'), | |
@@ -281,6 +296,9 b' cmdtable = {' | |||||
281 | "debug-cat-file": (catfile, [('s', 'stdin', None, 'stdin')], |
|
296 | "debug-cat-file": (catfile, [('s', 'stdin', None, 'stdin')], | |
282 | "hg debug-cat-file [options] type file"), |
|
297 | "hg debug-cat-file [options] type file"), | |
283 | "debug-merge-base": (base, [], "hg debug-merge-base node node"), |
|
298 | "debug-merge-base": (base, [], "hg debug-merge-base node node"), | |
|
299 | 'debug-rev-parse': (revparse, | |||
|
300 | [('', 'default', '', 'ignored')], | |||
|
301 | "hg debug-rev-parse rev"), | |||
284 | "debug-rev-list": (revlist, [('H', 'header', None, 'header'), |
|
302 | "debug-rev-list": (revlist, [('H', 'header', None, 'header'), | |
285 | ('t', 'topo-order', None, 'topo-order'), |
|
303 | ('t', 'topo-order', None, 'topo-order'), | |
286 | ('p', 'parents', None, 'parents'), |
|
304 | ('p', 'parents', None, 'parents'), |
General Comments 0
You need to be logged in to leave comments.
Login now