Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 18853:78d760aa3607
duplicatecopies: do not mark items not in the dirstate as copies
Consider the following repo:
0 -- 1 (renames a to b)
\
- 2
If we're rebasing 2 onto 1, then duplicatecopies is called with arguments (2,
1). copies.pathcopies goes backwards from 1 to 0 and returns the pair dst = a,
src = b. Of course, since we're working on top of 2, at this point a doesn't
exist in the dirstate.
Extra entries in the copymap are currently harmless because the copymap is
only queried for items in the dirstate map. However, if the dirstate.copy
method becomes one of the sources used to determine which files have changed,
this will prove problematic.
Note that we can't avoid going backwards in general -- consider this repo:
0 -- 1 (renames a to b)
\
- 2 (renames a to c)
Rebasing 2 onto 1 should produce a rename from b to c.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Thu, 28 Mar 2013 18:27:19 -0700 |
parents | 300844cb1a56 |
children | 3a72c89a83ec |
comparison
equal
deleted
inserted
replaced
18852:300844cb1a56 | 18853:78d760aa3607 |
---|---|
1591 return bad, forgot | 1591 return bad, forgot |
1592 | 1592 |
1593 def duplicatecopies(repo, rev, fromrev): | 1593 def duplicatecopies(repo, rev, fromrev): |
1594 '''reproduce copies from fromrev to rev in the dirstate''' | 1594 '''reproduce copies from fromrev to rev in the dirstate''' |
1595 for dst, src in copies.pathcopies(repo[fromrev], repo[rev]).iteritems(): | 1595 for dst, src in copies.pathcopies(repo[fromrev], repo[rev]).iteritems(): |
1596 repo.dirstate.copy(src, dst) | 1596 # copies.pathcopies returns backward renames, so dst might not |
1597 # actually be in the dirstate | |
1598 if repo.dirstate[dst] in "nma": | |
1599 repo.dirstate.copy(src, dst) | |
1597 | 1600 |
1598 def commit(ui, repo, commitfunc, pats, opts): | 1601 def commit(ui, repo, commitfunc, pats, opts): |
1599 '''commit the specified files or all outstanding changes''' | 1602 '''commit the specified files or all outstanding changes''' |
1600 date = opts.get('date') | 1603 date = opts.get('date') |
1601 if date: | 1604 if date: |