comparison mercurial/copies.py @ 35430:e54f02ec6a05

copies: group wdir-handling in one place I think this makes it both easier to follow and shorter. Differential Revision: https://phab.mercurial-scm.org/D1698
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 14 Dec 2017 00:25:03 -0800
parents 8801cdcea01f
children c02771617a70
comparison
equal deleted inserted replaced
35429:8801cdcea01f 35430:e54f02ec6a05
193 193
194 def _forwardcopies(a, b, match=None): 194 def _forwardcopies(a, b, match=None):
195 """find {dst@b: src@a} copy mapping where a is an ancestor of b""" 195 """find {dst@b: src@a} copy mapping where a is an ancestor of b"""
196 196
197 # check for working copy 197 # check for working copy
198 w = None
199 if b.rev() is None: 198 if b.rev() is None:
200 w = b 199 if a == b.p1():
201 b = w.p1()
202 if a == b:
203 # short-circuit to avoid issues with merge states 200 # short-circuit to avoid issues with merge states
204 return _dirstatecopies(w, match) 201 return _dirstatecopies(b, match)
205 202
206 cm = _committedforwardcopies(a, b, match) 203 cm = _committedforwardcopies(a, b.p1(), match)
207 204 # combine copies from dirstate if necessary
208 # combine copies from dirstate if necessary 205 return _chain(a, b, cm, _dirstatecopies(b, match))
209 if w is not None: 206 return _committedforwardcopies(a, b, match)
210 cm = _chain(a, w, cm, _dirstatecopies(w, match))
211
212 return cm
213 207
214 def _backwardrenames(a, b): 208 def _backwardrenames(a, b):
215 if a._repo.ui.config('experimental', 'copytrace') == 'off': 209 if a._repo.ui.config('experimental', 'copytrace') == 'off':
216 return {} 210 return {}
217 211