changeset 18154:93c697d9c158

largefiles: remove trivial portability wrappers
author Mads Kiilerich <madski@unity3d.com>
date Thu, 13 Dec 2012 19:19:06 +0100
parents 51837a31b425
children 5206af8894a3
files hgext/largefiles/lfutil.py hgext/largefiles/overrides.py hgext/largefiles/reposetup.py
diffstat 3 files changed, 7 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Thu Dec 13 19:19:06 2012 +0100
+++ b/hgext/largefiles/lfutil.py	Thu Dec 13 19:19:06 2012 +0100
@@ -22,19 +22,6 @@
 longname = 'largefiles'
 
 
-# -- Portability wrappers ----------------------------------------------
-
-def dirstatewalk(dirstate, matcher, unknown=False, ignored=False):
-    return dirstate.walk(matcher, [], unknown, ignored)
-
-def repoadd(repo, list):
-    add = repo[None].add
-    return add(list)
-
-def repoforget(repo, list):
-    forget = repo[None].forget
-    return forget(list)
-
 # -- Private worker functions ------------------------------------------
 
 def getminsize(ui, assumelfiles, opt, default=10):
@@ -138,7 +125,7 @@
     if create and not os.path.exists(os.path.join(lfstoredir, 'dirstate')):
         util.makedirs(lfstoredir)
         matcher = getstandinmatcher(repo)
-        for standin in dirstatewalk(repo.dirstate, matcher):
+        for standin in repo.dirstate.walk(matcher, [], False, False):
             lfile = splitstandin(standin)
             hash = readstandin(repo, lfile)
             lfdirstate.normallookup(lfile)
@@ -270,8 +257,8 @@
     file.'''
     # Notes:
     # 1) Some callers want an absolute path, but for instance addlargefiles
-    #    needs it repo-relative so it can be passed to repoadd().  So leave
-    #    it up to the caller to use repo.wjoin() to get an absolute path.
+    #    needs it repo-relative so it can be passed to repo[None].add().  So
+    #    leave it up to the caller to use repo.wjoin() to get an absolute path.
     # 2) Join with '/' because that's what dirstate always uses, even on
     #    Windows. Change existing separator to '/' first in case we are
     #    passed filenames from an external source (like the command line).
@@ -429,7 +416,7 @@
 def getstandinsstate(repo):
     standins = []
     matcher = getstandinmatcher(repo)
-    for standin in dirstatewalk(repo.dirstate, matcher):
+    for standin in repo.dirstate.walk(matcher, [], False, False):
         lfile = splitstandin(standin)
         standins.append((lfile, readstandin(repo, lfile)))
     return standins
--- a/hgext/largefiles/overrides.py	Thu Dec 13 19:19:06 2012 +0100
+++ b/hgext/largefiles/overrides.py	Thu Dec 13 19:19:06 2012 +0100
@@ -116,7 +116,7 @@
                     lfdirstate.add(f)
             lfdirstate.write()
             bad += [lfutil.splitstandin(f)
-                    for f in lfutil.repoadd(repo, standins)
+                    for f in repo[None].add(standins)
                     if f in m.files()]
     finally:
         wlock.release()
@@ -176,7 +176,7 @@
         lfdirstate.write()
         forget = [lfutil.standin(f) for f in forget]
         remove = [lfutil.standin(f) for f in remove]
-        lfutil.repoforget(repo, forget)
+        repo[None].forget(forget)
         # If this is being called by addremove, let the original addremove
         # function handle this.
         if not getattr(repo, "_isaddremove", False):
--- a/hgext/largefiles/reposetup.py	Thu Dec 13 19:19:06 2012 +0100
+++ b/hgext/largefiles/reposetup.py	Thu Dec 13 19:19:06 2012 +0100
@@ -339,7 +339,7 @@
                 # Case 2: user calls commit with specified patterns: refresh
                 # any matching big files.
                 smatcher = lfutil.composestandinmatcher(self, match)
-                standins = lfutil.dirstatewalk(self.dirstate, smatcher)
+                standins = self.dirstate.walk(smatcher, [], False, False)
 
                 # No matching big files: get out of the way and pass control to
                 # the usual commit() method.