From patchwork Mon Aug 12 16:27:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [40,of,41] basefilectx: move copies from filectx From: Sean Farley X-Patchwork-Id: 2167 Message-Id: <3ff4552ea7280928297d.1376324856@laptop.local> To: mercurial-devel@selenic.com Date: Mon, 12 Aug 2013 11:27:36 -0500 # HG changeset patch # User Sean Farley # Date 1376280370 18000 # Sun Aug 11 23:06:10 2013 -0500 # Node ID 3ff4552ea7280928297d313cfac7e46675a31bd3 # Parent 7a90f67b36bc157dfecd81512b62e7eccbfbce0c basefilectx: move copies from filectx diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -720,10 +720,18 @@ if not visit: break c = visit.pop(max(visit)) yield c + def copies(self, c2): + if not util.safehasattr(self, "_copycache"): + self._copycache = {} + sc2 = str(c2) + if sc2 not in self._copycache: + self._copycache[sc2] = copies.pathcopies(c2) + return self._copycache[sc2] + class filectx(basefilectx): """A filecontext object makes access to data related to a particular filerevision convenient.""" def __init__(self, repo, path, changeid=None, fileid=None, filelog=None, changectx=None): @@ -811,18 +819,10 @@ # hard for renames c = self._filelog.children(self._filenode) return [filectx(self._repo, self._path, fileid=x, filelog=self._filelog) for x in c] - def copies(self, c2): - if not util.safehasattr(self, "_copycache"): - self._copycache = {} - sc2 = str(c2) - if sc2 not in self._copycache: - self._copycache[sc2] = copies.pathcopies(c2) - return self._copycache[sc2] - class workingctx(basectx): """A workingctx object makes access to data related to the current working directory convenient. date - any valid date string or (unixtime, offset), or None. user - username string, or None.