Show More
@@ -24,6 +24,7 b' from .node import (' | |||||
24 | wdirhex, |
|
24 | wdirhex, | |
25 | ) |
|
25 | ) | |
26 | from . import ( |
|
26 | from . import ( | |
|
27 | copies, | |||
27 | dagop, |
|
28 | dagop, | |
28 | encoding, |
|
29 | encoding, | |
29 | error, |
|
30 | error, | |
@@ -274,23 +275,7 b' class basectx(object):' | |||||
274 |
|
275 | |||
275 | @propertycache |
|
276 | @propertycache | |
276 | def _copies(self): |
|
277 | def _copies(self): | |
277 | p1copies = {} |
|
278 | return copies.computechangesetcopies(self) | |
278 | p2copies = {} |
|
|||
279 | p1 = self.p1() |
|
|||
280 | p2 = self.p2() |
|
|||
281 | narrowmatch = self._repo.narrowmatch() |
|
|||
282 | for dst in self.files(): |
|
|||
283 | if not narrowmatch(dst) or dst not in self: |
|
|||
284 | continue |
|
|||
285 | copied = self[dst].renamed() |
|
|||
286 | if not copied: |
|
|||
287 | continue |
|
|||
288 | src, srcnode = copied |
|
|||
289 | if src in p1 and p1[src].filenode() == srcnode: |
|
|||
290 | p1copies[dst] = src |
|
|||
291 | elif src in p2 and p2[src].filenode() == srcnode: |
|
|||
292 | p2copies[dst] = src |
|
|||
293 | return p1copies, p2copies |
|
|||
294 | def p1copies(self): |
|
279 | def p1copies(self): | |
295 | return self._copies[0] |
|
280 | return self._copies[0] | |
296 | def p2copies(self): |
|
281 | def p2copies(self): |
@@ -809,3 +809,28 b' def duplicatecopies(repo, wctx, rev, fro' | |||||
809 | continue |
|
809 | continue | |
810 | if dst in wctx: |
|
810 | if dst in wctx: | |
811 | wctx[dst].markcopied(src) |
|
811 | wctx[dst].markcopied(src) | |
|
812 | ||||
|
813 | def computechangesetcopies(ctx): | |||
|
814 | """return the copies data for a changeset | |||
|
815 | ||||
|
816 | The copies data are returned as a pair of dictionnary (p1copies, p2copies). | |||
|
817 | ||||
|
818 | Each dictionnary are in the form: `{newname: oldname}` | |||
|
819 | """ | |||
|
820 | p1copies = {} | |||
|
821 | p2copies = {} | |||
|
822 | p1 = ctx.p1() | |||
|
823 | p2 = ctx.p2() | |||
|
824 | narrowmatch = ctx._repo.narrowmatch() | |||
|
825 | for dst in ctx.files(): | |||
|
826 | if not narrowmatch(dst) or dst not in ctx: | |||
|
827 | continue | |||
|
828 | copied = ctx[dst].renamed() | |||
|
829 | if not copied: | |||
|
830 | continue | |||
|
831 | src, srcnode = copied | |||
|
832 | if src in p1 and p1[src].filenode() == srcnode: | |||
|
833 | p1copies[dst] = src | |||
|
834 | elif src in p2 and p2[src].filenode() == srcnode: | |||
|
835 | p2copies[dst] = src | |||
|
836 | return p1copies, p2copies |
General Comments 0
You need to be logged in to leave comments.
Login now