mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
context: add copies method with caching
This commit is contained in:
parent
e38c9f282e
commit
4d062ed81e
@ -8,6 +8,7 @@
|
||||
from node import nullid, nullrev, short, hex, bin
|
||||
from i18n import _
|
||||
import ancestor, mdiff, error, util, scmutil, subrepo, patch, encoding, phases
|
||||
import copies
|
||||
import match as matchmod
|
||||
import os, errno, stat
|
||||
|
||||
@ -695,6 +696,14 @@ class filectx(object):
|
||||
c = visit.pop(max(visit))
|
||||
yield c
|
||||
|
||||
def copies(self, c2):
|
||||
if not util.hasattr(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(changectx):
|
||||
"""A workingctx object makes access to data related to
|
||||
the current working directory convenient.
|
||||
|
Loading…
Reference in New Issue
Block a user