##// END OF EJS Templates
largefiles: remove trivial portability wrappers
Mads Kiilerich -
r18154:93c697d9 default
parent child Browse files
Show More
@@ -22,19 +22,6 b" shortnameslash = shortname + '/'"
22 longname = 'largefiles'
22 longname = 'largefiles'
23
23
24
24
25 # -- Portability wrappers ----------------------------------------------
26
27 def dirstatewalk(dirstate, matcher, unknown=False, ignored=False):
28 return dirstate.walk(matcher, [], unknown, ignored)
29
30 def repoadd(repo, list):
31 add = repo[None].add
32 return add(list)
33
34 def repoforget(repo, list):
35 forget = repo[None].forget
36 return forget(list)
37
38 # -- Private worker functions ------------------------------------------
25 # -- Private worker functions ------------------------------------------
39
26
40 def getminsize(ui, assumelfiles, opt, default=10):
27 def getminsize(ui, assumelfiles, opt, default=10):
@@ -138,7 +125,7 b' def openlfdirstate(ui, repo, create=True'
138 if create and not os.path.exists(os.path.join(lfstoredir, 'dirstate')):
125 if create and not os.path.exists(os.path.join(lfstoredir, 'dirstate')):
139 util.makedirs(lfstoredir)
126 util.makedirs(lfstoredir)
140 matcher = getstandinmatcher(repo)
127 matcher = getstandinmatcher(repo)
141 for standin in dirstatewalk(repo.dirstate, matcher):
128 for standin in repo.dirstate.walk(matcher, [], False, False):
142 lfile = splitstandin(standin)
129 lfile = splitstandin(standin)
143 hash = readstandin(repo, lfile)
130 hash = readstandin(repo, lfile)
144 lfdirstate.normallookup(lfile)
131 lfdirstate.normallookup(lfile)
@@ -270,8 +257,8 b' def standin(filename):'
270 file.'''
257 file.'''
271 # Notes:
258 # Notes:
272 # 1) Some callers want an absolute path, but for instance addlargefiles
259 # 1) Some callers want an absolute path, but for instance addlargefiles
273 # needs it repo-relative so it can be passed to repoadd(). So leave
260 # needs it repo-relative so it can be passed to repo[None].add(). So
274 # it up to the caller to use repo.wjoin() to get an absolute path.
261 # leave it up to the caller to use repo.wjoin() to get an absolute path.
275 # 2) Join with '/' because that's what dirstate always uses, even on
262 # 2) Join with '/' because that's what dirstate always uses, even on
276 # Windows. Change existing separator to '/' first in case we are
263 # Windows. Change existing separator to '/' first in case we are
277 # passed filenames from an external source (like the command line).
264 # passed filenames from an external source (like the command line).
@@ -429,7 +416,7 b' def getcurrentheads(repo):'
429 def getstandinsstate(repo):
416 def getstandinsstate(repo):
430 standins = []
417 standins = []
431 matcher = getstandinmatcher(repo)
418 matcher = getstandinmatcher(repo)
432 for standin in dirstatewalk(repo.dirstate, matcher):
419 for standin in repo.dirstate.walk(matcher, [], False, False):
433 lfile = splitstandin(standin)
420 lfile = splitstandin(standin)
434 standins.append((lfile, readstandin(repo, lfile)))
421 standins.append((lfile, readstandin(repo, lfile)))
435 return standins
422 return standins
@@ -116,7 +116,7 b' def addlargefiles(ui, repo, *pats, **opt'
116 lfdirstate.add(f)
116 lfdirstate.add(f)
117 lfdirstate.write()
117 lfdirstate.write()
118 bad += [lfutil.splitstandin(f)
118 bad += [lfutil.splitstandin(f)
119 for f in lfutil.repoadd(repo, standins)
119 for f in repo[None].add(standins)
120 if f in m.files()]
120 if f in m.files()]
121 finally:
121 finally:
122 wlock.release()
122 wlock.release()
@@ -176,7 +176,7 b' def removelargefiles(ui, repo, *pats, **'
176 lfdirstate.write()
176 lfdirstate.write()
177 forget = [lfutil.standin(f) for f in forget]
177 forget = [lfutil.standin(f) for f in forget]
178 remove = [lfutil.standin(f) for f in remove]
178 remove = [lfutil.standin(f) for f in remove]
179 lfutil.repoforget(repo, forget)
179 repo[None].forget(forget)
180 # If this is being called by addremove, let the original addremove
180 # If this is being called by addremove, let the original addremove
181 # function handle this.
181 # function handle this.
182 if not getattr(repo, "_isaddremove", False):
182 if not getattr(repo, "_isaddremove", False):
@@ -339,7 +339,7 b' def reposetup(ui, repo):'
339 # Case 2: user calls commit with specified patterns: refresh
339 # Case 2: user calls commit with specified patterns: refresh
340 # any matching big files.
340 # any matching big files.
341 smatcher = lfutil.composestandinmatcher(self, match)
341 smatcher = lfutil.composestandinmatcher(self, match)
342 standins = lfutil.dirstatewalk(self.dirstate, smatcher)
342 standins = self.dirstate.walk(smatcher, [], False, False)
343
343
344 # No matching big files: get out of the way and pass control to
344 # No matching big files: get out of the way and pass control to
345 # the usual commit() method.
345 # the usual commit() method.
General Comments 0
You need to be logged in to leave comments. Login now