Mercurial > hg
changeset 17803:1479572db256
largefile: use `self` in repo method instead of `repo`
Most method added (or overwritten) to repo by largefile works on `repo`
instead of `self`. This currently works without trouble because `self` and
`repo` are likely the same. However this is semantically dubious and this may
cause issue for filtering. `self` may be proxy object different from the `repo`
one.
This changeset fix that and use `self` when applicable.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 08 Oct 2012 15:41:58 +0200 |
parents | a421459b83c0 |
children | 5a511d255301 |
files | hgext/largefiles/reposetup.py |
diffstat | 1 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py Tue Oct 16 23:12:07 2012 +0200 +++ b/hgext/largefiles/reposetup.py Mon Oct 08 15:41:58 2012 +0200 @@ -100,11 +100,11 @@ if isinstance(node1, context.changectx): ctx1 = node1 else: - ctx1 = repo[node1] + ctx1 = self[node1] if isinstance(node2, context.changectx): ctx2 = node2 else: - ctx2 = repo[node2] + ctx2 = self[node2] working = ctx2.rev() is None parentworking = working and ctx1 == self['.'] @@ -140,7 +140,7 @@ if not working: return files newfiles = [] - dirstate = repo.dirstate + dirstate = self.dirstate for f in files: sf = lfutil.standin(f) if sf in dirstate: @@ -181,7 +181,7 @@ def sfindirstate(f): sf = lfutil.standin(f) - dirstate = repo.dirstate + dirstate = self.dirstate return sf in dirstate or sf in dirstate.dirs() match._files = [f for f in match._files if sfindirstate(f)] @@ -244,13 +244,13 @@ # files are not really removed if it's still in # lfdirstate. This happens in merges where files # change type. - removed = [f for f in removed if f not in repo.dirstate] + removed = [f for f in removed if f not in self.dirstate] result[2] = [f for f in result[2] if f not in lfdirstate] # Unknown files unknown = set(unknown).difference(ignored) result[4] = [f for f in unknown - if (repo.dirstate[f] == '?' and + if (self.dirstate[f] == '?' and not lfutil.isstandin(f))] # Ignored files were calculated earlier by the dirstate, # and we already stripped out the largefiles from the list @@ -292,7 +292,7 @@ force=False, editor=False, extra={}): orig = super(lfilesrepo, self).commit - wlock = repo.wlock() + wlock = self.wlock() try: # Case 0: Rebase or Transplant # We have to take the time to pull down the new largefiles now. @@ -301,9 +301,9 @@ # or in the first commit after the rebase or transplant. # updatelfiles will update the dirstate to mark any pulled # largefiles as modified - if getattr(repo, "_isrebasing", False) or \ - getattr(repo, "_istransplanting", False): - lfcommands.updatelfiles(repo.ui, repo, filelist=None, + if getattr(self, "_isrebasing", False) or \ + getattr(self, "_istransplanting", False): + lfcommands.updatelfiles(self.ui, self, filelist=None, printmessage=False) result = orig(text=text, user=user, date=date, match=match, force=force, editor=editor, extra=extra) @@ -319,7 +319,7 @@ # otherwise to update all standins if the largefiles are # large. lfdirstate = lfutil.openlfdirstate(ui, self) - dirtymatch = match_.always(repo.root, repo.getcwd()) + dirtymatch = match_.always(self.root, self.getcwd()) s = lfdirstate.status(dirtymatch, [], False, False, False) modifiedfiles = [] for i in s: @@ -345,9 +345,9 @@ if result is not None: for lfile in lfdirstate: if lfile in modifiedfiles: - if (not os.path.exists(repo.wjoin( + if (not os.path.exists(self.wjoin( lfutil.standin(lfile)))) or \ - (not os.path.exists(repo.wjoin(lfile))): + (not os.path.exists(self.wjoin(lfile))): lfdirstate.drop(lfile) # This needs to be after commit; otherwise precommit hooks @@ -390,7 +390,7 @@ # standins corresponding to the big files requested by the # user. Have to modify _files to prevent commit() from # complaining "not tracked" for big files. - lfiles = lfutil.listlfiles(repo) + lfiles = lfutil.listlfiles(self) match = copy.copy(match) origmatchfn = match.matchfn @@ -431,14 +431,14 @@ wlock.release() def push(self, remote, force=False, revs=None, newbranch=False): - o = lfutil.findoutgoing(repo, remote, force) + o = lfutil.findoutgoing(self, remote, force) if o: toupload = set() - o = repo.changelog.nodesbetween(o, revs)[0] + o = self.changelog.nodesbetween(o, revs)[0] for n in o: - parents = [p for p in repo.changelog.parents(n) + parents = [p for p in self.changelog.parents(n) if p != node_.nullid] - ctx = repo[n] + ctx = self[n] files = set(ctx.files()) if len(parents) == 2: mc = ctx.manifest()