Patchwork [05,of,12,misc,largefiles] largefiles: full debugdirstate functionality for largefiles

login
register
mail settings
Submitter Mads Kiilerich
Date April 13, 2014, 4:59 p.m.
Message ID <f7e77352686aed959769.1397408348@localhost.localdomain>
Download mbox | patch
Permalink /patch/4321/
State Accepted
Commit e095626e8676580b705161dc2c5394b867f3add7
Headers show

Comments

Mads Kiilerich - April 13, 2014, 4:59 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1367097592 -7200
#      Sat Apr 27 23:19:52 2013 +0200
# Node ID f7e77352686aed959769854280c95d146e6fec6a
# Parent  ed04503318ac7625cf1bd2292cd7524d0919cb98
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.

Patch

diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -375,13 +375,6 @@  def verifylfiles(ui, repo, all=False, co
     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 --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -286,7 +286,9 @@  def overrideverify(orig, ui, repo, *pats
 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)
 
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -43,7 +43,7 @@  Test status and dirstate of largefiles a
   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