Mercurial > hg
changeset 3699:4bafcf7aeb32
qrefresh: fix handling of added files (including copies) in the slow path
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 20 Nov 2006 19:32:42 -0200 |
parents | a9090b264250 |
children | 4c158de5f245 |
files | hgext/mq.py tests/test-mq tests/test-mq.out |
diffstat | 3 files changed, 92 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Mon Nov 20 19:32:41 2006 -0200 +++ b/hgext/mq.py Mon Nov 20 19:32:42 2006 -0200 @@ -915,8 +915,11 @@ util.set_exec(repo.wjoin(f), mmap.execf(f)) repo.dirstate.update(m + r, 'n') for f in a: - try: os.unlink(repo.wjoin(f)) - except: raise + try: + os.unlink(repo.wjoin(f)) + except OSError, e: + if e.errno != errno.ENOENT: + raise try: os.removedirs(os.path.dirname(repo.wjoin(f))) except: pass if a: @@ -1061,6 +1064,19 @@ else: self.printdiff(repo, patchparent, fp=patchf) patchf.close() + added = repo.status()[1] + for a in added: + f = repo.wjoin(a) + try: + os.unlink(f) + except OSError, e: + if e.errno != errno.ENOENT: + raise + try: os.removedirs(os.path.dirname(f)) + except: pass + # forget the file copies in the dirstate + # push should readd the files later on + repo.dirstate.forget(added) self.pop(repo, force=True, wlock=wlock) self.push(repo, force=True, wlock=wlock)
--- a/tests/test-mq Mon Nov 20 19:32:41 2006 -0200 +++ b/tests/test-mq Mon Nov 20 19:32:42 2006 -0200 @@ -207,3 +207,34 @@ git = False EOF hg qdiff --git + +cd .. +hg init slow +cd slow +hg qinit +echo foo > foo +hg add foo +hg ci -m 'add foo' +hg qnew bar +echo bar > bar +hg add bar +hg mv foo baz +hg qrefresh --git +hg up -C 0 +echo >> foo +hg ci -m 'change foo' +hg up -C 1 +hg qrefresh --git 2>&1 | grep -v 'saving bundle' +cat .hg/patches/bar +hg log -vC --template '{rev} {file_copies%filecopy}\n' -r . + +echo +hg up -C 1 +echo >> foo +hg ci -m 'change foo again' +hg up -C 2 +hg mv bar quux +hg mv baz bleh +hg qrefresh --git 2>&1 | grep -v 'saving bundle' +cat .hg/patches/bar +hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
--- a/tests/test-mq.out Mon Nov 20 19:32:41 2006 -0200 +++ b/tests/test-mq.out Mon Nov 20 19:32:42 2006 -0200 @@ -201,3 +201,46 @@ diff --git a/new b/copy copy from new copy to copy +1 files updated, 0 files merged, 2 files removed, 0 files unresolved +2 files updated, 0 files merged, 1 files removed, 0 files unresolved +adding branch +adding changesets +adding manifests +adding file changes +added 1 changesets with 1 changes to 1 files +(run 'hg update' to get a working copy) +Patch queue now empty +applying bar +Now at: bar +diff --git a/bar b/bar +new file mode 100644 +--- /dev/null ++++ b/bar +@@ -0,0 +1,1 @@ ++bar +diff --git a/foo b/baz +rename from foo +rename to baz +2 baz (foo) + +1 files updated, 0 files merged, 2 files removed, 0 files unresolved +2 files updated, 0 files merged, 1 files removed, 0 files unresolved +adding branch +adding changesets +adding manifests +adding file changes +added 1 changesets with 1 changes to 1 files +(run 'hg update' to get a working copy) +Patch queue now empty +applying bar +Now at: bar +diff --git a/foo b/bleh +rename from foo +rename to bleh +diff --git a/quux b/quux +new file mode 100644 +--- /dev/null ++++ b/quux +@@ -0,0 +1,1 @@ ++bar +3 bleh (foo)