Commit Graph

2870 Commits

Author SHA1 Message Date
Pierre-Yves David
5c189f7c9b unbundle: use 'url' argument with applybundle
This will let the hook get access to the 'url' value.
2015-10-20 15:56:22 +02:00
Pierre-Yves David
921847dc20 unbundle: use 'source' argument with applybundle
This will let the hook get access to the 'source' value.
2015-10-20 15:53:07 +02:00
Pierre-Yves David
d58db8692b unbundle: use 'bundle2.applybundle'
This is one such place.
2015-10-20 15:47:20 +02:00
Siddharth Agarwal
700ac1613d commands.resolve: conclude merge driver if no unresolved files are left
This can happen when either 'hg resolve --all' is called or a driver-resolved
file is explicitly requested.

This is done as part of 'hg resolve --all' so that users still have a chance to
test their changes before committing them.

The exact semantics here are still to be decided. This does not impact any
non-experimental features.

Thanks to Pierre-Yves David for some advice about this behavior in particular,
and merge drivers in general.
2015-10-15 01:31:04 -07:00
Siddharth Agarwal
2dafef1c48 commands.resolve: call driverpreprocess if we haven't run it yet
We need to be careful about allowing --mark and --unmark to keep working -- we
don't want the user to be stuck in a weird state. The exact behavior here is
still to be decided, though.
2015-10-15 01:27:06 -07:00
Siddharth Agarwal
3465e76062 commands.resolve: don't allow users to mark or unmark driver-resolved files
Users will often be in the habit of running 'hg resolve --mark --all' after
resolving merge conflicts in source files. We need to make sure this doesn't
cause driver-resolved files to be marked.

'hg resolve --all' will resolve driver-resolved files, though.

The weird conditional structure is to accommodate an upcoming patch.
2015-10-15 01:15:22 -07:00
Siddharth Agarwal
1bbadeb63f resolve: only create wctx once
This allows for status and other results on the wctx to be cached between iterations.
2015-10-15 01:11:50 -07:00
Siddharth Agarwal
e78d354b3c commands.resolve: print out warning when only driver-resolved files remain
'hg resolve --all' will be the canonical way to run the 'conclude' step of the
merge driver.
2015-10-15 01:09:58 -07:00
Siddharth Agarwal
b6455eb8c6 commands.resolve: support printing out driver-resolved files
There's no user-visible way to mark files as driver-resolved, so this status
won't be visible.
2015-10-15 00:45:20 -07:00
Gregory Szorc
ddb0256917 exchange: support parameters in bundle specification strings
Sometimes a basic type string is not sufficient for representing the
contents of a bundle. Take bundle2 for example: future bundle2 files may
contain parts that today's bundle2 parser can't read. Another example is
stream clone data. These require clients to support specific
repository formats or they won't be able to read the written files. In
both scenarios, we need to describe additional metadata beyond the outer
container type. Furthermore, this metadata behaves more like an
unordered set, so an order-based declaration format (such as static
strings) is not sufficient.

We introduce support for "parameters" into the bundle specification
string. These are essentially key-value pairs that can be used to encode
additional metadata about the bundle.

Semicolons are used as the delimiter partially to increase similarity to
MIME parameter values (see RFC 2231) and because they are relatively
safe from the command line (although values will need quotes to avoid
interpretation as multiple shell commands). Alternatives considered were
spaces (a bit annoying to encode) and '&' (similar to URL query strings)
(which will do bad things in a shell if unquoted).

The parsing function now returns a dict of parsed parameters and
consumers have been updated accordingly.
2015-10-14 17:00:34 -07:00
Gregory Szorc
ae85c846e7 commands: support consuming stream clone bundles
For the same reasons that we don't produce stream clone bundles with `hg
bundle`, we don't support consuming stream clone bundles with `hg
unbundle`. We introduce a complementary debug command for applying
stream clone bundles. This command is mostly to facilitate testing.
Although it may be used to manually apply stream clone bundles until a
more formal mechanism is (possibly) adopted.
2015-10-15 13:43:18 -07:00
Gregory Szorc
e52d35ae6b commands: support creating stream clone bundles
Now that we have support for recognizing the streaming clone bundle
type, add a debug command for creating them.

I decided to create a new debug command instead of adding support to `hg
bundle` because stream clone bundles are not exactly used the same way
as normal bundle files and I don't want to commit to supporting them
through the official `hg bundle` command forever. A debug command,
however, can be changed without as much concern for backwards
compatibility.

As part of this, `hg bundle` will explicitly reject requests to produce
stream bundles.

This command will be required by server operators using stream clone
bundles with the clone bundles feature.
2015-10-17 11:40:29 -07:00
Pierre-Yves David
37fca6bc97 merge: directly get destination from destutil
There is no real value in using the revset over the function.

The revset have no remaining users and will be taken care of in a later
changesets.
2015-10-15 01:19:32 +01:00
Augie Fackler
6f5eadc443 commands: use cg?unpacker.apply() instead of changegroup.addchangegroup() 2015-10-13 17:12:12 -04:00
Pierre-Yves David
e4483e415c update: introduce a 'UpdateAbort' exception
The 'postincoming' function used by 'hg pull --update' and 'hg unbundle' is
catching 'Abort' exceptions to intercept failed update. This feel a bit too
wide to me, so I'm introducing a more precise exception to specify update
destination issues.
2015-10-05 04:26:26 -07:00
Matt Mackall
5fb7b930ae bookmarks: don't deactivate on no-op update (issue4901) 2015-10-14 18:03:17 -05:00
Siddharth Agarwal
3243c35897 debugmergestate: add support for printing out driver-resolved files 2015-09-30 21:48:53 -07:00
Siddharth Agarwal
f3298676a7 debugmergestate: add support for printing out merge driver 2015-09-30 21:47:27 -07:00
Pierre-Yves David
4d0a009765 update: also use 'destupdate' for pull and unbundle
Update can also be performed by 'hg pull --update' and 'hg unbundle'. We use the
destupdate function in these case too.
2015-10-05 21:31:32 -07:00
Pierre-Yves David
d22b16ba8c destupdate: also include bookmark related logic
For the same reason, we move the bookmark related update logic into the
'destupdate' function. This requires to extend the returns of the function to
include the bookmark that needs to move (more or less) and the bookmark to
activate at the end of the function. See function documentation for details on
this returns.
2015-09-29 01:03:26 -07:00
Gregory Szorc
c55df1f741 exchange: refactor bundle specification parsing
The old code was tailored to `hg bundle` usage and not appropriate for
use as a general API, which clone bundles will require. The code has
been rewritten to make it more generally suitable.

We introduce dedicated error types to represent invalid and unsupported
bundle specifications. The reason we need dedicated error types (rather
than error.Abort) is because clone bundles will want to catch these
exception as part of filtering entries. We don't want to swallow
error.Abort on principle.
2015-10-13 10:57:54 -07:00
Gregory Szorc
5e2a52d9ca exchange: move bundle specification parsing from cmdutil
Clone bundles require a well-defined string to specify the type of
bundle that is listed so clients can filter compatible file types. The
`hg bundle` command and cmdutil.parsebundletype() already establish the
beginnings of a bundle specification format.

As part of formalizing this format specification so it can be used by
clone bundles, we move the specification parsing bits verbatim to
exchange.py, which is a more suitable place than cmdutil.py. A
subsequent patch will refactor this code to make it more appropriate as
a general API.
2015-10-13 11:43:21 -07:00
Pierre-Yves David
1850d9f649 destupdate: include the 'check' logic
After moving logic from 'merge.update' into 'destutil.destupdate', we are now
moving logic from 'command.update' in 'destutil.destupdate'. This will make the
function actually useful in predicting (and altering) the update behavior.
2015-09-29 00:18:49 -07:00
Pierre-Yves David
1f1a2ae237 destupdate: move the check related to the "clean" logic in the function
We want this function to exactly predict the behavior for update. Moreover, we
would like to remove all high level behavior logic out of the merge module so
this is a step forward.

Now that the 'destupdate' function both compute and validate the destination, we
can directly use it at the command level, ensuring that the 'hg update' command
never call 'merge.update' without a defined destination. This is a first (but
significant) step toward having 'merge.update' always feed with a properly
validated destination and free of high level logic.
2015-10-05 03:50:47 -07:00
Siddharth Agarwal
25aa934095 resolve: perform all premerges before performing any file merges (BC)
Just like the BC to merge before it, this allows for a maximally consistent
state before providing any prompts to the user.
2015-10-11 23:58:07 -07:00
Siddharth Agarwal
8b2a429453 merge: introduce a preresolve function
The section of code that writes out the version of the file cached in the merge
state should only be run at preresolve time. This is so that if the premerge
keeps around conflict markers, those don't get overwritten before the main
merge.
2015-10-11 20:12:12 -07:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
FUJIWARA Katsunori
1a4ac4179d commands: use dirstateguard instead of begin/end-parentchange for backout
Before this patch, "hg backout" uses 'begin'/'end'-'parentchange()'
of 'dirstate' class to avoid writing incomplete dirstate changes out
at failure.

But this framework doesn't work as expected, if 'dirstate.write()' is
invoked between them. In fact, in-memory dirstate changes may be
written out at 'repo.status()' implied by 'merge.update()', even
before this patch.

To restore dirstate as expected at failure of "hg backout", this patch
uses 'dirstateguard' instead of 'begin'/'end'-'parentchange()'.
2015-10-09 03:53:47 +09:00
FUJIWARA Katsunori
7d9bf405fe commands: make "hg import" use dirstateguard only for --no-commit
Previous patch made dirstate changes in a transaction scope "all or
nothing". Therefore, 'dirstateguard' is meaningless, if its scope is
as same as one of the related transaction.

Before this patch, "hg import" uses 'dirstateguard' always, but
transaction is also started if '--no-commit' isn't specified.

To avoid redundancy, this patch makes "hg import" use dirstateguard
only if transaction isn't started (= '--no-commit' is specified).

In this patch, 'if dsguard' can be examined safely, because 'dsguard'
is initialized (with None) before outermost 'try'.
2015-10-09 03:53:47 +09:00
Pierre-Yves David
96f8937e86 unbundle: properly read head modification result from bundle2
We were reading the wrong key...
2015-10-04 21:48:19 -07:00
Pierre-Yves David
232a6cb371 bundle: use bundle2 if repository uses general delta
As bundle1 does not support generaldelta, this would mean recomputing delta at
bundle time. This is similar to what we do for strip and shelve and was tracked
as issue4865.
2015-10-01 20:31:43 -07:00
Pierre-Yves David
8f390ad0b6 bundle: extend the format of --type to support version and compression
We had some basic undocumented support for uncompressed bundle2 support. We now
have an official extensible syntax to specify both format type and compression
(eg: bzip2-v2).

In practice, this changeset introduce the 'v1' and 'v2' identifier to make it
possible to combine format and compression. The default format is still 'v1'.
We'll care about picking 'v1' or 'v2' in regard with general delta in the next
changesets.
2015-10-01 19:16:00 -07:00
Pierre-Yves David
63b3b90838 bundle: extract the parsing of the bundle type in a function
We are going to introduce significant extensions of the bundle parsing code to
support creation of bundle2 through the bundle command. As an early step, we
extract the logic in its own function.
2015-10-01 18:01:24 -07:00
Siddharth Agarwal
39cdc4468e commands: add a new debug command to print merge state
We're going to be extending the merge state very soon, and this will give us a
way to test all that.
2015-10-02 13:00:47 -07:00
Mathias De Maré
f96aba4033 revert: add reference to backout 2015-10-05 07:13:35 +02:00
Mathias De Maré
3f752b3025 backout: add reference to revert 2015-10-05 07:11:48 +02:00
Matt Mackall
5e1b4ad958 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
Pierre-Yves David
508568fbbd unbundle: test and fix for clean abort on unknown bundle2 feature
This introduce a test for the feature and fix the exception name that is
different on default.
2015-09-24 17:52:21 -07:00
Matt Mackall
f0081b033a merge with stable 2015-09-25 23:10:47 -05:00
Pierre-Yves David
9df64adaed unbundle: cleanly abort on unknown bundle2 feature
The exception wasn't caught and resulted in a traceback.
2015-09-25 13:30:49 -07:00
Jordi Gutiérrez Hermoso
cce05f8f6d phases: return zero for no-op operations (issue4751) (BC)
It is rather unhelpful to return 1 if there were no changes because
the request matches the current state of phases. So we just undo that.
2015-09-14 19:25:34 -04:00
Jordi Gutiérrez Hermoso
8a7abebe42 dispatch: don't stack trace on commands like hg .log
This used to stack trace because it raised a util.Abort which wasn't
handled in this block. We now handle it. Additionally, we error out
earlier instead of plodding on and showing the "log" entry of the
plain `hg help` output.
2015-09-25 11:16:20 -04:00
timeless@mozdev.org
776539bcbf resolve: consistently describe re-merge + unresolved 2015-09-25 03:51:46 -04:00
liscju
c4c7beba44 mercurial: add debugextensions command (issue4676)
Add debugextensions command to help users debug their extension
problems. If there are no extensions command prints nothing,
otherwise it prints names of extension modules. If quiet or
verbose option is not specified it prints(after extensions name)
last version of mercurial in which given module was tested for
non internal modules or not tested with user mercurial version.

If verbose is specified it prints following information for every
extension: extension name, import source, testedwith and buglink
information.

Extensions are printed sorted by extension name.
2015-09-10 16:53:07 +02:00
Pierre-Yves David
14615c5363 merge: move default destination computation in a revset
This is another step toward having "default" destination more clear and unified.
2015-09-17 14:03:15 -07:00
Pierre-Yves David
1b4a29623a mergecmd: simplify conditional
The previous if tested the same thing with 'if repo._activebookmark'. We make the
if/else logic clearer before a bigger refactoring.
2015-09-17 12:44:52 -07:00
Pierre-Yves David
6705b17abd bookmark: do not crash when active bookmark is forward and --date is used
The logic that decides where to update according to the active bookmark
location (when not on ".") was setting the rev to update to before we process
--date.  This lead to --date processing aborting because of duplicated
specification.

We reorder the two pieces of code and add a test for this.
2015-09-17 16:08:10 -07:00
timeless@mozdev.org
a14fb0ee13 help: fix help argument parsing and documentation
support combining -c and -e

previously -k was misdocumented:
 * the first line didn't mention it
 * the help half implied you could do help -k keyword topic

with these changes, -k just changes the search method

support -c and -e for -k searches
2015-09-10 20:22:37 -04:00
timeless@mozdev.org
b229fbbfaf bookmark: improve ambiguous documentation for rename 2015-09-04 11:30:38 -04:00
timeless@mozdev.org
7af87795c9 commands: support hg help scripting.HGPLAIN
keywords are lowercased within help/minirst...
2015-09-02 23:50:45 -04:00