Mercurial > hg-stable
diff mercurial/scmutil.py @ 19153:9a4e219bda89
scmutil.addremove: factor out code to mark added/removed/renames
An upcoming patch will reuse this code in another function.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 03 Apr 2013 15:53:59 -0700 |
parents | 7a1292523db3 |
children | 0c7cf411b390 |
line wrap: on
line diff
--- a/mercurial/scmutil.py Wed Apr 03 16:32:41 2013 -0700 +++ b/mercurial/scmutil.py Wed Apr 03 15:53:59 2013 -0700 @@ -707,15 +707,7 @@ similarity) if not dry_run: - wctx = repo[None] - wlock = repo.wlock() - try: - wctx.forget(deleted) - wctx.add(unknown) - for new, old in renames.iteritems(): - wctx.copy(old, new) - finally: - wlock.release() + _markchanges(repo, unknown, deleted, renames) for f in rejected: if f in m.files(): @@ -763,6 +755,19 @@ renames[new] = old return renames +def _markchanges(repo, unknown, deleted, renames): + '''Marks the files in unknown as added, the files in deleted as removed, + and the files in renames as copied.''' + wctx = repo[None] + wlock = repo.wlock() + try: + wctx.forget(deleted) + wctx.add(unknown) + for new, old in renames.iteritems(): + wctx.copy(old, new) + finally: + wlock.release() + def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None): """Update the dirstate to reflect the intent of copying src to dst. For different reasons it might not end with dst being marked as copied from src.