From e094644fb24b74a743beeca32cacee0c2b278d39 Mon Sep 17 00:00:00 2001 From: Stanislau Hlebik Date: Wed, 29 Mar 2017 03:10:12 -0700 Subject: [PATCH] infinitepush: wrap findcommonincoming if nodes are requested Summary: Previously we don't set findcommonincoming to True, and that bug was unnoticed because we send this info anyway in server-side `getbundlechunks()` function. But next diff in the stack uses a fast path server-side which won't work if fincommonincoming is not set to True. Test Plan: arc unit Reviewers: #mercurial, durham Reviewed By: durham Subscribers: durham, mjpieters, #sourcecontrol Differential Revision: https://phabricator.intern.facebook.com/D4770830 Tasks: 15389402 Signature: t1:4770830:1490719209:c251002d992e244580b7dbfeca0c30dff95734d2 --- infinitepush/__init__.py | 9 +++++++-- tests/test-infinitepush-bundlestore.t | 4 ++-- tests/test-infinitepush-pullbackup.t | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/infinitepush/__init__.py b/infinitepush/__init__.py index fc2f075b8c..26e0483bfc 100644 --- a/infinitepush/__init__.py +++ b/infinitepush/__init__.py @@ -581,6 +581,11 @@ def _pull(orig, ui, repo, source="default", **opts): source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) scratchbookmarks = {} + unfi = repo.unfiltered() + unknownnodes = [] + for rev in opts.get('rev', []): + if rev not in unfi: + unknownnodes.append(rev) if opts.get('bookmark'): bookmarks = [] revs = opts.get('rev') or [] @@ -623,9 +628,9 @@ def _pull(orig, ui, repo, source="default", **opts): except error.RepoLookupError: pass - if scratchbookmarks: + if scratchbookmarks or unknownnodes: # Set anyincoming to True - wrapfunction(discovery, 'findcommonincoming', _findcommonincoming) + wrapfunction(discovery, 'findcommonincoming', _findcommonincoming) try: # Remote scratch bookmarks will be deleted because remotenames doesn't # know about them. Let's save it before pull and restore after diff --git a/tests/test-infinitepush-bundlestore.t b/tests/test-infinitepush-bundlestore.t index 36648653b0..6ac4d22ec5 100644 --- a/tests/test-infinitepush-bundlestore.t +++ b/tests/test-infinitepush-bundlestore.t @@ -614,11 +614,11 @@ Make sure testpullbycommithash2 has not fetched $ hg pull -r `cat ../testpullbycommithash1` pulling from ssh://user@dummy/repo searching for changes - no changes found adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) $ hg log -G -T '{desc} {phase} {bookmarks}' o testpullbycommithash1 draft | @@ -676,11 +676,11 @@ Strip scratchontopofpublic commit and do hg update 'c70aee6da07d7cdb9897375473690df3a8563339' does not exist locally - looking for it remotely... pulling from ssh://user@dummy/repo searching for changes - no changes found adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) 'c70aee6da07d7cdb9897375473690df3a8563339' found remotely 2 files updated, 0 files merged, 2 files removed, 0 files unresolved diff --git a/tests/test-infinitepush-pullbackup.t b/tests/test-infinitepush-pullbackup.t index 06d36b1aa3..ee065e5477 100644 --- a/tests/test-infinitepush-pullbackup.t +++ b/tests/test-infinitepush-pullbackup.t @@ -31,11 +31,11 @@ Restore $ cd restored $ hg pullbackup pulling from ssh://user@dummy/repo - no changes found adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) $ hg log --graph -T '{desc}' o firstcommit @@ -66,11 +66,11 @@ Restore with ambiguous repo root [255] $ hg pullbackup --reporoot $TESTTMP/backupsource2 pulling from ssh://user@dummy/repo - no changes found adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files + (run 'hg update' to get a working copy) $ hg log --graph -T '{desc}' o secondcommit @@ -87,11 +87,11 @@ Check bookmarks escaping $ hg pullbackup --reporoot $TESTTMP/backupsource pulling from ssh://user@dummy/repo searching for changes - no changes found adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) + (run 'hg heads' to see heads, 'hg merge' to merge) $ hg book abook 1:89ecc969c0ac book/bookmarks/somebook 1:89ecc969c0ac @@ -116,11 +116,11 @@ Create a repo with `/bookmarks/` in path $ hg pullbackup --reporoot $TESTTMP/bookmarks/backupsource3 pulling from ssh://user@dummy/repo searching for changes - no changes found adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) + (run 'hg heads .' to see heads, 'hg merge' to merge) $ hg book abook 1:89ecc969c0ac book/bookmarks/somebook 1:89ecc969c0ac