Show More
@@ -35,12 +35,22 b' vdiff on hovered and selected revisions.' | |||||
35 | ''' |
|
35 | ''' | |
36 |
|
36 | |||
37 | import os |
|
37 | import os | |
38 | from mercurial import commands, util, patch, revlog, scmutil |
|
38 | from mercurial import cmdutil, commands, util, patch, revlog, scmutil | |
39 | from mercurial.node import nullid, nullrev, short |
|
39 | from mercurial.node import nullid, nullrev, short | |
40 | from mercurial.i18n import _ |
|
40 | from mercurial.i18n import _ | |
41 |
|
41 | |||
|
42 | cmdtable = {} | |||
|
43 | command = cmdutil.command(cmdtable) | |||
42 | testedwith = 'internal' |
|
44 | testedwith = 'internal' | |
43 |
|
45 | |||
|
46 | @command('debug-diff-tree', | |||
|
47 | [('p', 'patch', None, _('generate patch')), | |||
|
48 | ('r', 'recursive', None, _('recursive')), | |||
|
49 | ('P', 'pretty', None, _('pretty')), | |||
|
50 | ('s', 'stdin', None, _('stdin')), | |||
|
51 | ('C', 'copy', None, _('detect copies')), | |||
|
52 | ('S', 'search', "", _('search'))], | |||
|
53 | ('hg git-diff-tree [OPTION]... NODE1 NODE2 [FILE]...')) | |||
44 | def difftree(ui, repo, node1=None, node2=None, *files, **opts): |
|
54 | def difftree(ui, repo, node1=None, node2=None, *files, **opts): | |
45 | """diff trees from two commits""" |
|
55 | """diff trees from two commits""" | |
46 | def __difftree(repo, node1, node2, files=[]): |
|
56 | def __difftree(repo, node1, node2, files=[]): | |
@@ -125,6 +135,7 b' def catcommit(ui, repo, n, prefix, ctx=N' | |||||
125 | if prefix: |
|
135 | if prefix: | |
126 | ui.write('\0') |
|
136 | ui.write('\0') | |
127 |
|
137 | |||
|
138 | @command('debug-merge-base', [], _('hg debug-merge-base REV REV')) | |||
128 | def base(ui, repo, node1, node2): |
|
139 | def base(ui, repo, node1, node2): | |
129 | """output common ancestor information""" |
|
140 | """output common ancestor information""" | |
130 | node1 = repo.lookup(node1) |
|
141 | node1 = repo.lookup(node1) | |
@@ -132,6 +143,9 b' def base(ui, repo, node1, node2):' | |||||
132 | n = repo.changelog.ancestor(node1, node2) |
|
143 | n = repo.changelog.ancestor(node1, node2) | |
133 | ui.write(short(n) + "\n") |
|
144 | ui.write(short(n) + "\n") | |
134 |
|
145 | |||
|
146 | @command('debug-cat-file', | |||
|
147 | [('s', 'stdin', None, _('stdin'))], | |||
|
148 | _('hg debug-cat-file [OPTION]... TYPE FILE')) | |||
135 | def catfile(ui, repo, type=None, r=None, **opts): |
|
149 | def catfile(ui, repo, type=None, r=None, **opts): | |
136 | """cat a specific revision""" |
|
150 | """cat a specific revision""" | |
137 | # in stdin mode, every line except the commit is prefixed with two |
|
151 | # in stdin mode, every line except the commit is prefixed with two | |
@@ -276,6 +290,9 b' def revtree(ui, args, repo, full="tree",' | |||||
276 | break |
|
290 | break | |
277 | count += 1 |
|
291 | count += 1 | |
278 |
|
292 | |||
|
293 | @command('debug-rev-parse', | |||
|
294 | [('', 'default', '', _('ignored'))], | |||
|
295 | _('hg debug-rev-parse REV')) | |||
279 | def revparse(ui, repo, *revs, **opts): |
|
296 | def revparse(ui, repo, *revs, **opts): | |
280 | """parse given revisions""" |
|
297 | """parse given revisions""" | |
281 | def revstr(rev): |
|
298 | def revstr(rev): | |
@@ -292,6 +309,12 b' def revparse(ui, repo, *revs, **opts):' | |||||
292 | # git rev-list tries to order things by date, and has the ability to stop |
|
309 | # git rev-list tries to order things by date, and has the ability to stop | |
293 | # at a given commit without walking the whole repo. TODO add the stop |
|
310 | # at a given commit without walking the whole repo. TODO add the stop | |
294 | # parameter |
|
311 | # parameter | |
|
312 | @command('debug-rev-list', | |||
|
313 | [('H', 'header', None, _('header')), | |||
|
314 | ('t', 'topo-order', None, _('topo-order')), | |||
|
315 | ('p', 'parents', None, _('parents')), | |||
|
316 | ('n', 'max-count', 0, _('max-count'))], | |||
|
317 | ('hg debug-rev-list [OPTION]... REV...')) | |||
295 | def revlist(ui, repo, *revs, **opts): |
|
318 | def revlist(ui, repo, *revs, **opts): | |
296 | """print revisions""" |
|
319 | """print revisions""" | |
297 | if opts['header']: |
|
320 | if opts['header']: | |
@@ -301,6 +324,7 b' def revlist(ui, repo, *revs, **opts):' | |||||
301 | copy = [x for x in revs] |
|
324 | copy = [x for x in revs] | |
302 | revtree(ui, copy, repo, full, opts['max_count'], opts['parents']) |
|
325 | revtree(ui, copy, repo, full, opts['max_count'], opts['parents']) | |
303 |
|
326 | |||
|
327 | @command('debug-config', [], _('hg debug-config')) | |||
304 | def config(ui, repo, **opts): |
|
328 | def config(ui, repo, **opts): | |
305 | """print extension options""" |
|
329 | """print extension options""" | |
306 | def writeopt(name, value): |
|
330 | def writeopt(name, value): | |
@@ -309,6 +333,10 b' def config(ui, repo, **opts):' | |||||
309 | writeopt('vdiff', ui.config('hgk', 'vdiff', '')) |
|
333 | writeopt('vdiff', ui.config('hgk', 'vdiff', '')) | |
310 |
|
334 | |||
311 |
|
335 | |||
|
336 | @command('view', | |||
|
337 | [('l', 'limit', '', | |||
|
338 | _('limit number of changes displayed'), _('NUM'))], | |||
|
339 | _('hg view [-l LIMIT] [REVRANGE]')) | |||
312 | def view(ui, repo, *etc, **opts): |
|
340 | def view(ui, repo, *etc, **opts): | |
313 | "start interactive history viewer" |
|
341 | "start interactive history viewer" | |
314 | os.chdir(repo.root) |
|
342 | os.chdir(repo.root) | |
@@ -317,40 +345,4 b' def view(ui, repo, *etc, **opts):' | |||||
317 | ui.debug("running %s\n" % cmd) |
|
345 | ui.debug("running %s\n" % cmd) | |
318 | util.system(cmd) |
|
346 | util.system(cmd) | |
319 |
|
347 | |||
320 | cmdtable = { |
|
|||
321 | "^view": |
|
|||
322 | (view, |
|
|||
323 | [('l', 'limit', '', |
|
|||
324 | _('limit number of changes displayed'), _('NUM'))], |
|
|||
325 | _('hg view [-l LIMIT] [REVRANGE]')), |
|
|||
326 | "debug-diff-tree": |
|
|||
327 | (difftree, |
|
|||
328 | [('p', 'patch', None, _('generate patch')), |
|
|||
329 | ('r', 'recursive', None, _('recursive')), |
|
|||
330 | ('P', 'pretty', None, _('pretty')), |
|
|||
331 | ('s', 'stdin', None, _('stdin')), |
|
|||
332 | ('C', 'copy', None, _('detect copies')), |
|
|||
333 | ('S', 'search', "", _('search'))], |
|
|||
334 | _('hg git-diff-tree [OPTION]... NODE1 NODE2 [FILE]...')), |
|
|||
335 | "debug-cat-file": |
|
|||
336 | (catfile, |
|
|||
337 | [('s', 'stdin', None, _('stdin'))], |
|
|||
338 | _('hg debug-cat-file [OPTION]... TYPE FILE')), |
|
|||
339 | "debug-config": |
|
|||
340 | (config, [], _('hg debug-config')), |
|
|||
341 | "debug-merge-base": |
|
|||
342 | (base, [], _('hg debug-merge-base REV REV')), |
|
|||
343 | "debug-rev-parse": |
|
|||
344 | (revparse, |
|
|||
345 | [('', 'default', '', _('ignored'))], |
|
|||
346 | _('hg debug-rev-parse REV')), |
|
|||
347 | "debug-rev-list": |
|
|||
348 | (revlist, |
|
|||
349 | [('H', 'header', None, _('header')), |
|
|||
350 | ('t', 'topo-order', None, _('topo-order')), |
|
|||
351 | ('p', 'parents', None, _('parents')), |
|
|||
352 | ('n', 'max-count', 0, _('max-count'))], |
|
|||
353 | _('hg debug-rev-list [OPTION]... REV...')), |
|
|||
354 | } |
|
|||
355 |
|
||||
356 | commands.inferrepo += " debug-diff-tree debug-cat-file" |
|
348 | commands.inferrepo += " debug-diff-tree debug-cat-file" |
General Comments 0
You need to be logged in to leave comments.
Login now