1872 def debugindex(ui, repo, file_=None, **opts): |
1873 def debugindex(ui, repo, file_=None, **opts): |
1873 """dump index data for a revlog""" |
1874 """dump index data for a revlog""" |
1874 opts = pycompat.byteskwargs(opts) |
1875 opts = pycompat.byteskwargs(opts) |
1875 store = cmdutil.openstorage(repo, b'debugindex', file_, opts) |
1876 store = cmdutil.openstorage(repo, b'debugindex', file_, opts) |
1876 |
1877 |
1877 if ui.debugflag: |
|
1878 shortfn = hex |
|
1879 else: |
|
1880 shortfn = short |
|
1881 |
|
1882 idlen = 12 |
|
1883 for i in store: |
|
1884 idlen = len(shortfn(store.node(i))) |
|
1885 break |
|
1886 |
|
1887 fm = ui.formatter(b'debugindex', opts) |
1878 fm = ui.formatter(b'debugindex', opts) |
1888 fm.plain( |
1879 |
1889 b' rev linkrev %s %s p2\n' |
1880 return revlog_debug.debug_index( |
1890 % (b'nodeid'.ljust(idlen), b'p1'.ljust(idlen)) |
1881 ui, |
|
1882 repo, |
|
1883 formatter=fm, |
|
1884 revlog=store, |
|
1885 full_node=ui.debugflag, |
1891 ) |
1886 ) |
1892 |
|
1893 for rev in store: |
|
1894 node = store.node(rev) |
|
1895 parents = store.parents(node) |
|
1896 |
|
1897 fm.startitem() |
|
1898 fm.write(b'rev', b'%6d ', rev) |
|
1899 fm.write(b'linkrev', b'%7d ', store.linkrev(rev)) |
|
1900 fm.write(b'node', b'%s ', shortfn(node)) |
|
1901 fm.write(b'p1', b'%s ', shortfn(parents[0])) |
|
1902 fm.write(b'p2', b'%s', shortfn(parents[1])) |
|
1903 fm.plain(b'\n') |
|
1904 |
|
1905 fm.end() |
|
1906 |
1887 |
1907 |
1888 |
1908 @command( |
1889 @command( |
1909 b'debugindexdot', |
1890 b'debugindexdot', |
1910 cmdutil.debugrevlogopts, |
1891 cmdutil.debugrevlogopts, |