##// END OF EJS Templates
copies: add matcher parameter to copy logic...
Durham Goode -
r24782:4906dc0e default
parent child Browse files
Show More
@@ -547,8 +547,8 def overridefilemerge(origfn, repo, myno
547 repo.wwrite(fcd.path(), fco.data(), fco.flags())
547 repo.wwrite(fcd.path(), fco.data(), fco.flags())
548 return 0
548 return 0
549
549
550 def copiespathcopies(orig, ctx1, ctx2):
550 def copiespathcopies(orig, ctx1, ctx2, match=None):
551 copies = orig(ctx1, ctx2)
551 copies = orig(ctx1, ctx2, match=match)
552 updated = {}
552 updated = {}
553
553
554 for k, v in copies.iteritems():
554 for k, v in copies.iteritems():
@@ -140,14 +140,19 def _dirstatecopies(d):
140 del c[k]
140 del c[k]
141 return c
141 return c
142
142
143 def _computeforwardmissing(a, b):
143 def _computeforwardmissing(a, b, match=None):
144 """Computes which files are in b but not a.
144 """Computes which files are in b but not a.
145 This is its own function so extensions can easily wrap this call to see what
145 This is its own function so extensions can easily wrap this call to see what
146 files _forwardcopies is about to process.
146 files _forwardcopies is about to process.
147 """
147 """
148 return b.manifest().filesnotin(a.manifest())
148 ma = a.manifest()
149 mb = b.manifest()
150 if match:
151 ma = ma.matches(match)
152 mb = mb.matches(match)
153 return mb.filesnotin(ma)
149
154
150 def _forwardcopies(a, b):
155 def _forwardcopies(a, b, match=None):
151 '''find {dst@b: src@a} copy mapping where a is an ancestor of b'''
156 '''find {dst@b: src@a} copy mapping where a is an ancestor of b'''
152
157
153 # check for working copy
158 # check for working copy
@@ -170,7 +175,7 def _forwardcopies(a, b):
170 # we currently don't try to find where old files went, too expensive
175 # we currently don't try to find where old files went, too expensive
171 # this means we can miss a case like 'hg rm b; hg cp a b'
176 # this means we can miss a case like 'hg rm b; hg cp a b'
172 cm = {}
177 cm = {}
173 missing = _computeforwardmissing(a, b)
178 missing = _computeforwardmissing(a, b, match=match)
174 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
179 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
175 for f in missing:
180 for f in missing:
176 fctx = b[f]
181 fctx = b[f]
@@ -198,16 +203,17 def _backwardrenames(a, b):
198 r[v] = k
203 r[v] = k
199 return r
204 return r
200
205
201 def pathcopies(x, y):
206 def pathcopies(x, y, match=None):
202 '''find {dst@y: src@x} copy mapping for directed compare'''
207 '''find {dst@y: src@x} copy mapping for directed compare'''
203 if x == y or not x or not y:
208 if x == y or not x or not y:
204 return {}
209 return {}
205 a = y.ancestor(x)
210 a = y.ancestor(x)
206 if a == x:
211 if a == x:
207 return _forwardcopies(x, y)
212 return _forwardcopies(x, y, match=match)
208 if a == y:
213 if a == y:
209 return _backwardrenames(x, y)
214 return _backwardrenames(x, y)
210 return _chain(x, y, _backwardrenames(x, a), _forwardcopies(a, y))
215 return _chain(x, y, _backwardrenames(x, a),
216 _forwardcopies(a, y, match=match))
211
217
212 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2):
218 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2):
213 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
219 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
General Comments 0
You need to be logged in to leave comments. Login now