Commit Graph

22174 Commits

Author SHA1 Message Date
Pierre-Yves David
cb0b9120c1 bundle2: pull obsmarkers relevant to the pulled set through bundle2
We use the new `obsheads` argument to retrieve them in a bundle2 part at the
same time as the changegroup.
2014-08-26 12:47:41 +02:00
Pierre-Yves David
e65921cdf4 getbundle: add obsmarkers argument to getbundle
This argument triggers the retrieval of all markers relevant to the set of
changesets defined by the nodes in `heads`.
2014-08-29 12:36:17 +02:00
Pierre-Yves David
4fa8350ddd pull: use the "cg" argument when pulling a bundle2
We use the `cg` argument to disable the generation of a changegroup part. This
is useful to pull information when changesets are already in sync (phases,
obsmarkers).
2014-08-29 12:28:58 +02:00
Pierre-Yves David
d291149b10 wireprotocol: fix 'boolean' handling
The encoding and decoding code were swapped. This is now fixed.
2014-08-29 12:51:00 +02:00
Pierre-Yves David
81f365f70c push: only push obsmarkers relevant to the "pushed subset"
We should only exchange obsolete markers related to the changesets
that are being exchanged. For example, if `A'` is a successor of `A`,
we do not want to push the marker if we are not exchanging
`A'`. Otherwise `A` would disappear without a successor, leading to confusion
for both users and the evolution mechanism.

Therefore we now exchange only the markers relevant to the subset of nodes
involved in the push (the nodes themselves may be already common but were
selected by --rev (or the lack of --rev)).

Note that all selected markers are still exchanged on each push. We do
not have a discovery protocol for markers in core yet. Such discovery
would save us the exchange of markers known on both side.
2014-08-20 01:15:09 -07:00
Pierre-Yves David
78eab12f44 test-obsolete: sort the output of debugobsolete
The set of relevant markers is currently unordered. Therefore the
markers will be added in arbitrary order. We sort the list of markers
beforehand to ensure stable output for testing.
2014-08-20 19:47:35 -07:00
Pierre-Yves David
56469dc57f test-obsolete: change a marker so it is relevant to the exchanged set
We are going to only exchange markers relevant to the exchanged
changesets. So we need to change this marker to use a known changeset as
a successor instead of a precursor.
2014-08-20 19:42:33 -07:00
Pierre-Yves David
4dda0b0535 push: use bundle2 to push obsmarkers when possible 2014-08-25 19:44:27 +02:00
Pierre-Yves David
64fe90ce39 exchange: add a buildobsmarkerpart function
We'll have to build an obsmarker part for both push and pull. So we build a
function to factor out the common part.
2014-08-25 19:32:51 +02:00
Pierre-Yves David
9c8ad08d12 obsolete: add a commonversion function
This function returns the highest common version between the locally known
formats and a list of remotely known formats. This is going to be useful to
know what format should be used for exchange.
2014-08-26 11:36:23 +02:00
Pierre-Yves David
e2072df9be bundle2: add a obsmarkersversion function to extract supported version
Right next to the function that encodes the supported versions in
capabilities we add a function that decodes the versions out of capabilities.
This is going to be useful to know what formats can be used for exchange.
2014-08-26 11:48:26 +02:00
Pierre-Yves David
661ba0c427 bundle2: advertise the obsmarker part in bundle2 capabilities 2014-08-21 18:18:38 -07:00
Pierre-Yves David
efcf1868b1 bundle2: introduce a getrepocaps to retrieve the bundle2 caps of a repo
This function lets extensions change the bundle2 capabilities of a repository.
2014-08-25 19:21:47 +02:00
Pierre-Yves David
757af06075 obsmarker: move bundle2caps from the localrepo class to the bundle2 module
The localrepo path was quicker, easier, more seductive. We'll soon add a
function in another changeset to alter the capabilities.
2014-08-25 19:17:06 +02:00
Pierre-Yves David
c3dde4235f obsmarker: produce a reply part for markers received through bundle2 2014-08-25 18:35:39 +02:00
Pierre-Yves David
fc6088afa7 obsmarker: record the number of new markers in the transaction
This lets hooks be notified about new markers in the repository.
2014-08-25 18:26:56 +02:00
Pierre-Yves David
417557b6af obssmarker: add a bundle2 record with the number of markers added 2014-08-25 18:10:08 +02:00
Pierre-Yves David
2a117cfbf2 obsmarker: write a message with the number of markers added through bundle2 2014-08-25 18:09:54 +02:00
Pierre-Yves David
fc505cbe59 bundle2: add an obsmarkers part handler
This part contains a binary stream of obsolescence markers. Received markers are
added to the repository.
2014-08-25 18:08:22 +02:00
Pierre-Yves David
d8f05095f7 obsolete: make encodemarkers a public function
We'll need access to it for bundle2.
2014-08-25 16:24:40 +02:00
Pierre-Yves David
460e985627 obsolete: move _encodemarkers next to _readmarkers 2014-08-25 16:21:33 +02:00
Pierre-Yves David
73e94f0411 obsstore: store and preserve ondisk version 2014-08-25 16:18:44 +02:00
Pierre-Yves David
150d8e5d5f obsolete: have _readmarkers return the format version
readmarkers is not returning the version of the format it read from. This will
let callers know about the format and allow them to preserve it.
2014-08-25 16:51:51 +02:00
Pierre-Yves David
2be245bb0d obsolete: support for any known obsstore format when reading or writing
We can now read and write any known format. The list of known formats
currently has one element (0). The obsstore itself is not aware of
multiple formats yet and always uses format 0.
2014-08-25 16:16:01 +02:00
Pierre-Yves David
e891429fca obsolete: move _fm0encodeonemarker next to _fm0readmarkers 2014-08-25 16:09:18 +02:00
Pierre-Yves David
59d5970fe3 obsolete: rename _encodeonemarker to _fm0encodeonemarkers
This function encodes markers in version 0 of the format.
2014-08-25 16:43:23 +02:00
Pierre-Yves David
30503ced28 obsolete: extract the part of _readmarkers specific to format version 0
If we are to introduce new formats we need to be able call different
functions for different formats. Creating a function for format
version 0 is the first step.
2014-08-25 14:58:11 +02:00
Pierre-Yves David
104efe6c90 obsolete: rename all _fm to _fm0
This change is because these formats are used for version 0 of the
obsstore format. This is going to be useful in the future when we
introduce new versions of the format.
2014-08-25 14:56:15 +02:00
Pierre-Yves David
7cf82e8c6d obsolete: rename _fnodesize to _fmfnodesize
All variables involved in the obsstore format are prefixed with `_fm`.
`_fnodesize` was the exception. It is now back in line.

This is meaningful as we'll need to distinguish between multiple versions of the
obsstore format.
2014-08-25 14:52:51 +02:00
Pierre-Yves David
1ea986ffcd obsstore: have the mergemarkers method return the number of new markers
The mergemarkers function now returns the number of unknown markers in
the stream that have been added to the obsstore. This is similar to what
`obsstore.add` already does.

The method gains a docstring in the process.
2014-08-21 17:42:50 -07:00
Pierre-Yves David
c68039db71 test-bundle2: add obsolescence information to be exchanged
To introduce a bundle2 way to exchange obsolescence markers, we need to
have some information available to exchange. Introduce markers relevant
to changesets involved in the exchange. The new markers reference the
changesets as successor nodes of clowny (nonexistent) hashes so that
other than being exchanged they have no effect.

We introduce them in two waves as push is expected to be smart about the
number of markers it exchanges sooner than pull.
2014-08-21 17:36:05 -07:00
Matt Mackall
aaadb558ea merge with crew 2014-08-30 18:44:59 +02:00
Kevin Bullock
13972d0b4a bookmarks: refer to "the" active bookmark to clarify that there's only one
This is a follow-on to c6533daf7fc4 that just makes a slight clarification.
2014-08-30 15:13:02 +02:00
Siddharth Agarwal
65cbe9daf5 memctx: allow extensions to determine what filectxfn should do
Rev 2eef89bfd70d switched the contract for filectxfn from "raise IOError if
file is missing" to "return None if file is missing". Out of tree extensions
need to be updated for that, but for extensions interested in compatibility
with both Mercurial <= 3.1 and default, it is next to impossible to introspect
core Mercurial to figure out what to do.

This patch adds a field to memctx for extensions to use.
2014-08-30 05:29:38 -07:00
Gregory Szorc
94580f82da revsetbenchmark: add revset with lazyset subtraction
The added revset is used by obsolescence and currently results in
recursion in __contains__ between 2 lazysets. We should have
coverage of this revset.
2014-08-30 15:17:37 +02:00
Sune Foldager
f4c36b46b4 debugrevlog: add chainlen column to --dump output 2014-08-30 11:57:46 +02:00
Henrik Stuart
7b873ceea6 debugdag: stop wrongly sorting parents
The dag being dumped is not in a format that allows us to reconstruct the
original dag as the parent revisions are normalised.
2014-08-30 11:56:33 +02:00
Gregory Szorc
3cffe8cb84 obsolete: avoid slow, generic date parsing
Simple profiling of `hg log -r .` revealed ~18,000 calls to
mercurial.i18n.gettext() on the author's repository. The
culprit was 3 _() calls in util.parsedate() multiplied by
~6000 obsmarkers originating from the parsing of obsmarkers.

Changing the obsmarker code to parse the stored format of
dates instead of going through a generic path eliminates these
gettext() lookups and makes `hg log -r .` execute ~10% faster
on the author's repo. The performance gain is proportional to
the number of obsmarkers.

The author attempted to patch util.parsedate() to avoid the
gettext() lookups. However, that code is whacky and the author
is jet lagged, so the approach was not attempted.
2014-08-29 18:00:44 +02:00
Kevin Bullock
b5dafd9f52 build: don't use -s flag for which
`which -s` is a BSDism that doesn't exist on other versions of
`which`. That means that even on Mac OS X, `make osx` breaks if you have
another utils package installed (e.g. debianutils installed thru
fink). Redirect output to /dev/null instead.
2014-08-29 12:06:31 +02:00
Matt Mackall
fc6de0f1aa contrib: drop obsolete sample.hgrc
This was full of bad suggestions and is obsoleted by hg config --edit.
2014-08-29 17:15:49 +02:00
Matt Mackall
108b8a7b71 contrib: drop old convert-repo script
This has been obsolete since 2007.
2014-08-29 17:14:45 +02:00
Matt Mackall
3ce3f9064f merge with stable 2014-08-27 18:35:34 +02:00
FUJIWARA Katsunori
5c74f6bc14 import: show the warning message for failure of merging
Before this patch, no message is shown for failure of merging at "hg
import".

In such case, merging patch is imported as a normal revision silently,
and it may confuse users.

For simplicity, this patch recommends just using "--exact", even
though importing the merging patch itself is possible without it if:

  - the hash of the 1st parent in the patch is equal to one of the
    patch imported just before (or the parent of the working
    directory, for the 1st patch of the series), and

  - the hash of the 2nd parent in the patch is known in the local
    repository
2014-08-27 23:10:06 +09:00
Mads Kiilerich
bb5bc3c743 graft: fix collision detection with origin revisions that are missing
When grafting something with a matching origin, it would normally be skipped:
  skipping already grafted revision 123 (23 also has origin 12)

But after stripping a graft origin, graft could fail with a reference to the
origin that no longer exists:
  abort: unknown revision '5c095ad7e90f871700f02dd1fa5012cb4498a2d4'!

Instead, detect that the origin is unknown and skip it anyway, like:
  skipping already grafted revision 8 (2 also has unknown origin 5c095ad7e90f871700f02dd1fa5012cb4498a2d4)
2014-08-27 15:30:09 +02:00
Sean Farley
a5ff857520 log: use correct phase info for parent field (issue4347)
Previously, there was a copy / paste error with using the current changeset's
phase information. We now look up the parent context explicitly.

The line was too long so it is stored into a variable first.
2014-08-23 17:03:08 -05:00
Thomas De Schampheleire
1c23ea4c79 help: add pad function to template help
Commit 89145c35f76e introduced a pad function for use in templates, but did
not add the corresponding documentation to 'hg help templating'.
2014-08-25 15:10:09 +02:00
FUJIWARA Katsunori
baa869750d templater: enable alias predicates to be used in "revset()" function
Before this patch, predicates defined in "[revsetalias]" can't be used
in the query specified to template function "revset()", because:

  - "revset()" uses "localrepository.revs()" to get query result, but
  - "localrepository.revs()" passes "None" as "ui" to "revset.match()", then
  - "revset.match()" can't recognize any alias predicates

To enable alias predicates to be used in "revset()" function, this
patch invokes "revset.match()" directly with "repo.ui".

This patch doesn't make "localrepository.revs()" pass "self.ui" to
"revset.match()", because this may be intentional implementation to
prevent alias predicates from shadowing built-in ones and breaking
functions internally using "localrepository.revs()".

Even if it isn't intentional one, the check for shadowing should be
implemented (maybe on default branch) before fixing it for safety.
2014-08-23 21:23:02 +09:00
Mads Kiilerich
0df22182cc convert: introduce --full for converting all files
Convert will normally only process files that were changed in a source
revision, apply the filemap, and record it has a change in the target
repository. (If it ends up not really changing anything, nothing changes.)

That means that _if_ the filemap is changed before continuing an incremental
convert, the change will only kick in when the files it affects are modified in
a source revision and thus processed.

With --full, convert will make a full conversion every time and process
all files in the source repo and remove target repo files that shouldn't be
there. Filemap changes will thus kick in on the first converted revision, no
matter what is changed.

This flag should in most cases not make any difference but will make convert
significantly slower.

Other names has been considered for this feature, such as "resync", "sync",
"checkunmodified", "all" or "allfiles", but I found that they were less obvious
and required more explanation than "full" and were harder to describe
consistently.
2014-08-26 22:03:32 +02:00
Mads Kiilerich
49ef1c4045 convert: refactor hg getchanges and caching 2014-08-26 22:03:32 +02:00
Mads Kiilerich
89154d8277 convert: refactor subversion getchanges and caching 2014-08-26 22:03:32 +02:00