# HG changeset patch # User Mads Kiilerich # Date 1356692157 -3600 # Node ID e16982a74bf71404abf4c0e1b7899dd753df69ee # Parent 242d2f4ec01cf028f7b122bd45919b28a35dc5f9 largefiles: introduce basic debugstate --large functionality Very useful for debugging largefiles "performance" issues. This is used for testing 03faf12fbee7. diff -r 242d2f4ec01c -r e16982a74bf7 hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py Fri Dec 28 11:55:57 2012 +0100 +++ b/hgext/largefiles/lfcommands.py Fri Dec 28 11:55:57 2012 +0100 @@ -383,6 +383,13 @@ store = basestore._openstore(repo) return store.verify(revs, contents=contents) +def debugdirstate(ui, repo): + '''Show basic information for the largefiles dirstate''' + lfdirstate = lfutil.openlfdirstate(ui, repo) + for file_, ent in sorted(lfdirstate._map.iteritems()): + mode = '%3o' % (ent[1] & 0777 & ~util.umask) + ui.write("%c %s %10d %s\n" % (ent[0], mode, ent[2], file_)) + def cachelfiles(ui, repo, node, filelist=None): '''cachelfiles ensures that all largefiles needed by the specified revision are present in the repository's largefile cache. diff -r 242d2f4ec01c -r e16982a74bf7 hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Fri Dec 28 11:55:57 2012 +0100 +++ b/hgext/largefiles/overrides.py Fri Dec 28 11:55:57 2012 +0100 @@ -256,6 +256,13 @@ result = result or lfcommands.verifylfiles(ui, repo, all, contents) return result +def overridedebugstate(orig, ui, repo, *pats, **opts): + large = opts.pop('large', False) + if large: + lfcommands.debugdirstate(ui, repo) + else: + orig(ui, repo, *pats, **opts) + # Override needs to refresh standins so that update's normal merge # will go through properly. Then the other update hook (overriding repo.update) # will get the new files. Filemerge is also overridden so that the merge diff -r 242d2f4ec01c -r e16982a74bf7 hgext/largefiles/uisetup.py --- a/hgext/largefiles/uisetup.py Fri Dec 28 11:55:57 2012 +0100 +++ b/hgext/largefiles/uisetup.py Fri Dec 28 11:55:57 2012 +0100 @@ -59,6 +59,11 @@ _('verify largefile contents not just existence'))] entry[1].extend(verifyopt) + entry = extensions.wrapcommand(commands.table, 'debugstate', + overrides.overridedebugstate) + debugstateopt = [('', 'large', None, _('display largefiles dirstate'))] + entry[1].extend(debugstateopt) + entry = extensions.wrapcommand(commands.table, 'outgoing', overrides.overrideoutgoing) outgoingopt = [('', 'large', None, _('display outgoing largefiles'))] diff -r 242d2f4ec01c -r e16982a74bf7 tests/test-largefiles.t --- a/tests/test-largefiles.t Fri Dec 28 11:55:57 2012 +0100 +++ b/tests/test-largefiles.t Fri Dec 28 11:55:57 2012 +0100 @@ -17,8 +17,8 @@ > EOF Create the repo with a couple of revisions of both large and normal -files, testing that status correctly shows largefiles and that summary output -is correct. +files. +Test status and dirstate of largefiles and that summary output is correct. $ hg init a $ cd a @@ -35,6 +35,17 @@ A normal1 A sub/large2 A sub/normal2 + $ touch large1 sub/large2 + $ sleep 1 + $ hg st + $ hg debugstate --nodates + n 644 41 .hglf/large1 + n 644 41 .hglf/sub/large2 + n 644 8 normal1 + n 644 8 sub/normal2 + $ hg debugstate --large + n 644 7 large1 + n 644 7 sub/large2 $ echo normal11 > normal1 $ echo normal22 > sub/normal2 $ echo large11 > large1