[PATCH] mq: disable `slow path' of the `qrefresh' command
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Sat Feb 6 12:16:48 CST 2010
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1265477787 -3600
# Node ID ce1ceed8183882b6083b1788e97cf95f914a683b
# Parent 2b87d62c06c661cfee945e81901ce13003a2c64c
mq: disable `slow path' of the `qrefresh' command.
The slow path/fast path distinction has existed since `mq' was added
to Mercurial in 2006. The slow path was used whenever the refreshed
revision wasn't the tip --- that is, qtip != tip --- but its
implementation was not kept up-to-date. For example, the -s/--short
option was completely ignored.
This patch removes the slow path and simply uses the fast path instead.
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1227,14 +1227,13 @@ class queue(object):
if comments:
patchf.write(comments)
- tip = repo.changelog.tip()
- if top == tip:
- # if the top of our patch queue is also the tip, there is an
- # optimization here. We update the dirstate in place and strip
- # off the tip commit. Then just commit the current directory
- # tree. We can also send repo.commit the list of files
- # changed to speed up the diff
- #
+ # We update the dirstate in place, strip off the qtip
+ # commit and then commit.
+ #
+ # Please note that `strip' handles stripping non-tip
+ # revisions by stashing away the changes and re-applying
+ # them; a possible source of bugs.
+ if True:
# in short mode, we only diff the files included in the
# patch already plus specified files
#
@@ -1243,8 +1242,8 @@ class queue(object):
# but we do it backwards to take advantage of manifest/chlog
# caching against the next repo.status call
#
- mm, aa, dd, aa2 = repo.status(patchparent, tip)[:4]
- changes = repo.changelog.read(tip)
+ mm, aa, dd, aa2 = repo.status(patchparent, top)[:4]
+ changes = repo.changelog.read(top)
man = repo.manifest.read(changes[0])
aaa = aa[:]
matchfn = cmdutil.match(repo, pats, opts)
@@ -1259,7 +1258,7 @@ class queue(object):
m, a, r, d = repo.status(match=match)[:4]
# we might end up with files that were added between
- # tip and the dirstate parent, but then changed in the
+ # qtip and the dirstate parent, but then changed in the
# local dirstate. in this case, we want them to only
# show up in the added section
for x in m:
@@ -1306,7 +1305,7 @@ class queue(object):
if src is not None and src in repo.dirstate:
copies.setdefault(src, []).append(dst)
repo.dirstate.add(dst)
- # remember the copies between patchparent and tip
+ # remember the copies between patchparent and qtip
for dst in aaa:
f = repo.file(dst)
src = f.renamed(man[dst])
@@ -1376,24 +1375,6 @@ class queue(object):
self.ui.warn(_('refresh interrupted while patch was popped! '
'(revert --all, qpush to recover)\n'))
raise
- else:
- self.printdiff(repo, diffopts, patchparent, fp=patchf)
- patchf.rename()
- 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(a)
- self.pop(repo, force=True)
- self.push(repo, force=True)
finally:
wlock.release()
self.removeundo(repo)
diff --git a/tests/test-mq.out b/tests/test-mq.out
--- a/tests/test-mq.out
+++ b/tests/test-mq.out
@@ -396,16 +396,11 @@ copy to copy
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
created new head
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
-popping bar
adding branch
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
-patch queue now empty
-(working directory not at a head)
-applying bar
-now at: bar
diff --git a/bar b/bar
new file mode 100644
--- /dev/null
@@ -431,16 +426,11 @@ diff --git a/foo b/baz
% test file move chains in the slow path
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
-popping bar
adding branch
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
-patch queue now empty
-(working directory not at a head)
-applying bar
-now at: bar
diff --git a/foo b/bleh
rename from foo
rename to bleh
More information about the Mercurial-devel
mailing list