diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -357,6 +357,9 @@ def getremotechanges(ui, repo, other, on 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() diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2339,9 +2339,12 @@ def debugobsolete(ui, repo, precursor=No 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: diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -553,6 +553,8 @@ class changectx(basectx): 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: diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -217,6 +217,7 @@ def _oldheadssummary(repo, remoteheads, # 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 @@ def checkheads(repo, remote, outgoing, r 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: diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -1052,7 +1052,7 @@ def update(repo, node, branchmerge, forc 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) diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -277,6 +277,8 @@ class obsstore(object): 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])) diff --git a/tests/test-merge-criss-cross.t b/tests/test-merge-criss-cross.t --- a/tests/test-merge-criss-cross.t +++ b/tests/test-merge-criss-cross.t @@ -24,8 +24,6 @@ Criss cross merging $ 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 @@ Redo merge with merge.preferancestor="*" 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 @@ http://stackoverflow.com/questions/93500 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 .. diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -62,6 +62,14 @@ Killing a single changeset without repla $ 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 diff --git a/tests/test-setdiscovery.t b/tests/test-setdiscovery.t --- a/tests/test-setdiscovery.t +++ b/tests/test-setdiscovery.t @@ -324,4 +324,30 @@ One with >200 heads, which used to use u 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 .. diff --git a/tests/test-treediscovery.t b/tests/test-treediscovery.t --- a/tests/test-treediscovery.t +++ b/tests/test-treediscovery.t @@ -17,11 +17,13 @@ Setup HTTP server control: > 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 @@ Local is subset: 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 @@ Remote is empty: no changes found [1] $ cd .. + $ tstop Local is superset: - $ tstop $ hg clone main subset2 --rev name2 adding changesets adding manifests @@ -280,10 +283,11 @@ Local is superset: 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 @@ Partial pull: 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 @@ Both have new stuff in new named branche 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 @@ Both have new stuff in new named branche 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 @@ Both have new stuff in existing named br 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 @@ Both have new stuff in existing named br 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 -