Commit Graph

2849 Commits

Author SHA1 Message Date
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
Pierre-Yves David
4cfd7f9399 update: wlock the repo for the whole 'hg update' command
The update command is touching the repository and should lock it for
the length of its operations. Equally importantly, it should lock the
repository when it is writing bookmarks. It wasn't doing so until now,
leaving doors open for all kinds of drunk beaver parties.

This results in some minor tests changes, and the fixing of a couple
of bugs from race conditions.

Code does not receive any changes beside extra indentation.
2015-08-11 16:26:12 -07:00
Gregory Szorc
de2670fcc8 commands.push: use "pushloc" path attribute
Path instances now have a "pushloc" attribute that exposes the path
to be used for pushing. The "default-push" path is automatically
captured in the "pushloc" attribute of the "default" path.

Drop references to "default-push" and use the "pushloc" attribute
for looking up where to push to.
2015-08-08 00:12:41 -07:00
Gregory Szorc
83c1331bbb commands.push: use paths API
ui.path instances now collect most of the data used by commands.push().
Move away from ui.expandpath() and call ui.paths.getpath() to get a
path instance.

Some "pushing to" output was dropped as one test demonstrates. I believe
the dropped message was redundant with the error message and the change
to be acceptable.
2015-08-07 22:39:47 -07:00
Matt Mackall
155b19726c merge with stable 2015-08-13 19:37:47 -05:00
Durham Goode
099689de6b dirstate: add --minimal flag to debugrebuilddirstate
On repositories with hundreds of thousands of files, hg
debugrebuilddirstate causes every dirstate entry to be marked lookup,
and the next hg status can take many minutes.

This adds a --minimal flag that allows us to only rebuild the parts of the
dirstate that are inconsistent. This follows two rules:

1) If a file is in the dirstate but not in the parent manifest, and it is not
marked 'add', it is busted and we should drop it.

2) If a file is not in the dirstate at all, but it is in the parent
manifest, it should be added to the dirstate and we need to mark it as
lookup.

This allows us to fix repositories where the dirstate doesn't match
the manifest much more quickly.

Tested by artificially adding bad dirstate entries (via code) for both cases
above.
2015-08-12 19:44:21 -07:00
Gregory Szorc
788d5ef232 commands: break import cycle
This was the easiest link in the chain to break as there was only
one use of commandserver in commands.py. Other files had multiple
users.
2015-08-08 14:30:39 -07:00
Yuya Nishihara
b26ded0d8d tag: do not pass binary nullid to scmutil.revsingle()
Future patches will remove the old-style parser that happen to accept a
binary nodeid. A binary nodeid shouldn't be passed to scmutil.revrange()
because it is ambiguous. For example, bin('20' * 19 + '30') is valid binary
nodeid, but it can also be parsed as a revset expression, '0'.
2015-03-15 14:45:26 +09:00
Yuya Nishihara
137f249748 debugrevspec: pass lookup function to visualize fallback mechanism
The next patch will move the exceptional parsing of old-style ranges
to revset.tokenize(). This patch will allow us to see the result tree.

Note that the parsing result of '-a-b-c-' is incorrect at this changeset.
It will be fixed soon.
2015-07-18 23:02:18 +09:00
FUJIWARA Katsunori
b3a7702a57 record: omit meaningless 'commit' suggestion at 'hg commit -i'
Before this patch, 'hg commit -i' under non-interactive mode suggests
'use commit instead', and it obviously meaningless.

This patch makes 'record.record'()' examine 'ui.interactive()' and
show suggestion by itself before calling 'commands.commit()'.

This allows 'commands.commit()' to specify 'None' for 'cmdsuggest'
argument of 'cmdutil.dorecord()' to omit meaningless 'commit'
suggestion at 'hg commit -i'.
2015-07-15 04:45:58 +09:00
Matt Mackall
9573c557ad bookmarks: clear active bookmark on non-linear update 2015-07-14 18:50:20 -05:00
Yuya Nishihara
a88883e3c5 changeset_printer: change flush() to accept ctx instead of rev
Because flush() is the function to write data buffered by show(ctx),
flush(ctx) is more consistent than flush(rev). This makes sure that
buffered header and hunk are always keyed by ctx.rev().

This patch will allow us to give an integer to the wdir while keeping
wctx.rev() -> None.
2015-04-12 21:52:02 +09:00
Gregory Szorc
c9f7c94c30 hg: support for auto sharing stores when cloning
Many 3rd party consumers of Mercurial have created wrappers to
essentially perform clone+share as a single operation. This is
especially popular in automated processes like continuous integration
systems. The Jenkins CI software and Mozilla's Firefox release
automation infrastructure have both implemented custom code that
effectively perform clone+share. The common use case here is that
clients want to obtain N>1 checkouts while minimizing disk space and
network requirements. Furthermore, they often don't care that a clone
is an exact mirror of a remote: they are simply looking to obtain
checkouts of specific revisions.

When multiple third parties implement a similar feature, it's a good
sign that the feature is worth adding to the core product. This patch
adds support for an easy-to-use clone+share feature.

The internal "clone" function now accepts options to control auto
sharing during clone. When the auto share mode is active, a store will
be created/updated under the base directory specified and a new
repository pointing to the shared store will be created at the path
specified by the user.

The share extension has grown the ability to pass these options into
the clone command/function.

No command line options for this feature are added because we don't
feel the feature will be popular enough to warrant their existence.

There are two modes for auto share mode. In the default mode, the shared
repo is derived from the first changeset (rev 0) in the remote
repository. This enables related repositories existing at different URLs
to automatically use the same storage. In environments that operate
several repositories (separate repo for branch/head/bookmark or separate
repo per user), this has the potential to drastically reduce storage
and network requirements. In the other mode, the name is derived from the
remote's path/URL.
2015-07-08 16:19:09 -07:00
Pierre-Yves David
5e9a275007 bookmarks: change bookmark within a transaction
For some time, bookmark can and should be moved in the transaction. This
changeset migrates the 'hg bookmarks' commands to use a transaction.

Tests regarding rollback and transaction hooks are impacted for
obvious reasons. Some have to be slightly updated to keep testing the
same things. Some can just be dropped because they do not make sense
anymore.
2014-09-28 00:49:36 -07:00
Matt Mackall
b775e2dd90 merge with stable 2015-07-07 19:07:04 -05:00
Nathan Goldbaum
d25ad15a41 forget: add a note to the command help about remove 2015-07-06 16:22:57 -07:00
Pierre-Yves David
9e0c5a2a51 pull: avoid race condition with 'hg pull --rev name --update' (issue4706)
The previous scheme was:

1) lookup node for all pulled revision,
2) pull said node
3) lookup the node of the checkout target
4) update the repository there.

If the remote repo changes between (1) and (3), the resolved name will be
different and (3) crash. There is actually no need for a remote lookup during
(3), we could just set the value in (1). This prevent the race condition and
save a possible network roundtrip.
2015-06-03 14:29:11 -07:00
Yuya Nishihara
044f46397d commands: hide formatter option as EXPERIMENTAL, not as DEPRECATED
84c1db844f78 introduced the EXPERIMENTAL marker, so we should use it
consistently.
2015-04-30 22:40:18 +09:00
Matt Harbison
f2ad8f39e0 debuginstall: expand the editor path before searching for it (issue4380)
The editor launches without expanding the path with commits because the shell
does that for us.

If the path isn't an executable, the expanded path is displayed, which is
probably more useful than the unexpanded path.  For example, in cmd.exe, '~'
expands to C:\Users\$user.  But it expands to C:/mingw/msys/1.0/home/$user in
MinGW.
2015-04-30 23:02:52 -04:00
Laurent Charignon
b2ede5bdf6 revert: make the interactive mode experimental
While fixing issue4304: "record: allow editing new files" we introduced
changes in record/crecord. These changes need to be matched with changes in any
command using record. Revert is one of these commands and the changes have
not been made for this release. Therefore, revert -i should be an experimental
feature for this release.
2015-04-27 15:37:57 -07:00
Martin von Zweigbergk
f1e241ceae revert: accept just -I/-X without paths or -a/-i (issue4592)
'hg revert -I foo' currently fails with

  abort: no files or directories specified
  (use --all to revert all files, or 'hg update 1' to update)

It doesn't seem intentional that -I/-X without other paths or
--all/--interactive should fail, and it doesn't seem that harmful to
allow it either, so let's just do that.
2015-04-22 16:38:36 -07:00
Pierre-Yves David
a7c2f06189 debuglock: access the lock file using the proper vfs
Before this fix, 'wlock' was always reported as "free" because '.hg/store/wlock'
have never been a thing.
2015-04-20 16:05:32 +02:00