changeset 4177:ba51a8225a60

Merge with crew-stable
author Brendan Cully <brendan@kublai.com>
date Sat, 10 Mar 2007 17:45:32 -0800
parents ac9e891f2c0f (current diff) fc12ac3755d5 (diff)
children b5d1eaade333
files hgext/mq.py mercurial/commands.py mercurial/dirstate.py mercurial/localrepo.py mercurial/merge.py tests/test-mq tests/test-mq.out
diffstat 8 files changed, 50 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1031,10 +1031,10 @@ class queue:
             m = util.unique(mm)
             r = util.unique(dd)
             a = util.unique(aa)
-            filelist = filter(matchfn, util.unique(m + r + a))
+            c = [filter(matchfn, l) for l in (m, a, r, [], u)]
+            filelist = util.unique(c[0] + c[1] + c[2])
             patch.diff(repo, patchparent, files=filelist, match=matchfn,
-                       fp=patchf, changes=(m, a, r, [], u),
-                       opts=self.diffopts())
+                       fp=patchf, changes=c, opts=self.diffopts())
             patchf.close()
 
             repo.dirstate.setparents(*cparents)
@@ -1082,7 +1082,8 @@ class queue:
                 message = msg
 
             self.strip(repo, top, update=False, backup='strip', wlock=wlock)
-            n = repo.commit(filelist, message, changes[1], force=1, wlock=wlock)
+            n = repo.commit(filelist, message, changes[1], match=matchfn,
+                            force=1, wlock=wlock)
             self.applied[-1] = statusentry(revlog.hex(n), patchfn)
             self.applied_dirty = 1
         else:
@@ -1527,7 +1528,11 @@ def clone(ui, source, dest=None, **opts)
         if sr.mq.applied:
             qbase = revlog.bin(sr.mq.applied[0].rev)
             if not hg.islocal(dest):
-                destrev = sr.parents(qbase)[0]
+                heads = dict.fromkeys(sr.heads())
+                for h in sr.heads(qbase):
+                    del heads[h]
+                destrev = heads.keys()
+                destrev.append(sr.changelog.parents(qbase)[0])
     ui.note(_('cloning main repo\n'))
     sr, dr = hg.clone(ui, sr, dest,
                       pull=opts['pull'],
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -375,7 +375,7 @@ class dirstate(object):
 
         # walk all files by default
         if not files:
-            files = [self.root]
+            files = ['.']
             dc = self.map.copy()
         else:
             files = util.unique(files)
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -31,8 +31,8 @@ class localrepository(repo.repository):
                                            " here (.hg not found)"))
             path = p
 
-        self.path = os.path.join(path, ".hg")
         self.root = os.path.realpath(path)
+        self.path = os.path.join(self.root, ".hg")
         self.origroot = path
         self.opener = util.opener(self.path)
         self.wopener = util.opener(self.root)
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -444,15 +444,15 @@ def update(repo, node, branchmerge, forc
     wlock = working dir lock, if already held
     """
 
-    if node is None:
-        node = "tip"
-
     if not wlock:
         wlock = repo.wlock()
 
+    wc = repo.workingctx()
+    if node is None:
+        # tip of current branch
+        node = repo.branchtags()[wc.branch()]
     overwrite = force and not branchmerge
     forcemerge = force and branchmerge
-    wc = repo.workingctx()
     pl = wc.parents()
     p1, p2 = pl[0], repo.changectx(node)
     pa = p1.ancestor(p2)
--- a/tests/test-mq
+++ b/tests/test-mq
@@ -89,6 +89,18 @@ sed -e "s/^\(diff -r \)\([a-f0-9]* \)/\1
     -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
     -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" .hg/patches/test.patch
 
+echo % empty qrefresh
+
+hg qrefresh -X a
+echo 'revision:'
+hg diff -r -2 -r -1
+echo 'patch:'
+cat .hg/patches/test.patch
+echo 'working dir diff:'
+hg diff --nodates -q
+# restore things
+hg qrefresh
+
 echo % qpop
 
 hg qpop
--- a/tests/test-mq.out
+++ b/tests/test-mq.out
@@ -91,6 +91,17 @@ diff -r  xa
 @@ -1,1 +1,2 @@ a
  a
 +a
+% empty qrefresh
+revision:
+patch:
+foo bar
+
+working dir diff:
+--- a/a
++++ b/a
+@@ -1,1 +1,2 @@ a
+ a
++a
 % qpop
 Patch queue now empty
 % qpush
--- a/tests/test-newbranch
+++ b/tests/test-newbranch
@@ -63,3 +63,11 @@ except ValueError, inst:
     else:
         print "ValueError: %s" % inst
 EOF
+
+echo % update with no arguments: tipmost revision of the current branch
+hg up -q -C 0
+hg up -q
+hg id
+hg up -q 1
+hg up -q
+hg id
--- a/tests/test-newbranch.out
+++ b/tests/test-newbranch.out
@@ -94,3 +94,6 @@ foo                            4:4909a37
 bar                            2:67ec16bde7f1575d523313b9bca000f6a6f12dca
 % test old hg reading branch cache with feature list
 ValueError raised correctly, good.
+% update with no arguments: tipmost revision of the current branch
+bf1bc2f45e83
+4909a3732169 (foo) tip