Show More
@@ -36,7 +36,6 b' from . import (' | |||||
36 | changegroup, |
|
36 | changegroup, | |
37 | cmdutil, |
|
37 | cmdutil, | |
38 | copies, |
|
38 | copies, | |
39 | dagparser, |
|
|||
40 | dagutil, |
|
39 | dagutil, | |
41 | destutil, |
|
40 | destutil, | |
42 | dirstateguard, |
|
41 | dirstateguard, | |
@@ -1866,68 +1865,6 b' def copy(ui, repo, *pats, **opts):' | |||||
1866 | with repo.wlock(False): |
|
1865 | with repo.wlock(False): | |
1867 | return cmdutil.copy(ui, repo, pats, opts) |
|
1866 | return cmdutil.copy(ui, repo, pats, opts) | |
1868 |
|
1867 | |||
1869 | @command('debugdag', |
|
|||
1870 | [('t', 'tags', None, _('use tags as labels')), |
|
|||
1871 | ('b', 'branches', None, _('annotate with branch names')), |
|
|||
1872 | ('', 'dots', None, _('use dots for runs')), |
|
|||
1873 | ('s', 'spaces', None, _('separate elements by spaces'))], |
|
|||
1874 | _('[OPTION]... [FILE [REV]...]'), |
|
|||
1875 | optionalrepo=True) |
|
|||
1876 | def debugdag(ui, repo, file_=None, *revs, **opts): |
|
|||
1877 | """format the changelog or an index DAG as a concise textual description |
|
|||
1878 |
|
||||
1879 | If you pass a revlog index, the revlog's DAG is emitted. If you list |
|
|||
1880 | revision numbers, they get labeled in the output as rN. |
|
|||
1881 |
|
||||
1882 | Otherwise, the changelog DAG of the current repo is emitted. |
|
|||
1883 | """ |
|
|||
1884 | spaces = opts.get('spaces') |
|
|||
1885 | dots = opts.get('dots') |
|
|||
1886 | if file_: |
|
|||
1887 | rlog = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) |
|
|||
1888 | revs = set((int(r) for r in revs)) |
|
|||
1889 | def events(): |
|
|||
1890 | for r in rlog: |
|
|||
1891 | yield 'n', (r, list(p for p in rlog.parentrevs(r) |
|
|||
1892 | if p != -1)) |
|
|||
1893 | if r in revs: |
|
|||
1894 | yield 'l', (r, "r%i" % r) |
|
|||
1895 | elif repo: |
|
|||
1896 | cl = repo.changelog |
|
|||
1897 | tags = opts.get('tags') |
|
|||
1898 | branches = opts.get('branches') |
|
|||
1899 | if tags: |
|
|||
1900 | labels = {} |
|
|||
1901 | for l, n in repo.tags().items(): |
|
|||
1902 | labels.setdefault(cl.rev(n), []).append(l) |
|
|||
1903 | def events(): |
|
|||
1904 | b = "default" |
|
|||
1905 | for r in cl: |
|
|||
1906 | if branches: |
|
|||
1907 | newb = cl.read(cl.node(r))[5]['branch'] |
|
|||
1908 | if newb != b: |
|
|||
1909 | yield 'a', newb |
|
|||
1910 | b = newb |
|
|||
1911 | yield 'n', (r, list(p for p in cl.parentrevs(r) |
|
|||
1912 | if p != -1)) |
|
|||
1913 | if tags: |
|
|||
1914 | ls = labels.get(r) |
|
|||
1915 | if ls: |
|
|||
1916 | for l in ls: |
|
|||
1917 | yield 'l', (r, l) |
|
|||
1918 | else: |
|
|||
1919 | raise error.Abort(_('need repo for changelog dag')) |
|
|||
1920 |
|
||||
1921 | for line in dagparser.dagtextlines(events(), |
|
|||
1922 | addspaces=spaces, |
|
|||
1923 | wraplabels=True, |
|
|||
1924 | wrapannotations=True, |
|
|||
1925 | wrapnonlinear=dots, |
|
|||
1926 | usedots=dots, |
|
|||
1927 | maxlinewidth=70): |
|
|||
1928 | ui.write(line) |
|
|||
1929 | ui.write("\n") |
|
|||
1930 |
|
||||
1931 | @command('debugdata', debugrevlogopts, _('-c|-m|FILE REV')) |
|
1868 | @command('debugdata', debugrevlogopts, _('-c|-m|FILE REV')) | |
1932 | def debugdata(ui, repo, file_, rev=None, **opts): |
|
1869 | def debugdata(ui, repo, file_, rev=None, **opts): | |
1933 | """dump the contents of a data file revision""" |
|
1870 | """dump the contents of a data file revision""" |
@@ -357,3 +357,65 b" def debugcomplete(ui, cmd='', **opts):" | |||||
357 | if ui.verbose: |
|
357 | if ui.verbose: | |
358 | cmdlist = [' '.join(c[0]) for c in cmdlist.values()] |
|
358 | cmdlist = [' '.join(c[0]) for c in cmdlist.values()] | |
359 | ui.write("%s\n" % "\n".join(sorted(cmdlist))) |
|
359 | ui.write("%s\n" % "\n".join(sorted(cmdlist))) | |
|
360 | ||||
|
361 | @command('debugdag', | |||
|
362 | [('t', 'tags', None, _('use tags as labels')), | |||
|
363 | ('b', 'branches', None, _('annotate with branch names')), | |||
|
364 | ('', 'dots', None, _('use dots for runs')), | |||
|
365 | ('s', 'spaces', None, _('separate elements by spaces'))], | |||
|
366 | _('[OPTION]... [FILE [REV]...]'), | |||
|
367 | optionalrepo=True) | |||
|
368 | def debugdag(ui, repo, file_=None, *revs, **opts): | |||
|
369 | """format the changelog or an index DAG as a concise textual description | |||
|
370 | ||||
|
371 | If you pass a revlog index, the revlog's DAG is emitted. If you list | |||
|
372 | revision numbers, they get labeled in the output as rN. | |||
|
373 | ||||
|
374 | Otherwise, the changelog DAG of the current repo is emitted. | |||
|
375 | """ | |||
|
376 | spaces = opts.get('spaces') | |||
|
377 | dots = opts.get('dots') | |||
|
378 | if file_: | |||
|
379 | rlog = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) | |||
|
380 | revs = set((int(r) for r in revs)) | |||
|
381 | def events(): | |||
|
382 | for r in rlog: | |||
|
383 | yield 'n', (r, list(p for p in rlog.parentrevs(r) | |||
|
384 | if p != -1)) | |||
|
385 | if r in revs: | |||
|
386 | yield 'l', (r, "r%i" % r) | |||
|
387 | elif repo: | |||
|
388 | cl = repo.changelog | |||
|
389 | tags = opts.get('tags') | |||
|
390 | branches = opts.get('branches') | |||
|
391 | if tags: | |||
|
392 | labels = {} | |||
|
393 | for l, n in repo.tags().items(): | |||
|
394 | labels.setdefault(cl.rev(n), []).append(l) | |||
|
395 | def events(): | |||
|
396 | b = "default" | |||
|
397 | for r in cl: | |||
|
398 | if branches: | |||
|
399 | newb = cl.read(cl.node(r))[5]['branch'] | |||
|
400 | if newb != b: | |||
|
401 | yield 'a', newb | |||
|
402 | b = newb | |||
|
403 | yield 'n', (r, list(p for p in cl.parentrevs(r) | |||
|
404 | if p != -1)) | |||
|
405 | if tags: | |||
|
406 | ls = labels.get(r) | |||
|
407 | if ls: | |||
|
408 | for l in ls: | |||
|
409 | yield 'l', (r, l) | |||
|
410 | else: | |||
|
411 | raise error.Abort(_('need repo for changelog dag')) | |||
|
412 | ||||
|
413 | for line in dagparser.dagtextlines(events(), | |||
|
414 | addspaces=spaces, | |||
|
415 | wraplabels=True, | |||
|
416 | wrapannotations=True, | |||
|
417 | wrapnonlinear=dots, | |||
|
418 | usedots=dots, | |||
|
419 | maxlinewidth=70): | |||
|
420 | ui.write(line) | |||
|
421 | ui.write("\n") |
General Comments 0
You need to be logged in to leave comments.
Login now