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