##// END OF EJS Templates
treemanifest: add --dir option to debug{revlog,data,index}...
Martin von Zweigbergk -
r25119:49c583ca default
parent child Browse files
Show More
@@ -450,14 +450,17 b' def openrevlog(repo, cmd, file_, opts):'
450 450 """opens the changelog, manifest, a filelog or a given revlog"""
451 451 cl = opts['changelog']
452 452 mf = opts['manifest']
453 dir = opts['dir']
453 454 msg = None
454 455 if cl and mf:
455 456 msg = _('cannot specify --changelog and --manifest at the same time')
457 elif cl and dir:
458 msg = _('cannot specify --changelog and --dir at the same time')
456 459 elif cl or mf:
457 460 if file_:
458 461 msg = _('cannot specify filename with --changelog or --manifest')
459 462 elif not repo:
460 msg = _('cannot specify --changelog or --manifest '
463 msg = _('cannot specify --changelog or --manifest or --dir '
461 464 'without a repository')
462 465 if msg:
463 466 raise util.Abort(msg)
@@ -466,6 +469,13 b' def openrevlog(repo, cmd, file_, opts):'
466 469 if repo:
467 470 if cl:
468 471 r = repo.unfiltered().changelog
472 elif dir:
473 if 'treemanifest' not in repo.requirements:
474 raise util.Abort(_("--dir can only be used on repos with "
475 "treemanifest enabled"))
476 dirlog = repo.dirlog(file_)
477 if len(dirlog):
478 r = dirlog
469 479 elif mf:
470 480 r = repo.manifest
471 481 elif file_:
@@ -2056,7 +2056,8 b' def debugdag(ui, repo, file_=None, *revs'
2056 2056
2057 2057 @command('debugdata',
2058 2058 [('c', 'changelog', False, _('open changelog')),
2059 ('m', 'manifest', False, _('open manifest'))],
2059 ('m', 'manifest', False, _('open manifest')),
2060 ('', 'dir', False, _('open directory manifest'))],
2060 2061 _('-c|-m|FILE REV'))
2061 2062 def debugdata(ui, repo, file_, rev=None, **opts):
2062 2063 """dump the contents of a data file revision"""
@@ -2227,6 +2228,7 b' def debugignore(ui, repo, *values, **opt'
2227 2228 @command('debugindex',
2228 2229 [('c', 'changelog', False, _('open changelog')),
2229 2230 ('m', 'manifest', False, _('open manifest')),
2231 ('', 'dir', False, _('open directory manifest')),
2230 2232 ('f', 'format', 0, _('revlog format'), _('FORMAT'))],
2231 2233 _('[-f FORMAT] -c|-m|FILE'),
2232 2234 optionalrepo=True)
@@ -2729,6 +2731,7 b' def debugrename(ui, repo, file1, *pats, '
2729 2731 @command('debugrevlog',
2730 2732 [('c', 'changelog', False, _('open changelog')),
2731 2733 ('m', 'manifest', False, _('open manifest')),
2734 ('', 'dir', False, _('open directory manifest')),
2732 2735 ('d', 'dump', False, _('dump index data'))],
2733 2736 _('-c|-m|FILE'),
2734 2737 optionalrepo=True)
@@ -460,6 +460,9 b' class localrepository(object):'
460 460 def manifest(self):
461 461 return manifest.manifest(self.svfs)
462 462
463 def dirlog(self, dir):
464 return manifest.manifest(self.svfs, dir)
465
463 466 @repofilecache('dirstate')
464 467 def dirstate(self):
465 468 warned = [0]
@@ -815,6 +815,8 b' class manifest(revlog.revlog):'
815 815 indexfile = "00manifest.i"
816 816 if dir:
817 817 assert self._treeondisk
818 if not dir.endswith('/'):
819 dir = dir + '/'
818 820 indexfile = "meta/" + dir + "00manifest.i"
819 821 revlog.revlog.__init__(self, opener, indexfile)
820 822 self._dir = dir
@@ -234,7 +234,7 b' Show all commands + options'
234 234 debugcommands:
235 235 debugcomplete: options
236 236 debugdag: tags, branches, dots, spaces
237 debugdata: changelog, manifest
237 debugdata: changelog, manifest, dir
238 238 debugdate: extended
239 239 debugdirstate: nodates, datesort
240 240 debugdiscovery: old, nonheads, ssh, remotecmd, insecure
@@ -242,7 +242,7 b' Show all commands + options'
242 242 debugfsinfo:
243 243 debuggetbundle: head, common, type
244 244 debugignore:
245 debugindex: changelog, manifest, format
245 debugindex: changelog, manifest, dir, format
246 246 debugindexdot:
247 247 debuginstall:
248 248 debugknown:
@@ -255,7 +255,7 b' Show all commands + options'
255 255 debugpvec:
256 256 debugrebuilddirstate: rev
257 257 debugrename: rev
258 debugrevlog: changelog, manifest, dump
258 debugrevlog: changelog, manifest, dir, dump
259 259 debugrevspec: optimize
260 260 debugsetparents:
261 261 debugsub: rev
@@ -30,7 +30,7 b' Submanifest is stored in separate revlog'
30 30 b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
31 31 dir1\x008b3ffd73f901e83304c83d33132c8e774ceac44ed (esc)
32 32 e\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
33 $ hg debugdata .hg/store/meta/dir1/00manifest.i 0
33 $ hg debugdata --dir dir1 0
34 34 a\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
35 35 b\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
36 36
@@ -60,9 +60,9 b' Revision is not created for unchanged di'
60 60 $ echo 3 > dir2/a
61 61 $ hg add dir2
62 62 adding dir2/a
63 $ hg debugindex .hg/store/meta/dir1/00manifest.i > before
63 $ hg debugindex --dir dir1 > before
64 64 $ hg ci -qm 'add dir2'
65 $ hg debugindex .hg/store/meta/dir1/00manifest.i > after
65 $ hg debugindex --dir dir1 > after
66 66 $ diff before after
67 67 $ rm before after
68 68
@@ -71,9 +71,9 b' Removing directory does not create an re'
71 71 $ hg rm dir1/dir1
72 72 removing dir1/dir1/a
73 73 removing dir1/dir1/b
74 $ hg debugindex .hg/store/meta/dir1/dir1/00manifest.i > before
74 $ hg debugindex --dir dir1/dir1 > before
75 75 $ hg ci -qm 'remove dir1/dir1'
76 $ hg debugindex .hg/store/meta/dir1/dir1/00manifest.i > after
76 $ hg debugindex --dir dir1/dir1 > after
77 77 $ diff before after
78 78 $ rm before after
79 79
@@ -113,7 +113,7 b' Merge creates 2-parent revision of direc'
113 113 5
114 114 $ cat dir1/b
115 115 6
116 $ hg debugindex .hg/store/meta/dir1/00manifest.i
116 $ hg debugindex --dir dir1
117 117 rev offset length base linkrev nodeid p1 p2
118 118 0 0 54 0 1 8b3ffd73f901 000000000000 000000000000
119 119 1 54 68 0 2 b66d046c644f 8b3ffd73f901 000000000000
@@ -131,14 +131,14 b" dir1's manifest does change, but only be"
131 131 $ hg ci -m 'modify dir2/a'
132 132 created new head
133 133
134 $ hg debugindex .hg/store/meta/dir2/00manifest.i > before
134 $ hg debugindex --dir dir2 > before
135 135 $ hg merge 'desc("modify dir1/a")'
136 136 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
137 137 (branch merge, don't forget to commit)
138 138 $ hg revert -r 'desc("modify dir2/a")' .
139 139 reverting dir1/a (glob)
140 140 $ hg ci -m 'merge, keeping parent 1'
141 $ hg debugindex .hg/store/meta/dir2/00manifest.i > after
141 $ hg debugindex --dir dir2 > after
142 142 $ diff before after
143 143 $ rm before after
144 144
@@ -147,7 +147,7 b" dir2's manifest does change, but only be"
147 147
148 148 $ hg co 'desc("modify dir2/a")'
149 149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 $ hg debugindex .hg/store/meta/dir1/00manifest.i > before
150 $ hg debugindex --dir dir1 > before
151 151 $ hg merge 'desc("modify dir1/a")'
152 152 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
153 153 (branch merge, don't forget to commit)
@@ -155,7 +155,7 b" dir2's manifest does change, but only be"
155 155 reverting dir2/a (glob)
156 156 $ hg ci -m 'merge, keeping parent 2'
157 157 created new head
158 $ hg debugindex .hg/store/meta/dir1/00manifest.i > after
158 $ hg debugindex --dir dir1 > after
159 159 $ diff before after
160 160 $ rm before after
161 161
General Comments 0
You need to be logged in to leave comments. Login now