merge with stable
authorMatt Mackall <mpm@selenic.com>
Fri, 15 Aug 2014 11:48:05 -0500
changeset 22207 8dda6f6ff564
parent 22206 6122ad50e38f (current diff)
parent 22182 510cafe72004 (diff)
child 22208 d3659b3795e9
merge with stable
mercurial/commands.py
mercurial/context.py
mercurial/merge.py
mercurial/obsolete.py
tests/test-obsolete.t
tests/test-treediscovery.t
--- a/mercurial/bundlerepo.py	Fri Aug 15 23:05:53 2014 +0900
+++ b/mercurial/bundlerepo.py	Fri Aug 15 11:48:05 2014 -0500
@@ -357,6 +357,9 @@
             pass
         return repo, [], other.close
 
+    commonset = set(common)
+    rheads = [x for x in rheads if x not in commonset]
+
     bundle = None
     bundlerepo = None
     localrepo = other.local()
--- a/mercurial/commands.py	Fri Aug 15 23:05:53 2014 +0900
+++ b/mercurial/commands.py	Fri Aug 15 11:48:05 2014 -0500
@@ -2339,9 +2339,12 @@
         try:
             tr = repo.transaction('debugobsolete')
             try:
-                repo.obsstore.create(tr, parsenodeid(precursor), succs,
-                                     opts['flags'], metadata)
-                tr.close()
+                try:
+                    repo.obsstore.create(tr, parsenodeid(precursor), succs,
+                                         opts['flags'], metadata)
+                    tr.close()
+                except ValueError, exc:
+                    raise util.Abort(_('bad obsmarker input: %s') % exc)
             finally:
                 tr.release()
         finally:
--- a/mercurial/context.py	Fri Aug 15 23:05:53 2014 +0900
+++ b/mercurial/context.py	Fri Aug 15 11:48:05 2014 -0500
@@ -553,6 +553,8 @@
             anc = cahs[0]
         else:
             for r in self._repo.ui.configlist('merge', 'preferancestor'):
+                if r == '*':
+                    continue
                 ctx = changectx(self._repo, r)
                 anc = ctx.node()
                 if anc in cahs:
--- a/mercurial/discovery.py	Fri Aug 15 23:05:53 2014 +0900
+++ b/mercurial/discovery.py	Fri Aug 15 11:48:05 2014 -0500
@@ -217,6 +217,7 @@
     # This explains why the new head are very simple to compute.
     r = repo.set('heads(%ln + %ln)', oldheads, outgoing.missing)
     newheads = list(c.node() for c in r)
+    # set some unsynced head to issue the "unsynced changes" warning
     unsynced = inc and set([None]) or set()
     return {None: (oldheads, newheads, unsynced)}
 
@@ -313,12 +314,18 @@
             newhs = candidate_newhs
         unsynced = sorted(h for h in unsyncedheads if h not in discardedheads)
         if unsynced:
-            if len(unsynced) <= 4 or repo.ui.verbose:
+            if None in unsynced:
+                # old remote, no heads data
+                heads = None
+            elif len(unsynced) <= 4 or repo.ui.verbose:
                 heads = ' '.join(short(h) for h in unsynced)
             else:
                 heads = (' '.join(short(h) for h in unsynced[:4]) +
                          ' ' + _("and %s others") % (len(unsynced) - 4))
-            if branch is None:
+            if heads is None:
+                repo.ui.status(_("remote has heads that are "
+                                 "not known locally\n"))
+            elif branch is None:
                 repo.ui.status(_("remote has heads that are "
                                  "not known locally: %s\n") % heads)
             else:
--- a/mercurial/merge.py	Fri Aug 15 23:05:53 2014 +0900
+++ b/mercurial/merge.py	Fri Aug 15 11:48:05 2014 -0500
@@ -1052,7 +1052,7 @@
                 cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node())
                 pas = [repo[anc] for anc in (sorted(cahs) or [nullid])]
             else:
-                pas = [p1.ancestor(p2, warn=True)]
+                pas = [p1.ancestor(p2, warn=branchmerge)]
 
         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
 
--- a/mercurial/obsolete.py	Fri Aug 15 23:05:53 2014 +0900
+++ b/mercurial/obsolete.py	Fri Aug 15 11:48:05 2014 -0500
@@ -277,6 +277,8 @@
         for succ in succs:
             if len(succ) != 20:
                 raise ValueError(succ)
+        if prec in succs:
+            raise ValueError(_('in-marker cycle with %s') % node.hex(prec))
         marker = (str(prec), tuple(succs), int(flag), encodemeta(metadata))
         return bool(self.add(transaction, [marker]))
 
--- a/tests/test-merge-criss-cross.t	Fri Aug 15 23:05:53 2014 +0900
+++ b/tests/test-merge-criss-cross.t	Fri Aug 15 11:48:05 2014 -0500
@@ -24,8 +24,6 @@
   $ hg ci -m '5 second change f1'
 
   $ hg up -r3
-  note: using 0f6b37dbe527 as ancestor of adfe50279922 and cf89f02107e5
-        alternatively, use --config merge.preferancestor=40663881a6dd
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo '6 second change' > f2
   $ hg ci -m '6 second change f2'
@@ -169,8 +167,6 @@
 The other way around:
 
   $ hg up -C -r5
-  note: using 0f6b37dbe527 as ancestor of 3b08d01b0ab5 and adfe50279922
-        alternatively, use --config merge.preferancestor=40663881a6dd
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge -v --debug --config merge.preferancestor="*"
   note: merging adfe50279922+ and 3b08d01b0ab5 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
@@ -345,4 +341,15 @@
   b
   c
 
+Verify that the old context ancestor works with / despite preferancestor:
+
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor=1 -T '{rev}\n'
+  1
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor=2 -T '{rev}\n'
+  2
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor=3 -T '{rev}\n'
+  1
+  $ hg log -r 'ancestor(head())' --config merge.preferancestor='*' -T '{rev}\n'
+  1
+
   $ cd ..
--- a/tests/test-obsolete.t	Fri Aug 15 23:05:53 2014 +0900
+++ b/tests/test-obsolete.t	Fri Aug 15 11:48:05 2014 -0500
@@ -62,6 +62,14 @@
   $ hg tip
   -1:000000000000 (public) [tip ] 
   $ hg up --hidden tip --quiet
+
+Killing a single changeset with itself should fail
+(simple local safeguard)
+
+  $ hg debugobsolete `getid kill_me` `getid kill_me`
+  abort: bad obsmarker input: in-marker cycle with 97b7c2d76b1845ed3eb988cd612611e72406cef0
+  [255]
+
   $ cd ..
 
 Killing a single changeset with replacement
--- a/tests/test-setdiscovery.t	Fri Aug 15 23:05:53 2014 +0900
+++ b/tests/test-setdiscovery.t	Fri Aug 15 11:48:05 2014 -0500
@@ -324,4 +324,30 @@
   5 total queries
   common heads: 3ee37d65064a
 
+Test actual protocol when pulling one new head in addition to common heads
+
+  $ hg clone -U b c
+  $ hg -R c id -ir tip
+  513314ca8b3a
+  $ hg -R c up -qr default
+  $ touch c/f
+  $ hg -R c ci -Aqm "extra head"
+  $ hg -R c id -i
+  e64a39e7da8b
+
+  $ hg serve -R c -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ hg -R b incoming http://localhost:$HGPORT/ -T '{node|short}\n'
+  comparing with http://localhost:$HGPORT/
+  searching for changes
+  e64a39e7da8b
+
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
+  $ cut -d' ' -f6- access.log | grep -v cmd=known # cmd=known uses random sampling
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db
+  "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477
+  $ cat errors.log
+
   $ cd ..
--- a/tests/test-treediscovery.t	Fri Aug 15 23:05:53 2014 +0900
+++ b/tests/test-treediscovery.t	Fri Aug 15 11:48:05 2014 -0500
@@ -17,11 +17,13 @@
   >   echo '[web]' > $1/.hg/hgrc
   >   echo 'push_ssl = false' >> $1/.hg/hgrc
   >   echo 'allow_push = *' >> $1/.hg/hgrc
-  >   hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -E errors.log
+  >   hg serve -R $1 -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
   >   cat hg.pid >> $DAEMON_PIDS
   > }
   $ tstop() {
   >   "$TESTDIR/killdaemons.py" $DAEMON_PIDS
+  >   [ "$1" ] && cut -d' ' -f6- access.log && cat errors.log
+  >   rm access.log errors.log
   > }
 
 Both are empty:
@@ -188,10 +190,11 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
 Remote is empty:
 
-  $ tstop ; tstart empty2
+  $ tstart empty2
   $ cd main
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -230,10 +233,10 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
 Local is superset:
 
-  $ tstop
   $ hg clone main subset2 --rev name2
   adding changesets
   adding manifests
@@ -280,10 +283,11 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
 Partial pull:
 
-  $ tstop ; tstart main
+  $ tstart main
   $ hg clone $remote partial --rev name2
   adding changesets
   adding manifests
@@ -322,10 +326,10 @@
   10 8b6bad1512e1: r10 both
   11 a19bfa7e7328: r11 both
   $ cd ..
+  $ tstop
 
 Both have new stuff in new named branches:
 
-  $ tstop
   $ hg clone main repo1a --rev name1 -q
   $ hg clone repo1a repo1b -q
   $ hg clone main repo2a --rev name2 -q
@@ -372,8 +376,9 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
-  $ tstop ; tstart repo1b
+  $ tstart repo1b
   $ cd repo2b
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -414,10 +419,10 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
 Both have new stuff in existing named branches:
 
-  $ tstop
   $ rm -r repo1a repo1b repo2a repo2b
   $ hg clone main repo1a --rev 3 --rev 8 -q
   $ hg clone repo1a repo1b -q
@@ -460,8 +465,9 @@
   no changes found
   [1]
   $ cd ..
+  $ tstop
 
-  $ tstop ; tstart repo1b
+  $ tstart repo1b
   $ cd repo2b
   $ hg incoming $remote
   comparing with http://localhost:$HGPORT/
@@ -497,6 +503,32 @@
   no changes found
   [1]
   $ cd ..
-
-  $ tstop
-
+  $ tstop show
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
+  "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=branchmap HTTP/1.1" 200 -
+  "GET /?cmd=branchmap HTTP/1.1" 200 -
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
+  "POST /?cmd=unbundle HTTP/1.1" 200 - x-hgarg-1:heads=686173686564+1827a5bb63e602382eb89dd58f2ac9f3b007ad91
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases
+  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -
+  "GET /?cmd=capabilities HTTP/1.1" 200 -
+  "GET /?cmd=heads HTTP/1.1" 200 -