Mercurial > hg-stable
comparison hgext/mq.py @ 15322:c8e2a5ea7062 stable
mq: avoid data loss upon qfold + qmv (issue3058)
When renaming a patch A as B where B was previously qfolded into A and
therefore marked as removed, a versioned MQ would first restore B before
marking it as a copy of A, thus losing A changes. The undelete() call is
probably a left-over, wctx.copy() explicitely handles the case where the
destination is removed.
Also note that status command represents "hg rm b; hg mv a b" as:
A b
a
R a
which explains the first hunk in test-mq-qrename.t.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 20 Oct 2011 16:43:31 +0200 |
parents | fe9677449331 |
children | 7c06e9c35f2f e6c44dbe902f |
comparison
equal
deleted
inserted
replaced
15321:e174353e8cda | 15322:c8e2a5ea7062 |
---|---|
2612 try: | 2612 try: |
2613 if r.dirstate[patch] == 'a': | 2613 if r.dirstate[patch] == 'a': |
2614 r.dirstate.drop(patch) | 2614 r.dirstate.drop(patch) |
2615 r.dirstate.add(name) | 2615 r.dirstate.add(name) |
2616 else: | 2616 else: |
2617 if r.dirstate[name] == 'r': | |
2618 wctx.undelete([name]) | |
2619 wctx.copy(patch, name) | 2617 wctx.copy(patch, name) |
2620 wctx.forget([patch]) | 2618 wctx.forget([patch]) |
2621 finally: | 2619 finally: |
2622 wlock.release() | 2620 wlock.release() |
2623 | 2621 |