comparison mercurial/cmdutil.py @ 15777:12309c09d19a

cmdutil: simplify duplicatecopies
author Matt Mackall <mpm@selenic.com>
date Thu, 05 Jan 2012 20:35:10 -0600
parents 0bd17a4bed88
children 51fc43253a52
comparison
equal deleted inserted replaced
15776:55a85a55f020 15777:12309c09d19a
1196 if not dryrun: 1196 if not dryrun:
1197 rejected = wctx.add(names, prefix) 1197 rejected = wctx.add(names, prefix)
1198 bad.extend(f for f in rejected if f in match.files()) 1198 bad.extend(f for f in rejected if f in match.files())
1199 return bad 1199 return bad
1200 1200
1201 def duplicatecopies(repo, rev, p1, p2): 1201 def duplicatecopies(repo, rev, p1):
1202 "Reproduce copies found in the source revision in the dirstate for grafts" 1202 "Reproduce copies found in the source revision in the dirstate for grafts"
1203 # Here we simulate the copies and renames in the source changeset 1203 for dst, src in copies.pathcopies(repo[p1], repo[rev]).iteritems():
1204 cop, diver = copies.mergecopies(repo, repo[rev], repo[p1], repo[p2]) 1204 repo.dirstate.copy(src, dst)
1205 m1 = repo[rev].manifest()
1206 m2 = repo[p1].manifest()
1207 for k, v in cop.iteritems():
1208 if k in m1:
1209 if v in m1 or v in m2:
1210 repo.dirstate.copy(v, k)
1211 if v in m2 and v not in m1 and k in m2:
1212 repo.dirstate.remove(v)
1213 1205
1214 def commit(ui, repo, commitfunc, pats, opts): 1206 def commit(ui, repo, commitfunc, pats, opts):
1215 '''commit the specified files or all outstanding changes''' 1207 '''commit the specified files or all outstanding changes'''
1216 date = opts.get('date') 1208 date = opts.get('date')
1217 if date: 1209 if date: