largefiles: full debugdirstate functionality for largefiles
authorMads Kiilerich <madski@unity3d.com>
Sat, 27 Apr 2013 23:19:52 +0200
changeset 21088 e095626e8676
parent 21087 3fb2affb023f
child 21089 278bd08a2902
largefiles: full debugdirstate functionality for largefiles - just reusing the original command with a mockup repo. This makes it possible to see dates in the lfdirstate and gives less code duplication.
hgext/largefiles/lfcommands.py
hgext/largefiles/overrides.py
tests/test-largefiles.t
--- a/hgext/largefiles/lfcommands.py	Sat Apr 27 23:19:52 2013 +0200
+++ b/hgext/largefiles/lfcommands.py	Sat Apr 27 23:19:52 2013 +0200
@@ -375,13 +375,6 @@
     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.
--- a/hgext/largefiles/overrides.py	Sat Apr 27 23:19:52 2013 +0200
+++ b/hgext/largefiles/overrides.py	Sat Apr 27 23:19:52 2013 +0200
@@ -286,7 +286,9 @@
 def overridedebugstate(orig, ui, repo, *pats, **opts):
     large = opts.pop('large', False)
     if large:
-        lfcommands.debugdirstate(ui, repo)
+        class fakerepo(object):
+            dirstate = lfutil.openlfdirstate(ui, repo)
+        orig(ui, fakerepo, *pats, **opts)
     else:
         orig(ui, repo, *pats, **opts)
 
--- a/tests/test-largefiles.t	Sat Apr 27 23:19:52 2013 +0200
+++ b/tests/test-largefiles.t	Sat Apr 27 23:19:52 2013 +0200
@@ -43,7 +43,7 @@
   n 644         41 .hglf/sub/large2
   n 644          8 normal1
   n 644          8 sub/normal2
-  $ hg debugstate --large
+  $ hg debugstate --large --nodates
   n 644          7 large1
   n 644          7 sub/large2
   $ echo normal11 > normal1