Commit Graph

34 Commits

Author SHA1 Message Date
Pierre-Yves David
6671f18b78 discovery: fix regression when checking heads for pre 1.4 client (issue3218)
This code is not run by the test suite and silly name error were lurking here.
2012-01-24 19:49:30 +01:00
Pierre-Yves David
06014d092f discovery: ensure that missingheads are always heads of everything we tried
This only alter the third block executed when:
    * repo have secret changeset
    * onlyheads is not None

In other case findcommonoutgoing already had this behavior
2012-01-20 19:41:18 +01:00
Pierre-Yves David
fa04c4b2de phases: properly register excluded changeset when revision are specified
There was no other drawback than a bad UI message for now.
2012-01-20 00:27:11 +01:00
Pierre-Yves David
a445988112 discovery: diet discovery.prepush from non-discovery code
The ``discovery.prepush`` function was doing multiple things not related to
discovery. This changeset move some code into the ``localrepo.push`` method. The
old ``discovery.prepush`` function jobs is now restricted to checking for
multple head creation. It was then renamed ``discovery.checkheads``.

This new ``discovery.checkheads`` function may receive several other changes in
the future but we are a bit too much near the freeze for a wider refactoring.
2012-01-19 15:50:55 +01:00
Pierre-Yves David
a728162c9a discovery: fix prepush documentation
The prepush documentation claim that when we refuse to push, the second element
of the returng tuple is an "outgoing" integer. value should be 0 when no
outgoing changeset and 1 otherwise.  In pratice if there are no outgoing
changeset, "outgoing" value is alway 1 and util.Abort is raised on other error.

the stable branch also include this error so it wasn't introduced by a recent
refactoring.
2012-01-13 22:16:01 +01:00
Pierre-Yves David
32c99d5daa phases: make outgoing object and discovery aware of exclusion
The outgoing object gains an "excluded" members holding all changesets which
were excluded because there where secret.

The core discovery code now remove secret changeset from discovery by default.
This means that any command relying on discovery will exclude secret changeset.
Most notable one are outgoing and bundle. (But bundle with and explicit
``--base`` still allow to bundle outgoing changeset.
2012-01-11 00:27:46 +01:00
Pierre-Yves David
e929cd5e49 discovery: introduce outgoing object for result of findcommonoutgoing
Simplifies client logic in multiple places since it encapsulates the
computation of the common and, more importantly, the missing node lists.

This also allows an upcomping patch to communicate precomputed versions of
these lists to clients.
2012-01-09 03:47:16 +01:00
Pierre-Yves David
8abd0aa7c9 phases: do not exchange secret changesets
Any secret changesets will be excluded from pull and push. Phase data are
properly synchronized on pull and push if a changeset is seen as secret locally
but is non-secret remote side.

This patch does not handle the case of a changeset secret on remote but known
locally.
2011-12-22 00:42:25 +01:00
Matt Mackall
75db0d196a merge with stable 2011-11-17 16:53:17 -06:00
Mads Kiilerich
065de91b14 add missing localization markup 2011-11-11 01:07:10 +01:00
Pierre-Yves David
88aa929fad discovery: Fix error print mentioning a 'None' branch
When talking to old server discovery use heads of the 'None' branch to refer to
topological heads. This use of None should never make it to the end user.
2011-10-17 11:37:59 +02:00
Pierre-Yves David
bf6f3ef1a7 phases: mark content pushed as public in local repo on push 2011-11-11 00:21:17 +01:00
Adrian Buehlmann
ff008eb648 prepush: show details about new remote heads with --verbose
previously, this info was only shown with --debug

Note that the new remote heads are only shown if the command aborts,
that is, they are *not* shown if --force was specified.

See also change 914ebeb62db8.
2011-06-03 13:10:22 +02:00
Adrian Buehlmann
1c143846c7 prepush: print short hash of first new head in abort message
and don't mention the branch if it's the default branch.

OLD:

  $ hg push ../a
  pushing to ../a
  searching for changes
  abort: push creates new remote heads on branch 'default'!
  (you should pull and merge or use push -f to force)

NEW:

  $ hg push ../a
  pushing to ../a
  searching for changes
  abort: push creates new remote head 1e108cc5548c!
  (you should pull and merge or use push -f to force)

This helps to identify which local head is causing troubles.

See also change 914ebeb62db8.
2011-06-03 12:16:17 +02:00
Adrian Buehlmann
a879df5001 prepush: eliminate 'if branch'
branch is always set anyway

No change in program behavior.
2011-06-03 11:26:43 +02:00
Peter Arrenbrecht
d4abc4d642 discovery: resurrect findoutgoing as findcommonoutgoing for extension hooks
discovery.findoutgoing used to be a useful hook for extensions like
hgsubversion. This patch reintroduces this version of findcommonincoming
which is meant to be used when computing outgoing changesets.
2011-05-06 14:44:18 +02:00
Sune Foldager
3d0e1080a1 fix errors reported by pyflakes test 2011-05-04 19:27:55 +02:00
Peter Arrenbrecht
75fa0e5ea9 discovery: add new set-based discovery
Adds a new discovery method based on repeatedly sampling the still
undecided subset of the local node graph to determine the set of nodes
common to both the client and the server.

For small differences between client and server, it uses about the same
or slightly fewer roundtrips than the old tree-based discovery. For
larger differences, it typically reduces the number of roundtrips
drastically (from 150 to 4, for instance).

The old discovery code now lives in treediscovery.py, the new code is
in setdiscovery.py.

Still missing is a hook for extensions to contribute nodes to the
initial sample. For instance, Augie's remotebranches could contribute
the last known state of the server's heads.

Credits for the actual sampler and computing common heads instead of
bases go to Benoit Boissinot.
2011-05-02 19:21:30 +02:00
Peter Arrenbrecht
b867e650e6 discovery: drop findoutgoing and simplify findcommonincoming's api
This is a long desired cleanup and paves the way for new discovery.
To specify subsets for bundling changes, all code should use the heads
of the desired subset ("heads") and the heads of the common subset
("common") to be excluded from the bundled set. These can be used
revlog.findmissing instead of revlog.nodesbetween.

This fixes an actual bug exposed by the change in test-bundle-r.t
where we try to bundle a changeset while specifying that said changeset
is to be assumed already present in the target. This used to still
bundle the changeset. It no longer does. This is similar to the bugs
fixed by the recent switch to heads/common for incoming/pull.
2011-04-30 17:21:37 +02:00
Peter Arrenbrecht
8f2d068a05 discovery: avoid discovery when local graph is a subset of remote
Immediately sends local's heads to the server to check whether the server knows them all.
If it does, we can call getbundle immediately.

Interesting test output changes are:

-  added 1 changesets with 0 changes to 1 files (+1 heads)
+  added 1 changesets with 0 changes to 0 files (+1 heads)

-> The new getbundle() actually fixes a bug vs. changegroupsubset() in that it no longer
returns unnecessary files when file revs are reused.

warning: repository is unrelated
+  requesting all changes

-> The new use of common instead of bases correctly indicates that an unrelated pull
gets all changes from the server.
2011-03-23 16:06:55 +01:00
Adrian Buehlmann
c5ab776a53 discovery: list new remote heads in prepush() on --debug
With this patch applied, Mercurial will list the hashes of new remote heads
if push --debug aborts because of new remote heads (option -f/--force not set).

Example:

  $ hg push --debug repo1
  using http://example.org/repo1
  http auth: user johndoe, password not set
  sending between command
  pushing to http://example.org/repo1
  sending capabilities command
  capabilities: changegroupsubset stream=1 lookup pushkey unbundle=HG10GZ,HG10BZ,HG10UN branchmap
  sending heads command
  searching for changes
  common changesets up to 187dd3f0a37d
  sending branchmap command
  new remote heads on branch 'default'        <- new output line
  new remote head 5862c07f53a2                <- new output line
  abort: push creates new remote heads on branch 'default'!
  (did you forget to merge? use push -f to force)

Compare to without --debug (not changed by this patch, including it here
for reference purposes only):

  $ hg push repo1
  pushing to http://example.org/repo1
  searching for changes
  abort: push creates new remote heads on branch 'default'!
  (did you forget to merge? use push -f to force)

Motivation for this change:

'hg outgoing' may list a whole lot of benign changesets plus an odd changeset
that will trigger the "new remote heads" abort. It can be hard to spot that
single unwanted changeset (it may be an old forgotten experiment, lingering
in the local repo).

"hg log -r 'heads(outgoing())'" might be useful, but that also lists a head
that may be benign on push.

Inside prepush(), we already know which heads are causing troubles on 'hg push'.
Why not make that info available (at least on --debug)?

This would also be helpful for doing remote support, as the supporter can ask
the user to paste the output of 'hg push --debug' on error and then ask further
questions about the heads listed.
2010-11-11 15:51:20 +01:00
Adrian Buehlmann
dcf407e791 discovery: remove erroneous comment in prepush()
New named branches *can* be created without -f/--force by specifying
--new-branch
2010-11-11 15:42:27 +01:00
Benoit Boissinot
8af083904d discovery: findincoming() is no longer used 2010-10-17 22:24:26 +02:00
Benoit Boissinot
35eccd5baa discovery: use set instead of dict 2010-10-17 19:25:35 +02:00
Benoit Boissinot
52e06cf01f discovery: remove unused "base" argument from find.*incoming() 2010-10-17 16:16:12 +02:00
Benoit Boissinot
afac0ba765 discovery: do not use the implicit updating of the "base" arg 2010-10-09 17:16:39 -05:00
Benoit Boissinot
31e709145d discovery: remove duplication for new remote head discovery 2010-07-15 21:44:51 +02:00
Benoit Boissinot
ed9ce23624 discovery: better coding style 2010-07-15 21:21:19 +02:00
Benoit Boissinot
796c9e7718 discovery: simplify findoutgoing(), the updated_head stuff wasn't used 2010-07-15 21:20:32 +02:00
Benoit Boissinot
a13fa80461 Abort: add a hint argument, printed in the next line inside parenthesis
discovery was using a custom made message for this purpose
push now returns -1 after aborting, instead of 1 previously
2010-07-15 14:41:22 +02:00
Benoit Boissinot
52fefe2806 discovery: clarify comment 2010-07-15 14:40:17 +02:00
Martin Geisler
c890ed545b discovery: use stable sort order in --new-branch warning
A Python set seems to do this already when you iterate over it, but
this should be considered an implementation detail and not something
we can rely on.

This also gets rid of an unnecessary string conversion -- the set
already contains strings.
2010-06-22 12:38:39 +02:00
Dirkjan Ochtman
87509d8b7e discovery: fix description line 2010-06-09 17:27:47 +02:00
Dirkjan Ochtman
cf1de649bd move discovery methods from localrepo into new discovery module 2010-06-07 18:35:54 +02:00