Commit Graph

3122 Commits

Author SHA1 Message Date
Yuya Nishihara
e2dfdaa910 debugrevspec: show expanded/concatenated states before printing trees
The debugrevspec command prints at most 4 parsed trees. It wasn't easy to
tell which tree belongs to which state.
2016-03-26 19:01:12 +09:00
Kostia Balytskyi
35f0e5c575 debugobsolete: add an option to show marker index
A bigger picture is the ability to be delete an arbitrary marker form the
repo's obsstore. This is a useful debug ability and it needs a way to indentify
the marker one wants to delete. Having a marker's index provides such an
ability.
2016-03-23 10:50:24 -07:00
Yuya Nishihara
7d5bdcf68d templater: add debugtemplate command
This is useful for debugging template parsing. Several tests are ported to
this command.
2016-02-14 01:06:12 +09:00
FUJIWARA Katsunori
e0a700aa24 commands: add postincoming docstring for explanation of arguments 2016-03-12 04:35:42 +09:00
FUJIWARA Katsunori
323523ef12 commands: centralize code to update with extra care for non-file components
This patch centralizes similar code paths to update the working
directory with extra care for non-file components (e.g. bookmark) into
newly added function updatetotally().

'if True' at the beginning of updatetotally() is redundant at this
patch, but useful to reduce amount of changes in subsequent patch.
2016-03-12 04:35:42 +09:00
FUJIWARA Katsunori
1430646025 update: omit redundant activating message for already active bookmark
This patch also adds "hg bookmarks" invocation into tests, where
redundant message is omitted but bookmark activity isn't clear from
context.
2016-03-12 04:35:42 +09:00
Jun Wu
704e54e1c7 serve: accept multiple values for --daemon-postexec
The next patch will add another postexec command: chdir, which can be used
together with unlink. This patch changes the option type of --daemon-postexec
from string to list to accept multiple commands. The error message of invalid
--daemon-postexec value is also changed to include the actual invalid value.
2016-03-09 02:07:40 +00:00
timeless
c4098a81cc debuginstall: convert to formatter
commit editor now reports its editor
default template is now reported

a broken vi editor (vi not in path) is still not considered a problem (!!)
2016-03-09 18:58:51 +00:00
timeless
1fcd9b7563 resolve: when pats do not match, hint about path:
Suggest a command that would probably work.
2015-12-24 04:31:34 +00:00
FUJIWARA Katsunori
f9e776bc8b dispatch: make loading extra information from extension extensible
This patch makes loading extra information from extension module at
dispatching extensible. Factoring 'loadcmdtable()' into commands.py is
a part of generalization of loading extra information.

This extensibility assumes registration of new function like below,
for example:

  - revset predicate
  - fileset predicate
  - template keyword
  - template filter
  - template function
  - internal merge tool
  - web command

This patch requires not loader function itself but container module
and the name of it, because listing loader function directly up
implies actual loading module of it, even if it isn't used at runtime
(for example, extensions don't always define revset predicate)
2016-03-08 23:04:53 +09:00
timeless
ec454c0097 commit: block amend while histedit is in progress (issue4800) 2016-02-14 07:35:50 +00:00
Matt Mackall
2f932b7682 merge with stable 2016-03-02 16:44:56 -06:00
FUJIWARA Katsunori
4a0bc54a73 doc: remove deprecated option from synopsis of command help
Before this patch, deprecated options below are used in synopsis of
command help, even though they aren't listed up as available options
by default. These might confuse readers.

  - -n (no-op, now) of strip
  - -a/--active of branches
  - -f/--force of merge
2016-03-01 03:28:46 +09:00
Siddharth Agarwal
08f24f1f67 graft: don't preserve most extra fields
This backs out changeset 9aa13e9feec8.

See the previous patch for why we're doing this.
2016-02-03 09:06:52 -08:00
Siddharth Agarwal
c8ebb66630 amend: don't preserve most extra fields
This backs out changeset fd794e885a9e9.

There are some extra fields that absolutely should not be preserved, like the
convert_revision field introduced by the convert and hgsubversion extensions.
The problem with extensions blacklisting certain extra fields is that they
might not be enabled at the time the amend is performed.

In the long run we probably want separately marked transferable and
non-transferable extra fields, but for now restore the old Mercurial 3.6
behavior.
2016-02-03 08:59:46 -08:00
Yuya Nishihara
c24eb61d0c backout: disable --merge with --no-commit (issue4874)
Because "backout --merge" have to make a commit before merging, it doesn't
work with --no-commit. We could change "backout --merge" to make a merge
commit automatically, and --no-commit to bypass a merge commit, but that
change would be undesirable because:

 a) it's hard to fix bad merges in general
 b) two commits would be created with the same --message

So, this patch simply disables "--merge --no-commit".
2016-01-30 18:00:11 +09:00
Nathan Goldbaum
2d19c5b8f4 bookmarks: improve documentation for --rev option 2016-01-27 16:16:38 -06:00
FUJIWARA Katsunori
07d633b500 commands: advance current active bookmark at pull --update correctly
Before this patch, "hg pull --update" doesn't advance current active
bookmark correctly, if pulling itself doesn't advance it, even though
"hg pull" + "hg update" does so.

Existing test for "pull --update works the same as pull && update" in
test-bookmarks.t doesn't examine this case, because pulling itself
advance current active bookmark before actual updating the working
directory in that test case.

To advance current active bookmark at "hg pull --update" correctly,
this patch examines 'movemarkfrom' instead of 'not checkout'.

Even if 'not checkout' at the invocation of postincoming(), 'checkout'
is overwritten by "the revision to update to" value returned by
destutil.destupdate() in such case. Therefore, 'not checkout'
condition means "update destination is revision #0", and isn't
suitable for examining whether active bookmark should be advanced.

Even though examination around "movemarkfrom == repo['.'].node()" may
seem a little redundant just for this issue, this makes it easier to
compare (and unify in the future, maybe) with the same logic to update
bookmark at "hg update" below.

        if not ret and movemarkfrom:
            if movemarkfrom == repo['.'].node():
                pass # no-op update
            elif bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
                ui.status(_("updating bookmark %s\n") % repo._activebookmark)
            else:
                # this can happen with a non-linear update
                ui.status(_("(leaving bookmark %s)\n") %
                          repo._activebookmark)
                bookmarks.deactivate(repo)
2016-01-28 20:10:06 +09:00
Matt Harbison
87e191502b commit: factor the post commit status check into a cmdutil method
The largefiles extension needs to set lfstatus for this status call.  Otherwise,
if a missing largefile is explicitly named, a confusing message is issued that
says the largefile wasn't found, followed by another that says nothing changed.
2016-01-23 23:24:30 -05:00
Gregory Szorc
14f5317aad commands: use absolute_import
All mercurial.* modules are now using absolute_import \o/
2015-12-21 22:26:31 -08:00
Yuya Nishihara
e4227925aa dispatch: store norepo/optionalrepo/inferrepo attributes in function (API)
This can eliminate import cycles and ugly push/pop of global variables at
_checkshellalias(). Attributes of aliascmd are directly accessible.

Because norepo/optionalrepo/inferrepo lists aren't populated, extensions
examining them no longer work. That's why this patch removes these lists
to signal the API incompatibility.

This breaks 3rd-party extensions that are yet to be ported to @command
decorator.
2016-01-01 22:16:25 +09:00
FUJIWARA Katsunori
682ffa7011 pull: deactivate a bookmark not matching with the destination of the update
Before this patch, "hg pull -u" with a target doesn't deactivate a current
active bookmark, which doesn't match with the explicit destination of the
update, even though bare "hg update" does so.

A "target" can be provided through:
  - option --rev ANOTHER
  - option --branch ANOTHER
  - source URL#ANOTHER
2016-02-26 20:22:05 +09:00
FUJIWARA Katsunori
f00c81db76 pull: activate a bookmark matching with the destination of the update (BC)
Before this patch, "hg pull -u" with a target doesn't activate a bookmark, which
matches with the explicit destination of the update, even though bare "hg
update" does so.

A "target" can be provided through:
  - option --rev BOOKMARK
  - source URL#BOOKMARK
2016-02-26 20:22:05 +09:00
timeless
7c2842e773 copyright: update to 2016 2016-01-21 21:15:52 +00:00
Ruslan Sayfutdinov
f9fd350906 backout: fix --no-commit option (issue5054) 2016-01-20 08:16:58 -08:00
Durham Goode
4ce51c3927 bundle: exit early when there are no commits to bundle
Previously, if you passed a revset that resolved to no nodes, it would get
interpreted by the changegroup discovery logic as 'bundle all my heads', which
is not what the user asked.

Let's exit early when we notice this case.

It could be argued that the changeset discovery logic should be smarter and only
assume 'all heads' if the incoming heads parameter is None, but that's a much
riskier change.
2016-01-19 13:43:50 -08:00
Mads Kiilerich
9f1efa7c96 graft: warn when -r is combined with revisions as positional arguments
The behaviour in this case is undefined. Instead of silently doing something
"random" and surprising, at least issue a warning.

(This should perhaps be considered a "deprecation" and turned into an error in
a future release.)
2016-01-17 19:33:02 +01:00
Mads Kiilerich
200157f1b5 graft: clarify in help that -r is not just optional
Positional parameters are also treated as revisions, but the order of revisions
matters and it will often be wrong if the user understands it as `-r` taking
multiple revisions as `-r REV1 REV2`.

(Alternatively, `-r` could be turned into a no-op flag as the documentation
suggests. That would however be less "semantic markup" and I agree with the
implementation in 40cbb25097c8 but not the documentation.)
2016-01-17 19:33:02 +01:00
Ruslan Sayfutdinov
3f980f0f17 backout: commit changeset by default (BC)
Add --no-commit flag to prevent it. This should make the hg user
experience a little better. Some discussion can be found here:
http://markmail.org/message/7jm7ro2ias6hxywy
2016-01-15 13:46:33 -08:00
Gregory Szorc
05359af187 commands: document clone bundles hooks and rollback behavior
The added content is inside a verbose container.

I figure it makes sense to explicitly document behavior, including
with the caveat it may change later. People can't say they weren't
warned!
2016-01-14 21:21:59 -08:00
Gregory Szorc
3a890f3e32 commands: teach debugbundle to print bundle specification
This seems like the most logical place to put this functionality.

Test coverage over existing known bundle specs has been added.
2016-01-14 22:57:55 -08:00
Gregory Szorc
274b1c944c commands: use context manager for opened bundle file 2016-01-14 21:27:53 -08:00
Bryan O'Sullivan
f646cafad4 with: use context manager in manifest 2016-01-15 13:14:49 -08:00
Bryan O'Sullivan
2caa7d79a8 with: use context manager in rename 2016-01-15 13:14:49 -08:00
Bryan O'Sullivan
f32abc8e35 with: use context manager in resolve 2016-01-15 13:14:49 -08:00
Bryan O'Sullivan
fa514efcb7 with: use context manager in unbundle 2016-01-15 13:14:49 -08:00
Bryan O'Sullivan
44384e880c with: use context manager in update 2016-01-15 13:14:49 -08:00
Bryan O'Sullivan
a7b2ba3a96 with: use context manager for wlock in graft 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
f5b1df9677 with: use context manager for wlock in debugsetparents 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
cb352193d4 with: use context manager for wlock in debugrebuilddirstate 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
acc88c0183 with: use context manager for wlock in copy 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
9564744e01 with: use context manager for wlock in branch 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
6ed7a94e8f commands: use a context manager for file I/O in debugdiscovery 2016-01-12 14:28:43 -08:00
timeless
308696c2c1 help: add --system flag to get help for various platform(s) 2016-01-10 08:03:58 +00:00
Martin von Zweigbergk
e5bd6473b3 changegroup: hide packermap behind methods
This is to prepare for hiding changegroup3 behind a config option.
2016-01-12 21:01:06 -08:00
Yuya Nishihara
317fa85948 paths: port to generic templater
Embedded passwords are masked only in plain output because we'll want raw
values in machine-readable format such as JSON. For custom template, we can
add a filter to mask passwords (e.g. "{url|hidepassword}").

path.rawloc field is called as "url" than "path" because we have "pushurl"
sub-option. Also, "name" and "url" are not allowed as sub-options as they
conflict with the field names.
2015-12-13 22:09:57 +09:00
Yuya Nishihara
5c49dab973 paths: merge conditions that select visibility of fields
Truth table (extracted from the original implementation):

  search quiet  name path subopt
  ------ -----  ---- ---- ------
  f      f      T    T    T
  f      T      T    f    f
  T      f      f    T    f
  T      T      f    f    f
2015-12-13 23:01:19 +09:00
Yuya Nishihara
7e97000e2d paths: use single loop for both search=None|pattern cases
This will help porting to the formatter API. This patch adds test for empty
pathitems to make sure "hg paths" never say "not found!".
2015-12-13 22:02:32 +09:00
Yuya Nishihara
a4711dcd63 paths: reorder else clause for readability of subsequent patches
This prepares for porting to the formatter API. Future patches will use a
single loop to handle both search=None|pattern cases because formatter output
should be the same. "pathitems" will be switched instead.
2015-12-13 21:55:57 +09:00
Yuya Nishihara
14e64b757a paths: drop ui.status label from output of "hg paths name"
We just need to not print path if --quiet. ui.status label is unwanted.
2015-12-13 21:54:00 +09:00
Matt Harbison
f079641319 summary: print unstable, bumped and divergent as unconditionally plural
This aligns with the unconditional plural output for the update line contents,
as well as the incoming/outgoing bookmarks line.  It also matches the message
in evolve's summary hook as of 4f83b2d2d20d.  (Though I thought this was removed
recently?)
2016-01-11 21:00:29 -05:00
Bryan O'Sullivan
9adb9fb244 commands: get rid of empty try/finally block from _dograft
This diff is purely an indentation change to clean up a block that
was kept in place to make 9e5d088542ab easier to read.
2016-01-11 09:49:48 -08:00
Bryan O'Sullivan
eff9c7d54a commands: get rid of empty try/finally block from _dobackout
This diff is purely an indentation change to clean up a block that
was kept in place to make 4645e52058b4 easier to read.
2016-01-11 09:49:47 -08:00
Bryan O'Sullivan
459e92e905 commands: get rid of empty try/finally block from import_
This diff is purely an indentation change to clean up a block that
was kept in place to make 760a55541ca3 easier to read.
2016-01-11 09:49:39 -08:00
Laurent Charignon
95ad56f2f0 debugignore: find out why a file is being ignored (issue4856)
This patch adds a capability to hg debugignore: to explain why a given file is
being ignores by mercurial. We display the filename, line and linenumber of the
rule that lead us to ignore the file.
2016-01-05 07:47:08 -08:00
Laurent Charignon
f5214fc7b3 debugignore: find out if a file is being ignored
Before this patch debugignore was just displaying the list of ignore patterns.
This patch makes it support a list of filename as argument and tells the user
if those given files are ignored or not.
2016-01-05 07:47:08 -08:00
timeless
4e03c1691c clone: move bookmarks and checkouts before pull help
The bookmark/checkout help actually split the pull help.
The subsequent verbose container is talking about pull too.
This change puts the pull help back together again.
2016-01-05 19:59:21 +00:00
timeless
58c3371f4c log: help provide sort by date example 2016-01-06 07:55:57 +00:00
timeless
c27e8dde2d log: mention ordering
a user complained that hg help log did not hint how to sort
the output by date
2016-01-06 19:29:45 -05:00
Siddharth Agarwal
0efe3372e4 origpath: move from cmdutil to scmutil
This is a lower-level function so it doesn't need to be in cmdutil, and putting
it here avoids a bunch of potential import cycle issues.
2016-01-02 03:02:57 -08:00
timeless
ebb1d48658 cleanup: remove superfluous space after space after equals (python) 2015-12-31 08:16:59 +00:00
timeless
ea4a7888cc resolve: suggest the next action
Expose afterresolvedstates to allow graft and similar to
suggest a message when resolving results in no unresolved
files.

If there isn't a matching state in afterresolvedstates,
then if verbose, suggest commiting.
2015-12-24 19:25:44 +00:00
timeless
04b3592b35 parents: correct help revset replacements
Implementing `hg parents -r REV FILE` correctly is hard.

The output can be 0, 1, or 2 revs.

First, you can't use parents(), because it sorts its output...

Consider:
echo $a
echo par@rev: `hg log -r "parents($a)" -q`
echo p12@rev: `hg log -r "p1($a)+p2($a)" -q`
echo parents: `hg parents -q -r $a`

(Merge 1 into 0)
3
par@rev: 0:d9612eafe8ec 1:070fe4290d06
p12@rev: 0:d9612eafe8ec 1:070fe4290d06
parents: 0:d9612eafe8ec 1:070fe4290d06

(Merge 4 into 5)
6
par@rev: 4:db73392995c3 5:c26e7dd67644
p12@rev: 5:c26e7dd67644 4:db73392995c3
parents: 5:c26e7dd67644 4:db73392995c3

(Merge 7 into 8)
9
par@rev: 7:d84f47462f70 8:9597bcab36e0
p12@rev: 8:9597bcab36e0 7:d84f47462f70
parents: 8:9597bcab36e0 7:d84f47462f70

You also can't use parents or/p1/p2 alone with a set, as in:
-r "parents(::REV and file(FILE))"
-r "parents(::REV - REV and file(FILE))"
... because each will return all parents for each candidate revision,
and the :: gives too many candidates.

Thus, we need a max and a p1/p2.

Also, anything of this form:
max(::REV - REV and file(FILE))
... is wrong, because max will return only one revision, and for
a proper parents, you need to return two occasionally.

Lastly, it doesn't help that `hg parents -r REV FILE` is buggy
due to a quirk in filelogs.

Here's a repository to consider when evaluating whether your
revset is correct:

$ hg log -G --template '{rev} {files}\n';
@  10 a
|
o    9 a b
|\
| o  8 a
| |
o |  7 a
| |
+---o  6 b
| |/
| o  5 b
| |
o |  4 b
| |
+---o  3
| |/
+---o  2
| |/
| o  1 b
|
o  0 a

revs 4 and 5 create a conflict.
The conflict is resolved in the same way by both 6 and 9.

You would hope that parents around 9/10 would point to 9,
but `hg parents` will point to 6 due to the aforementioned bug.

Here's the winning solution test script and its output.

echo $a;
echo rp12-max: `hg log -r "max(::p1($a) and file(b)) + max(::p2($a) and file(b))" -q` 2> /dev/null;
echo expected: `hg parents -q -r $a b` 2> /dev/null;

Note that for 10, the output differs, but again, this is because
of the aforementioned bug. The rp12-max output is "correct",
whereas "expected" is just an unfortunate bug. The abort output
is due to something else. I'm not sure why someone thought it
was important to abort to stdio instead of stderr, but that's
really not my problem here.

10
rp12-max: 9:184ebefc2fce
expected: 6:dd558142b03f
9
rp12-max: 5:c26e7dd67644 4:db73392995c3
expected: 5:c26e7dd67644 4:db73392995c3
8
rp12-max: 5:c26e7dd67644
expected: 5:c26e7dd67644
7
rp12-max: 4:db73392995c3
expected: 4:db73392995c3
6
rp12-max: 5:c26e7dd67644 4:db73392995c3
expected: 5:c26e7dd67644 4:db73392995c3
5
rp12-max: 1:070fe4290d06
expected: 1:070fe4290d06
4
rp12-max:
abort: 'b' not found in manifest!
expected:
3
rp12-max: 1:070fe4290d06
expected: 1:070fe4290d06
2
rp12-max: 1:070fe4290d06
expected: 1:070fe4290d06
1
rp12-max:
abort: 'b' not found in manifest!
expected:
0
rp12-max:
abort: 'b' not found in manifest!
expected:
2015-12-23 19:07:34 +00:00
Yuya Nishihara
2b215bf881 push: specify default-push and default as fallback paths
The next patch will remove the "default-push" hack from ui.paths so that
ui.paths["default"].pushurl can be different from "default-push".
2015-12-26 16:12:28 +09:00
timeless
08caed46f0 annotate: mention that -n is suppressed in help 2015-12-17 14:56:14 +00:00
timeless
c5a20df087 commands: split notes into note containers 2015-12-22 06:03:00 +00:00
timeless
c754b0afd2 remove: quote --force in never deletes note
Split Note into a note container
2015-12-22 06:02:01 +00:00
timeless
22a7897143 import: reword no hunks partial note
Split Note into a note container
2015-12-22 06:03:10 +00:00
timeless
fd5cc0f542 merge: reword help to use See help resolve 2015-12-22 05:46:23 +00:00
timeless
a433b637d1 commands: the first word of each note should be capital or hg 2015-12-22 02:24:16 +00:00
timeless
777dbfe303 commands: consistently indent notes 3 spaces
most notes have 3 spaces for indentation, these had 2...
2015-12-18 06:33:48 +00:00
Gregory Szorc
d83e377daa commands: use revlog._deltachain in debugdeltachain
We have a nice API now. Use it.

This does mean we introduce an extra index lookup for each revision.
Considering this is a debug command, the overhead should be acceptable.
We could add the chain size to revlog._deltachain(). However, that
feels like avoidable overhead.
2015-12-20 19:02:02 -08:00
timeless
78ff92a147 diff: clarify comparison as first parent 2015-12-18 18:52:25 +00:00
timeless
8634803214 branch: reword help text
We're not necessarily talking about *the* active branch,
just any old branch.
2015-12-17 14:57:20 +00:00
timeless
c8d8d5d5ad archive: adjust help text 2015-12-17 14:56:32 +00:00
timeless
b6b262b427 annotate: add missing period to help 2015-12-17 14:54:47 +00:00
timeless
81c1e01972 addremove: make help match add 2015-12-17 14:54:20 +00:00
timeless
86a42ddbf7 add: mention .hgignore in help 2015-12-17 14:53:40 +00:00
timeless
ef7cfdfced bundle: warn for --base with --all 2015-12-17 15:05:25 +00:00
timeless
3db2ef2e04 bundle: fix error for --all with destination
Before it complained about --base
2015-12-17 15:03:45 +00:00
timeless
82d910c7aa bundle: fix grammar in help text 2015-12-17 14:59:11 +00:00
timeless
9c4b396c3c bundle: clarify help text
The file might not be compressed; the interactions between
-a, --base, and a named or default repository weren't clear.
2015-12-17 14:58:52 +00:00
Thu Trang Pham
3d4e42b9c9 tags: mention --quiet switch in help (issue4920) 2015-12-17 15:23:36 -08:00
timeless
4eb5187268 import: reorder help text
Try to place key concepts early+together.
2015-12-15 07:57:04 +00:00
timeless
ff823e878b import: add word to help text 2015-12-15 07:56:03 +00:00
timeless
a16cbf7613 import: refactor exact flag 2015-12-15 07:54:01 +00:00
Laurent Charignon
4309e7ad61 summary: add troubles list to the output of hg summary
This patch adds troubles information to the output of hg summary.
Example line displayed in hg summary:
unstable: 1 changeset
2015-12-14 11:19:48 -08:00
Gregory Szorc
56babdcfc2 help: pass subtopic into help()
Now that we have multiple directories where help topics can live,
we need a mechanism to access them. We already use "." to
separate topic from section. So it seems logical to also use "." to
denote the sub-directory of a topic.

This patch teaches the help command to parse out the possible
sub-topic and pass it to the help system.
2015-12-13 11:04:45 -08:00
Yuya Nishihara
7b095d1256 commandserver: cut import cycle by itself
We generally make modules importable from the front-end layer, dispatch ->
commands -> x. So the import cycle to dispatch should be resolved by the
commandserver module.
2015-11-24 23:03:54 +09:00
Augie Fackler
0a19647501 merge: have merge.update use a matcher instead of partial fn
This is relatively rarely used functionality, but migrating this to a
matcher will make future work on narrow clones more feasible.
2015-12-14 18:54:03 -05:00
Matt Mackall
3bbe98aeff merge with stable 2015-12-11 17:45:19 -06:00
Yuya Nishihara
e95ba280a6 paths: include #fragment again
Since 3be994f0f015, #fragment was missing in "hg paths" output because
path.loc was changed to a parsed URL. "hg paths" should use path.rawloc to
show complete URLs.
2015-12-07 21:42:50 +09:00
timeless
0d1432229b parents: provide equivalent revsets in help 2015-12-08 20:21:08 +00:00
Siddharth Agarwal
4e11ac7ea5 resolve: restore .orig only after merge is fully complete (issue4952)
Previously, we'd restore the .orig file after the premerge is complete but
before the merge was complete. This would lead to the .orig file potentially
containing merge conflict markers in it, as a leftover from the last merge
attempt.
2015-11-13 15:56:02 -08:00
timeless
4676c472c0 commands: use Oxford comma (help clone) 2015-11-30 19:29:46 +00:00
Gregory Szorc
e2ea48dfff ui: support declaring path push urls as sub-options
Power users often want to apply per-path configuration options. For
example, they may want to declare an alternate URL for push operations
or declare a revset of revisions to push when `hg push` is used
(as opposed to attempting to push all revisions by default).

This patch establishes the use of sub-options (config options with
":" in the name) to declare additional behavior for paths.

New sub-options are declared by using the new ``@ui.pathsuboption``
decorator. This decorator serves multiple purposes:

* Declaring which sub-options are registered
* Declaring how a sub-option maps to an attribute on ``path``
  instances (this is needed to `hg paths` can render sub-options
  and values properly)
* Validation and normalization of config options to attribute
  values
* Allows extensions to declare new sub-options without monkeypatching
* Allows extensions to overwrite built-in behavior for sub-option
  handling

As convenient as the new option registration decorator is, extensions
(and even core functionality) may still need an additional hook point
to perform finalization of path instances. For example, they may wish
to validate that multiple options/attributes aren't conflicting with
each other. This hook point could be added later, if needed.

To prove this new functionality works, we implement the "pushurl"
path sub-option. This option declares the URL that `hg push` should
use by default.

We require that "pushurl" is an actual URL. This requirement might be
controversial and could be dropped if there is opposition. However,
objectors should read the complicated code in ui.path.__init__ and
commands.push for resolving non-URL values before making a judgement.

We also don't allow #fragment in the URLs. I intend to introduce a
":pushrev" (or similar) option to define a revset to control which
revisions are pushed when "-r <rev>" isn't passed into `hg push`.
This is much more powerful than #fragment and I don't think #fragment
is useful enough to continue supporting.

The [paths] section of the "config" help page has been updated
significantly. `hg paths` has been taught to display path sub-options.

The docs mention that "default-push" is now deprecated. However, there
are several references to it that need to be cleaned up. A large part
of this is converting more consumers to the new paths API. This will
happen naturally as more path sub-options are added and more and more
components need to access them.
2015-12-05 21:11:04 -08:00
Gregory Szorc
fb6cc829b7 ui: store pushloc as separate attribute
The magic @property is going to interfere with the ability to print
path sub-options. We only access it in one location and it is trivial
to in-line, so do that.
2015-12-06 11:49:02 -08:00
Gregory Szorc
d25e6f2fdc commands: add debugdeltachain command
We have debug commands for displaying overall revlog statistics
(debugrevlog) and for dumping a revlog index (debugindex). As part
of investigating various aspects of revlog behavior and performance,
I found it important to have an understanding of how revlog
delta chains behave in practice.

This patch implements a "debugdeltachain" command. For each revision
in a revlog, it dumps information about the delta chain. Which delta
chain it is part of, length of the delta chain, distance since base
revision, info about base revision, size of the delta chain, etc. The
generic formatting facility is used, which means we can templatize
output and get machine readable output like JSON.

This command has already uncovered some weird history in
mozilla-central I didn't know about. So I think it's valuable.
2015-12-05 23:37:46 -08:00
Gregory Szorc
6be2ff7286 commands.debugindexdot: use cmdutil.openrevlog()
This pattern is used for all the other debug* commands that operate
on revlogs. debugindexdot is an outlier. Make it conform.
2015-12-05 21:40:38 -08:00
Gregory Szorc
68fc062c6f commands: unify argument handling for revlog debug commands
The same 3 options are used in a few locations and I'm about to
add another. Might as well consolidate the pattern.
2015-12-05 21:47:39 -08:00
Yuya Nishihara
3e4bbbe974 commit: fix rest syntax of examples
This fixes the formatting of help/commit page and silence test-gendoc.t.
2015-12-06 17:16:37 +09:00
Matt Harbison
378739c9cd commit: adjust the quoting in the examples to be Windows friendly
We should probably avoid strong quotes around command line args in the examples,
since cmd.exe doesn't recognize them, and it will surprise a user who cargo
cults them.  I don't see a way to make a rule for this, since strong quoting is
OK inside command line args, like within revsets.
2015-12-05 22:19:48 -05:00
Augie Fackler
31fc3d117c commit: add some help examples (issue4963)
Includes documenting --date now, which resolves the above issue.
2015-12-04 15:24:05 -05:00
Yuya Nishihara
78ebbc20b2 graphlog: move creation of workingdir-parent nodes to displaygraph()
Future patches will make a node symbol templatable. Because arguments of a
templatekw function are repo and ctx, "showparents" list will have to be
built from a repo object by that function.
2015-11-14 16:45:15 +09:00
FUJIWARA Katsunori
f8fa1a1ece commands: execute checkunfinished and bailifchanged inside wlock scope
Before this patch, "hg import" executes below before acquisition of
wlock:

  - cmdutil.checkunfinished()
  - cmdutil.bailifchanged()

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

To avoid this issue, this patch executes 'cmdutil.checkunfinished()'
and 'cmdutil.bailifchanged()' inside wlock scope of "hg import".
2015-12-02 03:12:08 +09:00
FUJIWARA Katsunori
3aef0e6f75 commands: widen wlock scope of graft for consitency while processing
Before this patch, "hg graft" executes below before acquisition of
wlock.

  - cmdutil.checkunfinished()
  - cmdutil.bailifchanged()
  - repo.dirstate.parents() via 'repo["."]'
  - unlinking '.hg/graftstate'

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

This patch widens wlock scope of "hg graft" for consitency while
processing.
2015-12-02 03:12:07 +09:00
FUJIWARA Katsunori
9b4fb6e7f8 commands: make backout acquire locks before processing
Before this patch, "hg backout" executes below before acquisition of
wlock.

  - cmdutil.checkunfinished()
  - cmdutil.bailifchanged()
  - repo.dirstate.parents()

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

In addition to it, "hg backout" refers changelog for purposes below
without acquisition of store lock (slock), and it may cause
unintentional result, if store is updated parallelly.

  - show and update to the revision by 'repo.changelog.tip()'

  - examine for "created new head" by 'repo.branchheads()' and
    'cmdutil.commitstatus()'

To avoid this issue, this patch makes "hg backout" acquire wlock and
slock before processing.
2015-12-02 03:12:07 +09:00
FUJIWARA Katsunori
401c1d7800 commands: make commit acquire locks before processing (issue4368)
Before this patch, "hg commit" (process A) executes steps below:

  1. get current branch heads via 'repo.branchheads()'
     - cache 'repo.changelog'
  2. invoke 'repo.commit()'
  3. acquire wlock
     - invalidate 'repo.dirstate'
  4. access 'repo.dirstate'
     - re-read '.hg/dirstate'
     - check validity of parent revisions with 'repo.changelog'
  5. invoke 'repo.commitctx()'
  6. acquire store lock (slock)
     - invalidate 'repo.changelog'
  7. do committing
  8. release slock
  9. release wlock
 10. check new branch head (via 'cmdutil.commitstatus()')

If acquisition of wlock at (3) above waits for another "hg commit"
(process B) or so running parallelly to release wlock, process A
causes creating orphan revision, because:

  - '.hg/dirstate' refers the revision, which is newly added by
    process B, as its parent

  - but already cached 'repo.changelog' doesn't contain such revision

  - therefore, validating parents of '.hg/dirstate' at (4) above
    replaces such revision with 'nullid'

Then, process A creates "orphan" revision, of which parent is "null"
revision.

In addition to it, "created new head" may be shown at the end of
process A unintentionally, if store is updated parallelly, because
both getting branch heads (1) and checking new branch head (10) are
executed outside slock scope.

To avoid this issue, this patch makes "hg commit" acquire wlock and
slock before processing.

This patch resolves the issue between "hg commit" processes, but not
one between "hg commit" and other commands. Subsequent patches resolve
the latter.

Even after this patch, there are still corner case problems below:

  - filecache may overlook changes of '.hg/dirstate', and it causes
    similar issue (see below for detail)

    https://bz.mercurial-scm.org/show_bug.cgi?id=4368#c10

  - 3rd party extension may cause similar issue, if it directly uses
    'repo.commit()' without acquisition of wlock and slock

    This can be fixed by acquisition of slock at the beginning of
    'repo.commit()', but it seems suitable for "default" branch

    In fact, acquisition of slock itself is already introduced at
    "default" branch by ec227b188932, but acquisition is not at the
    beginning of 'repo.commit()'.

This patch also changes some tests:

  - test-fncache.t needs this tricky wrapping, to release (= forced
    failure of) wlock certainly

  - order of "hg commit" output is changed by widening scope of locks,
    because some hooks are fired after releasing wlock
2015-12-02 03:12:07 +09:00
Christian Delahousse
2a005d816a dirstate: change debugrebuilddirstate --minimal to use dirstate.rebuild
When debugrebuilddirstate --minimal is called, rebuilding the dirstate was done
outside of the appropriate rebuild function. This patch makes
debugrebuilddirstate use dirstate.rebuild.

This was done to allow our extension to become aware debugrebuilddirstate
--minimal
2015-11-30 11:23:15 -08:00
timeless
3d618fe024 graft: improve --continue abort message
before, if you ran hg graft --user ... --date ... --log ... revs,
and if it failed, it would suggest "hg graft --continue",
but if you did that, your --user / --date / --log options
were lost, because they were not persisted anywhere...
2015-12-02 06:33:52 +00:00
timeless
9742970292 summary: mention graft 2015-12-02 06:31:12 +00:00
Augie Fackler
840125d439 commands: inline definition of localrepo.parents() and drop the method (API)
localrepo.parents() has relatively few users, and most of those were
actually implicitly looking at the wctx, which is now made explicit
via repo[None].
2015-11-11 20:07:15 -05:00
Mike Edgar
8e7be9d666 commit: preserve extra when amending with commit --amend
The new extra propagation needs to be accounted for in cmdutil.amend,
when checking for a no-changes fast-path.
2015-11-28 04:11:57 -05:00
Mike Edgar
35c5515acc graft: copy extra (except branch) when copying changesets 2015-11-28 04:11:38 -05:00
Mathias De Maré
d20ed7b157 commands: add examples for 'addremove' 2015-11-25 18:10:59 +01:00
Mathias De Maré
ef88a42655 commands: add example for 'hg add' 2015-11-25 18:10:31 +01:00
Yuya Nishihara
8b17e38d89 serve: unify cmdutil.service() calls of commandserver and hgweb 2015-10-31 22:17:05 +09:00
Yuya Nishihara
c64bc024c8 hgweb: extract factory function of httpservice object
The next patch will merge the cmdutil.service() calls of both commandserver
and hgweb. Before doing it, this patch wipes out the code specific to hgweb
from commands.serve().
2015-10-31 22:15:16 +09:00
Yuya Nishihara
4fb8995ece hgweb: move httpservice object from commands module
This avoids the deep import of hgweb.server at the commands module.
2015-10-31 21:57:45 +09:00
Siddharth Agarwal
298e8f0bd3 debugmergestate: also recognize change/delete conflicts in the merge state
We're going to use this for tests in upcoming patches.
2015-11-24 18:26:21 -08:00
Siddharth Agarwal
6bdb690f9a debugmergestate: print out null nodes as 'null'
This is so much easier to read than a long string of zeroes, and we're going to
have a lot more of these nodes once change/delete conflicts are part of the
merge state.
2015-11-30 10:26:37 -08:00
Mathias De Maré
b4c9b11d12 identify: refer to log to be able to view full hashes 2015-11-27 20:23:23 +01:00
Mathias De Maré
2bc22a2b60 log: add 'hg log' example for full hashes 2015-11-27 20:23:02 +01:00
Augie Fackler
8501cbfa05 debugrevlog: cope with empty revlog files
I have no idea where it came from, but my clone of Mercurial has an
empty filelog for `contrib/hgfixes/__init__.py` - it's *valid*, just
contains no nodes. Without this change, debugrevlog crashes with a
zero division error.
2015-10-23 11:04:53 -04:00
timeless
ca55452b0c commands: fix help for debugobsolete 2015-10-20 18:46:00 -04:00
Sean Farley
68f4554f78 pull: all pass along extra opargs
Wihtout this patch, commands.pull silently drops opargs defeating the whole
purpose of the argument.
2015-10-19 15:47:40 -07:00
Sean Farley
4c9db86a8b push: all pass along opargs
Wihtout this patch, commands.push silently drops opargs defeating the whole
purpose of the argument.
2015-10-19 15:43:35 -07:00
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
Mathias De Maré
f15b803069 backout: add examples to clarify basic usage 2015-10-02 07:48:23 +02:00
Siddharth Agarwal
2071a98a25 resolve: record dirstate actions after performing resolutions
Some resolutions might lead to pending actions we need to perform in the
dirstate -- so perform them.
2015-11-15 21:27:22 -08:00
Siddharth Agarwal
5380ac35da resolve: fix incorrect merge
The merge from stable into default was semantically incomplete -- a couple of
changes in preceding code had to be rewritten here.

This code only triggers for change/delete conflicts, so we can't test it yet.
We will soon be able to do it, though.
2015-11-18 23:43:18 -08:00
Matt Mackall
a20ef0162d merge with stable 2015-11-18 20:59:17 -06:00
Siddharth Agarwal
61e8a89dd2 debugmergestate: explain why we create mergestate objects directly
We would normally use the read() constructor, but in this case it's fine
because
- we implement our own reading layer, so the extra parsing done by
   read() is unnecessary
- read() can raise an exception for unsupported merge state records,
   but here we'd like to handle that separately
- debugmergestate needs to be privy to mergestate internals anyway
2015-11-17 14:22:30 -08:00
Christian Delahousse
b71632a839 debugdirstate: convert keyword parameters to **opts
Removes the named arguments and replaces them by accessing opts. This will be
used in the next patch in the series because we'll be adding more flags to
debugdirstate
2015-11-11 13:28:00 -08:00
Siddharth Agarwal
2204a499bc commands.summary: switch to mergestate.read()
See previous patch for why we're doing this.

We do this with a bit of care -- it would be bad form for 'hg summary' to abort
completely if we encounter an unsupported merge record. Instead just warn about
that and continue with the rest of the summary.
2015-11-17 14:20:55 -08:00
Siddharth Agarwal
88c48784e2 commands.resolve: switch to mergestate.read()
See previous patches for why we're doing this.
2015-11-17 13:56:46 -08:00
Siddharth Agarwal
c7aefbc8d6 debugmergestate: print out record type for files
We're going to add a separate record type for change/delete conflicts soon. We
need to make sure they get stored with the correct record type so that older
versions of Mercurial correctly abort when they see change/delete records.
2015-11-13 23:01:36 -08:00
FUJIWARA Katsunori
1457fa3525 commands: add postincoming explicit brev argument (API)
Before this patch, postincoming() initializes 'brev' with 'checkout',
but this isn't useful to activate/deactivate bookmark after updating,
because 'checkout' is not a string actually specified at command line,
but an already node-nized byte sequence.

This patch adds postincoming() explicit 'brev' argument, and makes
'pull()' pass appropriate value.

This patch adds 'brev' argument instead of 'brev=None', because
'brev=None' isn't reasonable value if checkout is not None.
2016-02-26 20:22:05 +09:00
Jun Wu
f5397047b4 serve: rename --daemon-pipefds to --daemon-postexec (BC)
Initially we use --daemon-pipefds to pass file descriptors for synchronization.
Later, in order to support Windows, --daemon-pipefds is changed to accept a
file path to unlink instead. The name is outdated since then.

chg client is designed to use flock, which will be held before starting a
server and until the client actually connects to the server it started. The
unlink synchronization approach is not so helpful in this case.

To address the issues, this patch renames pipefds to postexec and the following
patch will allow the value of --daemon-postexec to be things like
'unlink:/path/to/file' or 'none'.
2016-02-22 16:59:08 +00:00