Merge with crew-stable
authorBrendan Cully <brendan@kublai.com>
Sat, 10 Mar 2007 17:45:32 -0800
changeset 4182 ba51a8225a60
parent 4181 ac9e891f2c0f (current diff)
parent 4175 fc12ac3755d5 (diff)
child 4200 b5d1eaade333
Merge with crew-stable
hgext/mq.py
mercurial/commands.py
mercurial/dirstate.py
mercurial/localrepo.py
mercurial/merge.py
tests/test-mq
tests/test-mq.out
--- a/hgext/mq.py	Fri Mar 09 20:08:13 2007 +0100
+++ b/hgext/mq.py	Sat Mar 10 17:45:32 2007 -0800
@@ -1031,10 +1031,10 @@
             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 @@
                 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 @@
         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	Fri Mar 09 20:08:13 2007 +0100
+++ b/mercurial/dirstate.py	Sat Mar 10 17:45:32 2007 -0800
@@ -375,7 +375,7 @@
 
         # 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	Fri Mar 09 20:08:13 2007 +0100
+++ b/mercurial/localrepo.py	Sat Mar 10 17:45:32 2007 -0800
@@ -31,8 +31,8 @@
                                            " 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	Fri Mar 09 20:08:13 2007 +0100
+++ b/mercurial/merge.py	Sat Mar 10 17:45:32 2007 -0800
@@ -444,15 +444,15 @@
     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	Fri Mar 09 20:08:13 2007 +0100
+++ b/tests/test-mq	Sat Mar 10 17:45:32 2007 -0800
@@ -89,6 +89,18 @@
     -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	Fri Mar 09 20:08:13 2007 +0100
+++ b/tests/test-mq.out	Sat Mar 10 17:45:32 2007 -0800
@@ -91,6 +91,17 @@
 @@ -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	Fri Mar 09 20:08:13 2007 +0100
+++ b/tests/test-newbranch	Sat Mar 10 17:45:32 2007 -0800
@@ -63,3 +63,11 @@
     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	Fri Mar 09 20:08:13 2007 +0100
+++ b/tests/test-newbranch.out	Sat Mar 10 17:45:32 2007 -0800
@@ -94,3 +94,6 @@
 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