Commit Graph

2766 Commits

Author SHA1 Message Date
Yuya Nishihara
f7d73883e0 formatter: add general way to switch hex/short functions
This seems a bit awkward, but it can avoid duplicates in annotate, tags,
branches and bookmarks.

I guess fm.hexfunc can eventually be removed (or redesigned) when it gets
template backend.
2014-10-03 22:20:02 +09:00
Pierre-Yves David
f030469419 commands: directly use exchange.pull
localrepo.pull is going away. See explanations in 88d9d4ec499e.
2014-10-03 11:11:12 -05:00
Martin von Zweigbergk
7cb0d5dc0f summary: remove unused code for listing ignored files
The call to repo.status() does not request ignored files to be listed,
so remove the code for printing them.
2014-10-01 12:50:18 -07:00
Pierre-Yves David
627b3886af pull: move bookmark movements inside the exchange.pull
There is no reason for bookmarks to get a special treatment. As a first step we
move the code as is in the `exchange.pull` function. Integration with the rest
of the flow will come later.

Adding bookmarks to pull means that most clone paths are now pulling bookmarks
through pull. We ensure that bookmark-update messages are properly suppressed in
that case.

In test-pull-http.t the 'requesting all changes' message disappear because we
now get the authentication error on the `listkeys`command before such message
is printed.
2014-09-26 17:44:00 -07:00
Pierre-Yves David
c7f20ea1f1 pull: use other.url() as the source of a bookmark pull
We want to move the bookmarks movement into `exchange.pull`, for this purpose we
need to stop relying on variables from `command.pull`.
2014-09-26 10:59:29 -07:00
Yuya Nishihara
deb7a2b54f branches: reduce nesting in for loop 2014-10-02 21:58:10 +09:00
Mads Kiilerich
374f35aab5 templater: introduce templatepaths for getting paths searched for templates
Avoid function with different return types depending on parameters.
2014-09-28 16:57:37 +02:00
Pierre-Yves David
fa008917c9 pull: gather all bookmark-pulling code together
Pulling bookmarks is done in two rounds. First we do a simple update, then we use
the content of the `bookmark` argument to possibly overwrite some bookmark
with their remote location.

The second step was not done right after the first one for some obscure reason.
We now perform them one after the other.
2014-09-25 17:53:27 -07:00
Pierre-Yves David
4af2b1bb81 push: perform bookmark export in the push function
This part is responsible for adding new bookmarks on the remote.  Before that,
it was done on its own in `commands.push`. The export is still not integrated
with the rest of the push process, but at least it now dwells in the right
function.
2014-09-25 02:53:29 -07:00
Pierre-Yves David
90372104e5 push: pass list of bookmark to exchange.push
Currently stored but not unused. This parameter will control bookmarks explicitly
pushed (added to the server if missing).
2014-09-25 01:49:20 -07:00
Pierre-Yves David
7d3ee75e4d push: sanitize handling of bookmark push return value
Mixing return and assignment does not make sense, let's unify this.
2014-09-25 02:53:49 -07:00
Pierre-Yves David
dbad87edcd push: use exchange.push in commands.push
To gain access to all results from the push, we need to have access to the
`pushoperation` object. We call `exchange.push` to do so.

It is impossible to just change the `localrepo.push` signature because the
change may be too subtle to be caught by external extension wrapping
`localrepo.push`.

This mean we'll have to kill `localrepo.push` because just using
`exchange.push` in `commands.py` would silently disable all wrapping around
`localrepo.push` by third-party extensions. So we'll remove it in a later
changeset to get such extensions to fail noisily.
2014-09-25 01:39:39 -07:00
Siddharth Agarwal
f1c5684fc4 files: cache repo.dirstate
For a large repo, 'hg files' goes from 2.27 seconds to 1.92.
2014-09-30 16:01:19 -07:00
Siddharth Agarwal
41071b4456 files: only check for removed, not unknown or missing
ctx.matches() doesn't return unknown files, and repo.dirstate[f] never returns
'!' for an answer.
2014-09-30 15:21:35 -07:00
Siddharth Agarwal
fd44687dc1 files: use ctx.matches instead of ctx.walk
ctx.matches() is an optimized form of ctx.walk() when we don't care about the
state of files on disk.

For a large repo, 'hg files > /dev/null' drops from 3.7 seconds to 2.3.
2014-09-30 14:39:58 -07:00
Siddharth Agarwal
19c947e0ed files: actually filter out removed files
'hg files' makes an attempt to filter out removed files, but that doesn't work
because repo.dirstate[f] returns lowercase 'r', not uppercase.
2014-09-30 15:45:48 -07:00
Matt Mackall
e5c9cc0aaf help: basic support for showing only specified topic sections
For instance, 'hg help config.files' will show only the Files section.
2014-09-30 16:40:10 -05:00
Matt Mackall
34b0d3062c help: support OS-specific help sections
Containers of the form:

  .. container:: verbose.<os>

are shown by default on the given OS (or with -v).
2014-09-30 15:51:22 -05:00
Matt Mackall
275eb5bdd1 merge with stable 2014-09-29 17:23:38 -05:00
Matt Mackall
5f07bb0a47 help: fix typo in log examples 2014-09-29 16:42:12 -05:00
Matt Mackall
e3f89597c5 commands: add debuglocks to report/clear lock state 2014-09-26 16:44:11 -05:00
Yuya Nishihara
679696a5fe tags: use full hash for formatter output as in log or annotate commands 2014-09-21 12:50:48 +09:00
Yuya Nishihara
b70e3d719f tags: change field name of formatter output to be the same as log command
Since -T option is not public yet, this won't break backward compatibility.
2014-09-21 12:46:23 +09:00
Yuya Nishihara
40faa84ff9 files: correct topic of formatter 2014-09-21 12:38:47 +09:00
Matt Mackall
2f833205d7 help: mention mode in hg log --removed help (issue4381) 2014-09-21 10:31:34 -05:00
Aaron Kushner
c8faef4c5a config: exit non zero on non-existent config option (issue4247)
When running 'hg config no_such_option', hg exited with a
zero exit code. This change now exits with a 1 if the
config option does not exist.
2014-08-19 16:57:02 -07: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
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
Pierre-Yves David
eed7417a2c debugobsolete: catch ValueError that may be raised by obsstore.create
There are already a couple of errors that obsstore.create can raise and we are
going to introduce a cycle check too.
2014-08-14 14:57:03 -07:00
Matt Mackall
f40cbba38d unbundle: fix pyflakes warning about wc 2014-08-11 13:10:00 -05:00
Matt Mackall
65d57189d4 unbundle: don't advance bookmarks (issue4322) (BC)
This behavior didn't make much sense and interacts badly with things
that use unbundle internally like shelve. Presumably, the original
rationale was that since bundles didn't contain bookmarks, this gave a
sense of keeping bookmarks up-to-date like would happen with a
corresponding pull. However, since it only updated the current active
bookmark, and bare update already did that anyway, this is pretty
slim.

Notably, the corresponding test actually works better without this
feature.
2014-08-10 23:09:23 -05:00
FUJIWARA Katsunori
97d5636e1b commands: make the warning message for "patch --partial" translatable
This patch makes the warning message for "patch --partial"
translatable: this message was introduced by a0ab8b02be69, and there is
no reason to prevent this from being translatable.
2014-08-01 02:14:24 +09:00
Alexandre Garnier
c20b1f5371 debuginstall: handle quoted path for editor (issue4316)
When using an editor path with spaces and options, you can set 'ui.editor'
to '"/path to your/editor" -opt' and it works fine but 'hg debuginstall'
is complaining about it because it simply splits the editor and
tests presence of '"/path'.
Now correctly parse 'ui.editor' string by handling quoted path.
2014-07-31 10:31:56 +01:00
FUJIWARA Katsunori
5f213b8584 doc: unify help text for "--edit" option
This patch changes help text for "--edit" option of commands below:

  - fetch
  - qnew
  - qrefresh
  - qfold
  - commit
  - tag

This unification reduces translation cost, too.

This patch chooses not "further edit commit message already specified"
(of "hg commit") but "invoke editor on commit messages" as unified
help text for "--edit" option, because the latter is much older than
the former.
2014-07-30 00:14:52 +09:00
FUJIWARA Katsunori
3c5c28c967 doc: unify help text for "--message" option
This patch changes help text for "--message" option of commands below
for unification.

  - sign (of gpg)
  - tag

This unification reduces translation cost, too.

This patch doesn't change the description for "--message" of "hg
rebase" below, because this should contain "collapse" word to explain
its purpose (only for "--collapse") clearly.

    use text as collapse commit message
2014-07-30 00:13:59 +09:00
Alexander Becher
8b1b69abc7 graft: add a reference to revsets to the help text (issue3362) 2014-07-28 10:05:17 +02:00
Pierre-Yves David
3efa776f85 resolve: add parenthesis around "no more unresolved files" message
This message may be confused with an error message. Adding parenthesis around it
will make it more recognisable as an informative message.
2014-07-26 03:32:49 +02:00
Matt Mackall
f648f507dd templates: re-add template listing support
We used to have --style nosuch to list templates, but --style is now
merged with --template/-T where random strings are acceptable
templates. So we reserve 'list' to allow listing templates.
2014-07-25 15:35:09 -05:00
Nathan Goldbaum
46f5e72040 resolve: report no argument warning using a hint
With this change resolve and revert produce consistent output when run with no
arguments:

$ hg resolve
abort: no files or directories specified
(use --all to remerge all files)

$ hg revert
abort: no files or directories specified
(use --all to revert all files)
2014-07-24 14:29:08 -07:00
Matt Mackall
97770302de version: don't traceback if no extensions to list (issue4312) 2014-07-23 11:16:22 -05:00
Wagner Bruna
00765540ed commands: fix typo in import documentation 2014-07-20 15:06:12 -03:00
Matt Mackall
b08b629028 merge with stable 2014-09-22 16:14:08 -05:00
Matt Mackall
4821ef7629 commands: deprecate the parents commands
It's replaced by 'hg summary' or hg log -r 'parents(foo)' and
doesn't need to take up space in our command list anymore.
2014-09-22 16:03:07 -05:00
Yuya Nishihara
6ecd008e93 annotate: port to generic templater enabled by hidden -T option
If the selected formatter is other than plainformatter, raw data are passed
to the formatter.  In this case, it isn't necessary (and not possible) to
calculate column widths.

Field names are substituted to be the same as "log" command.

There are a few limitations:

 - "binary file" message is not included in formatted output.
 - no data structure for multiple files. all lines are packed to single list.
2014-09-17 23:21:20 +09:00
Yuya Nishihara
2ee83c76d8 annotate: split functions to get data without applying text formatting
This prepares for porting to generic templater API, where raw data should
be passed to the formatter.

makefunc() is necessary to build closure in list comprehension.
2014-09-16 23:40:24 +09:00
Yuya Nishihara
a29f66e753 annotate: remove unused variable in calculation of column widths 2014-08-29 06:19:32 +02:00
Yuya Nishihara
698aecb7df annotate: build format string separately from annotation data
This prepares for porting to generic templater API.

Note that we cannot use '%*s' to pad white spaces because it doesn't take
into account character widths, as described in b021170a2284.
2014-08-29 05:36:52 +02:00
Yuya Nishihara
00c17ceef6 annotate: remove redundant check for empty list of annotation data
It isn't necessary because zip(*pieces) returns [] if pieces are empty,
and pieces are empty only if lines are empty.
2014-08-29 05:09:59 +02:00
Matt Mackall
402d63aa73 locate: add pointer to files command in help 2014-09-16 11:08:29 -05:00
Matt Mackall
d3c288a6a7 locate: deprecate in favor of files 2014-03-16 13:29:08 -05:00
Matt Mackall
aa7d73cbbb commands: add hidden -T option for files/manifest/status/tags
These commands have generic formatting support but no way to enable it
yet. When this feature is more fully developed, this flag will be unhidden.
2014-09-15 13:15:07 -05:00
Matt Mackall
e7503a440b files: add new command unifying locate and manifest functionality 2014-09-12 18:32:46 -05:00
Matt Mackall
5bfd322b62 ui: move samplehgrcs from config
config is generic code that doesn't know about Mercurial usage, so
this was at the wrong layer
2014-09-11 12:26:12 -05:00
Augie Fackler
dcd5b5a4f4 commit: correctly check commit mutability during commit --amend
The right way to check if a context is mutable is to call .mutable(),
not to compare .phase() with public.
2014-08-19 14:33:31 -04:00
Durham Goode
a5a69f0001 dirstate: wrap setparent calls with begin/endparentchange (issue4353)
This wraps all the locations of dirstate.setparent with the appropriate
begin/endparentchange calls. This will prevent exceptions during those calls
from causing incoherent dirstates (issue4353).
2014-09-05 11:36:20 -07:00
Sune Foldager
eb415860f8 changegroup: rename bundle-related functions and classes
Functions like getbundle and classes like unbundle10 really manipulate
changegroups and not bundles. A HG10 bundle is the same as a changegroup
plus a small header, but this is no longer the case for a HG2X bundle,
so it's better to separate the names a bit.
2014-09-02 12:11:36 +02:00
Jordi Gutiérrez Hermoso
87b5d13400 config: give more fine-tuned sample hgrcs to this command
The hgrc for user config is typically different from the hgrc at the
system-wide or repository level. This patch provides different sample
hgrcs for each level. Sometimes when copying repos around, the copy or
the original don't have a default path yet, so at least for `hg config
-l`, this ought to provide a more reasonable default and suggestions
of what typically goes there.

The actual sample configs go in the config.py file, to minimise
clutter. In order to avoid an unnecessary import, the corresponding
import for this dictionary is at the file level.
2014-08-13 17:05:48 -04:00
Mads Kiilerich
b46e11faa6 revlog: introduce isancestor method for efficiently determining node lineage
Hide the not so obvious use of commonancestorsheads.
2014-08-19 01:13:10 +02:00
Augie Fackler
f41d193435 merge with stable 2014-09-04 09:59:23 -04:00
Matt Mackall
aaadb558ea merge with crew 2014-08-30 18:44:59 +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
Matt Mackall
3ce3f9064f merge with stable 2014-08-27 18:35:34 +02:00
FUJIWARA Katsunori
ba4ea74b2b import: disallow meaningless combination of "--exact" and "--edit"
Before this patch, "hg import" allows combination of "--exact" and
"--edit", even though editing commit message breaks exact-ness.

This patch disallows meaningless combination of "--exact" and "--edit".
2014-08-23 23:03:50 +09:00
Pierre-Yves David
dfccc53b1c debugobsolete: add a --rev argument
This argument can be used to list markers relevant to a set of revisions. We
add a test for this option and the relevant computation in the same move.
2014-08-19 23:22:44 -07:00
Pierre-Yves David
e3efc0de1b obsolete: rename allmarkers to getmarkers
This function is going to gain a "nodes" argument to filter the markers to the
ones relevant to <nodes> only.
2014-08-20 18:11:23 -07:00
Pierre-Yves David
4a696375af debugobsolete: add a way to record parent information
We add a ``--record-parents`` flag to debugobsolete. This can be used to record
parent information in the marker when the precursors are known locally. This
will be useful to test the "relevant markers" computation.
2014-08-20 00:43:08 -07:00
Yuya Nishihara
0d0228f451 annotate: abort early if no file is specified
This change is intended to move the getdate function near the opmap table.
2014-08-16 17:59:26 +09:00
FUJIWARA Katsunori
df8f4a6663 commit: change "editform" to distinguish merge commits from others
"editform" argument for "getcommiteditor" is decided according to the
format below:

  COMMAND[.ROUTE]

  - COMMAND: name of command
  - ROUTE: name of route, if there are two or more routes in COMMAND

This patch uses "normal.normal" and "normal.merge" as ROUTE of
"editform" instead of "normal", to distinguish merge commits from
others in "hg commit" without "--amend" case.

This patch assumes "editform" variations for "hg commit" below:

    commit.normal.normal
    commit.normal.merge
    commit.amend.normal
    commit.amend.merge

"mergeeditform" is factored out for subsequent patches. It takes
"ctxorbool" argument, because context object can't be passed in some
cases.
2014-08-16 10:43:59 +09:00
Pierre-Yves David
7fc91f5ad7 debugobsolete: use the new date argument on obsstore.create
Now that we have this new argument, we can just use it.
2014-08-13 23:25:07 -07:00
Pierre-Yves David
3b69b7e067 obsolete: explicitly pass metadata argument using keyword argument
We are about to add more arguments to this function (date, parents, etc).
Passing metadata as a keyword argument gives us more flexibility when adding
them.
2014-08-14 01:53:07 -07:00
Matt Mackall
92e0debc2b merge with stable 2014-08-15 11:48:05 -05:00
Mads Kiilerich
b778f12731 cleanup: fix some list comprehension redefinitions of existing vars
In all the remaining cases the comprehension variable is used for the same
thing as a previous loop variable.

This will mute some pyflakes "list comprehension redefines" warnings.
2014-08-15 04:37:46 +02:00
Matt Mackall
390a8e52ce merge with stable 2014-08-12 04:50:58 -05:00
Matt Mackall
3326a5431e merge with stable 2014-08-11 11:24:05 -05:00
Pierre-Yves David
5f2b50474c phase: add a transaction argument to retractboundary
We now pass a transaction option to this phase movement function. The
object is currently not used by the function, but it will be in the
future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.
2014-08-05 23:52:21 -07:00
Pierre-Yves David
a9275323db phase: add a transaction argument to advanceboundary
We now pass a transaction option to this phase movement function. The object
is currently not used by the function, but it will be in the future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.

The retractboundary function remains to be upgraded.
2014-08-06 01:54:19 -07:00
Pierre-Yves David
f2b6946a89 phase: wrap hg phases phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:50:53 -07:00
Pierre-Yves David
7e05742434 commit: update the --secret code to use backupconfig and restoreconfig
Those dedicated methods also preserve all associated data (eg:
sources, lack of value).
2014-08-05 18:53:05 -07:00
FUJIWARA Katsunori
4de8382c53 commit: pass 'editform' argument to 'cmdutil.getcommiteditor'
This patch passes 'editform' argument according to the format below:

  COMMAND[.ROUTE]

  - ROUTE: name of route, if there are two or more routes in COMMAND

In this patch, 'normal' and 'amend' are used as ROUTE.
2014-08-02 21:46:27 +09:00
FUJIWARA Katsunori
69635163b7 tag: pass 'editform' argument to 'cmdutil.getcommiteditor'
This patch passes 'editform' argument according to the format below:

  COMMAND[.ROUTE]

  - ROUTE: name of route, if there are two or more routes in COMMAND

In this patch, 'add' and 'remove' are used as ROUTE
2014-08-02 21:46:27 +09:00
FUJIWARA Katsunori
c911495421 graft: pass 'editform' argument to 'cmdutil.getcommiteditor'
This patch passes 'editform' argument according to the format below:

  COMMAND[.ROUTE]

  - ROUTE: name of route, if there are two or more routes in COMMAND

In this patch, ROUTE is omitted.
2014-08-02 21:46:27 +09:00
FUJIWARA Katsunori
70a66564d9 backout: pass 'editform' argument to 'cmdutil.getcommiteditor'
This patch passes 'editform' argument according to the format below:

  COMMAND[.ROUTE]

  - ROUTE: name of route, if there are two or more routes in COMMAND

In this patch, ROUTE is omitted..
2014-08-02 21:46:27 +09:00
Siddharth Agarwal
670a39c654 locate: use ctx.matches instead of ctx.walk
On mozilla-central, which is around 100,000 files, best of 5:

$ hg --time locate > /dev/null
before: real 1.460 secs (user 1.140+0.000 sys 0.320+0.000)
after:  real 0.620 secs (user 0.610+0.000 sys 0.020+0.000)

$ hg --time locate README > /dev/null
before: real 0.630 secs (user 0.330+0.000 sys 0.290+0.000)
after:  real 0.120 secs (user 0.110+0.000 sys 0.020+0.000)

Larger repositories see correspondingly larger performance gains.
2014-08-01 22:16:54 -07:00
Siddharth Agarwal
3b1a83f9de graft: make --force apply across continues (issue3220)
Since --force determines the list of revisions to be grafted, it doesn't really
make sense for users to have to keep typing --force --continue as they continue
grafting.
2014-07-26 14:54:36 -07:00
Siddharth Agarwal
871030a1ab graft: allow regrafting ancestors with --force (issue3220) 2014-07-25 18:21:16 -07:00
Siddharth Agarwal
b33f19d949 commands: use util.re.compile instead of util.compilere 2014-07-15 14:52:22 -07:00
anatoly techtonik
1ed4ec4c3a version: show enabled extensions (issue4209)
This code is based by hg-versions extension (GPLv2)
by Markus Zapke-Gruendemann <info@keimlink.de>


http://mercurial.selenic.com/wiki/VersionsExtension
2014-06-10 13:44:37 +03:00
Yuya Nishihara
35e80dcc92 serve: tidy up indent level of repository not found message 2014-05-01 19:57:25 +09:00
Yuya Nishihara
2bdb976a60 serve: inline checkrepo() that is used only when --stdio is specified
Since 870f20f84f1a, --cmdserver is allowed to start without repository, so
checkrepo() function is meaningless.
2014-05-01 19:54:43 +09:00
Yuya Nishihara
5f56b9d6a6 serve: make sure to print "listening at" message immediately
If stdout is piped, status message won't be flushed until client connects to
the server and access log is written to stdout.  It seems bad idea to queue
start-up banner of server process.
2014-06-28 13:02:44 +09:00
Matt Mackall
9e74ea490c branchmap: don't use ui.warn for debug message 2014-06-23 13:50:44 -05:00
Gregory Szorc
21d0247021 commands: define inferrepo in command decorator 2014-05-04 22:22:59 -07:00
Gregory Szorc
0a46b331a5 commands: define optionalrepo in command decorator 2014-05-04 22:16:05 -07:00
Gregory Szorc
51b0c2ec81 commands: define norepo in command decorator 2014-05-04 20:57:01 -07:00
Gregory Szorc
a7f200b6b8 commands: add norepo argument to command decorator
Since decorators are evaluated at module load time and since the
@command decorator imports commands, the norepo variable (along with
its friends) may not be declared yet. These variables are now declared
before @command usage to ensure they are present.
2014-05-04 20:58:25 -07:00
Matt Mackall
c3f187f7c4 bookmarks: improve the bookmark help (issue4244) 2014-06-18 15:26:07 -05:00
Matt Mackall
140901211f resolve: fix grammar of no matching files message 2014-06-09 14:11:17 -05:00
Matt Mackall
3cb2ffc448 merge with stable 2014-06-09 13:53:23 -05:00
FUJIWARA Katsunori
2b812d91a3 backout: accept '--edit' like other commands creating new changeset
After this patch, users can invoke editor for the commit message by
'--edit' option regardless of '--message'/'--logfile'.
2014-06-01 00:08:32 +09:00
Mads Kiilerich
8a80de42d5 resolve: keep wlock while resolving
This will make resolve use correct locking and thus make it more safe.

Resolve is usually a long running command spending a lot of time waiting for
user input on hard problems. It is thus a real world scenario to start multiple
resolves at once or run other commands (such as up -C and merge) while resolve
is running. Proper locking prevents that.
2014-05-26 19:02:11 +02:00
Matt Mackall
10039fb244 bookmarks: properly align multi-byte characters 2014-05-27 15:16:52 -07:00
Pierre-Yves David
7bcfb6a103 graft: do not use .remove on a smart set (regression)
Revset calls use to return a list. Graft use to mutate that list. We cannot do
this anymore leading to a crash when grafting multiple changeset with a revset.

    File ".../mercurial/commands.py", line 3117, in graft
      revs.remove(rev)
    AttributeError: '_addset' object has no attribute 'remove'

We are late in code-freeze so we make the shortest possible fix by turning it
back to a list.
2014-04-28 17:25:36 -07:00
Wagner Bruna
359de9734a commands: fix typo in --graph description 2014-04-22 10:12:21 -03:00
Lucas Moscovicz
2794920df6 log: changed implementation to use graphlog code
Now that revsets work in a lazy way, log code can be changed to parse every
option into a revset and then evaluate it lazily.

Now expressions like

  "hg log -b default -b ."

are converted into a revset using the same code as graphlog.
2014-02-28 15:10:56 -08:00
Mads Kiilerich
d2c13e7d3c backout: use commonancestorsheads for checking linear heritage
If two revisions are linearly related, there will only be one ancestor, and
commonancestors and commonancestorsheads would give the same result.
commonancestorsheads is however slightly simpler, faster and more correct.
2014-04-17 20:01:39 +02:00
Sean Farley
1002b6c612 memfilectx: call super.__init__ instead of duplicating code
This patch changes the calling signature of memfilectx's __init__ to fall in
line with the other file contexts.

Calling code and tests have been updated accordingly.
2013-08-15 16:49:27 -05:00
Matt Mackall
95a0ecfb91 merge with stable 2014-05-27 17:41:20 -07:00
Pierre-Yves David
b7c330c46d import: add --partial flag to create a changeset despite failed hunks
The `hg import` command gains a `--partial` flag. When specified, a commit will
always be created from a patch import. Any hunk that fails to apply will
create .rej file, same as what `hg qimport` would do. This change is mainly
aimed at preserving changeset metadata when applying a patch, something very
important for reviewers.

In case of failure with `--partial`, `hg import` returns 1 and the following
message is displayed:

    patch applied partially
    (fix the .rej files and run `hg commit --amend`)

When multiple patches are imported, we stop at the first one with failed hunks.

In the future, someone may feel brave enough to tackle a --continue flag to
import.
2014-05-08 17:08:17 -07:00
Mads Kiilerich
8244be3a60 update: introduce --tool for controlling the merge tool
Update is a kind of merge and may also need a merge tool and should have the
options described in the merge-tools help.
2014-05-19 01:53:34 +02:00
Siddharth Agarwal
265738b91b resolve: don't abort resolve -l even when no merge is in progress
This broke some internal automation that was quite reasonably checking for
unresolved files as a way to determine whether a merge happened cleanly. We
still abort for resolve --mark etc.
2014-05-23 13:10:31 -07:00
Durham Goode
653de51193 graft: customize graft conflict markers (BC)
Changes the graft conflict markers to be 'graft' and 'local' to make it
more intuitive which side is which.
2014-05-09 18:15:02 -07:00
Matt Harbison
479cfafe7a cat: explicitly document the supported formatter rules
The previous documentation pointed to the export command, but even if the user
recognized that instead of only reading the cat specific list of rules, not all
of the export rules applied anyway (specifically %N, %n and %m).  The new items
are a copy/paste from export's list.  These rules have existed since at least
version 0.5.

Note that %m gets substituted with 'None' because the commit message isn't
passed to cmdutil.makefilename().  %R and %r are currently effectively the same,
since no revwidth is passed, however they both work.

There aren't any existing tests for these rules, so they are added to prevent
future regression.
2014-04-15 23:29:19 -04:00
Pierre-Yves David
c9703fe999 bundle2: add a ui argument to readbundle
The bundle2 unbundler needs a ui argument. We are now passing this information
to `readbundle`.
2014-04-14 15:45:30 -04:00
Pierre-Yves David
009e9f6c33 bundle2: move readbundle into the exchange module
The `readbundle` function is going to understand the bundle2 header. We move the
function to a more suitable place before making any other changes.
2014-04-14 15:33:50 -04:00
FUJIWARA Katsunori
63865524f1 outgoing: introduce "outgoinghooks" to avoid redundant outgoing check
This patch introduces "outgoinghooks" to avoid redundant outgoing
check for "hg outgoing" in other than "commands.outgoing" (or utility
functions used by it).
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
f962e484fd hg: make "_outgoing()" return peer object for remote repository
This patch makes "_outgoing()" return peer object for remote
repository, to avoid re-execution "expandpath()", "parseurl()", and
"peer()" on caller side for specified URL.
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
7c3a219e15 hg: make "_outgoing()" return empty list instead of "None"
This patch makes "_outgoing()" return empty list instead of "None", if
there are no outgoing changesets, because:

  - returning "None" requires callers to examine whether returned
    value is "None" or not explicitly, if callers want to execute loop
    on returned value, but

  - there are no explicit needs to return "None"
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
090a597dc7 summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
This patch introduces "summaryremotehooks" to avoid redundant
incoming/outgoing check for "hg summary" in other than
"commands.summary".

Only if "--remote" is not specified for "hg summary", hooks registered
in "summaryremotehooks" are invoked with "None" as "changes" argument
at first, and they should return tuple of two booleans meaning
"whether incomings are needed" and "whether outgoings are needed".

If no hooks return tuple containing "True", "hg summary" does nothing
any more, because incoming/outgoing check is not needed.

Otherwise, hooks are invoked again: at this time, "changes" argument
refers the result of incoming/outgoing check.

This patch also prevents RepoError from being raised if "--remote" is
not specified for "hg summary", because of backward compatibility for
"hg summary --large" without "--remote".
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
16b89197f7 summary: separate checking incoming/outgoing and showing remote summary
This patch separates checking incoming/outgoing and showing remote
summary, as a preparation for refactoring in succeeding patches,
because:

  - checking incoming/outgoing may be needed, even if "--remote" is
    not specified for "hg summary"

  - checking incoming/outgoing may not be needed simultaneously

"hg summary --large" without "--remote" is typical case for these.
2014-04-16 00:37:24 +09:00
Matt Harbison
615b124547 cat: support cat with explicit paths in subrepos
The cat command with an explicit path into a subrepo is now handled by invoking
cat on the file, from that subrepo.  The previous behavior was to complain that
the file didn't exist in the revision (of the top most repo).  Now when the file
is actually missing, the revision of the subrepo is named instead (though it is
probably desirable to continue naming the top level repo).

The documented output formatters %d and %p reflect the path from the top level
repo, since the purpose of this is to give the illusion of a unified repository.
Support for the undocumented (for cat) formatters %H, %R, %h, %m and %r was
added long ago (I tested back as far as 0.5), but unfortunately these will
reflect the subrepo node instead of the parent context.

The previous implementation was a bit loose with the return value, i.e. it would
return 0 if _any_ file requested was cat'd successfully.  This maintains that
behavior.
2014-03-14 21:32:05 -04:00
Matt Harbison
cb793b21fa cat: move most of the implementation into cmdutils.cat()
This will allow access to the reusable parts from subrepos, similar to add(),
forget(), etc.
2014-03-13 23:45:18 -04:00
FUJIWARA Katsunori
6737a23301 amend: invoke editor forcibly when "--edit" option is specified
1fc59036a99b introduces "--edit" option into "hg commit", but it
doesn't work for "hg commit --amend", because 1fc59036a99b prepares
for editor invocation only around "commitfunc()" internal function,
which is used only for temporary amend commit by "cmdutil.amend()".

Actual commit message editing is executed in "cmdutil.amend()".

This patch invokes editor forcibly when "--edit" option is specified
for "hg commit --amend", even if commit message is specified
explicitly by "--message" or "--logfile".

This patch also removes useless handling for commit message and editor
invocation around "commitfunc()" internal function.
2014-04-16 02:38:11 +09:00
FUJIWARA Katsunori
c448280b69 commit: abolish useless "--force-editor" internal option for "hg commit"
"--force-editor" option for "hg commit" has been useless since
074e6345f65e, which makes "commands.tag()" invoke "cmdutil.commit()"
directly instead of "commands.commit()" with "--force-editor" internal
option.

This patch abolishes useless "--force-editor" internal option for "hg
commit".
2014-04-16 02:04:41 +09:00
Matt Mackall
404e995f87 subrepo: return non-zero exit code when a subrepo push doesn't succeed 2014-04-15 14:15:35 -04:00
Mads Kiilerich
dde33b4102 debugrevlog: format columns (more) nicely when dumping index data 2014-03-19 00:13:38 +01:00
Bradley M. Kuhn
4cd8c219ba commit: --edit/-e to force edit of otherwise-supplied commit message
The --edit/-e option for the 'commit' command forces editor, even when a
commit message has been provided already by other means, such as by the -m or
-l options.
2013-09-08 19:02:08 -04:00
Takumi IINO
108a15e83e grep: highlight all matched words
"hg grep" highlights first matched word only.
This behavior is different from GNU grep.

This patch makes highlight all matched words.
2014-03-31 01:00:05 +09:00
Mads Kiilerich
723c536d44 backout: don't limit heritage check to a single ancestor
This do probably not make any real difference but is slightly more correct and
we would like to get rid of changelog.ancestor.
2014-04-07 23:17:51 +02:00
Pierre-Yves David
6b9778c026 localrepo: move the addchangegroup method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.

The method had few callers, not enough to be kept in local repo.
2014-04-01 15:27:53 -07:00
Pierre-Yves David
30f24fdb7a localrepo: move the getbundle method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.

The method had few callers, not enough to be kept in local repo.

The peer API remains unchanged.
2014-04-01 14:40:35 -07:00
Pierre-Yves David
47880ff5c9 localrepo: move the getlocalbundle method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.

The method had 3 callers total, far too few for being kept in local repo.
2014-04-01 14:33:23 -07:00
Matt Mackall
1e3dcd8d35 merge with stable 2014-04-01 17:59:06 -05:00
Matt Mackall
c9eb4517fa merge with stable 2014-04-01 15:11:19 -05:00
FUJIWARA Katsunori
01d8b27701 i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that the format string and "%" aren't placed in the
same line.

This patch replaces "\s" in that regexp pattern with "[ \t\n]" to
detect "% inside _()" problems in such case.

"[\s\n]" can't be used in this purpose, because "\s" is automatically
replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes
nested "[]" unexpectedly.
2014-04-01 02:46:03 +09:00
Yuya Nishihara
370defd044 backout: correct commit status of no changes made (BC) (issue4190)
If backout generated no changes to commit, it showed wrong status, "changeset
<target> backs out changeset <target>", and raised TypeError with -v option.

This changes the return code to 1, which is the same as "hg commit" and
"hg rebase".
2014-03-08 18:52:16 +09:00
Yuya Nishihara
d616c909d1 backout: document return code of merge conflict 2014-03-08 18:41:56 +09:00
Jordi Gutiérrez Hermoso
19098ea63d commit: propagate --secret option to subrepos (issue4182)
Before this patch, `hg commit --secret` was not getting propagated
correctly, and subrepos were not getting the commit in the secret
phase. The problem is that subrepos get their ui from the base repo's
baseui object and ignore the ui object passed on to them. This sets
and restores both ui objects with the appropriate option.
2014-03-17 14:57:13 -04:00
FUJIWARA Katsunori
3acb83dcfb tag: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "hg tag -e"
isn't saved into ".hg/last-message.txt" until it is saved by
"localrepository.savecommitmessage()" in "localrepository.commit()".

This may lose such commit message, if unexpected exception is raised.

This patch saves manually edited commit message for "hg tag -e" into
".hg/last-message.txt" just after user editing. This patch doesn't
save the message specified by -m option (-l is not supported for "hg
tag") as same as other commands.

This is the simplest implementation to fix on stable. Editing and
saving commit message should be centralized into the framework of
"localrepository.commit()" with "editor" argument in the future.
2014-03-19 01:07:41 +09:00
FUJIWARA Katsunori
70f9f39f84 commit: create new amend changeset as secret correctly for "--secret" option
Before this patch, "hg commit --amend --secret" doesn't create new
amend changeset as secret, even though the internal function
"commitfunc()" passed to "cmdutil.amend()" make "phases.new-commit"
configuration as "secret" temporarily.

"cmdutil.amend()" uses specified "commitfunc" only for temporary amend
commit, and creates the final amend commit changeset by
"localrepository.commitctx()" directly with memctx.

This patch creates new amend changeset as secret correctly for
"--secret" option, by changing "phases.new-commit" configuration
temporarily before "localrepository.commitctx()".
2014-03-13 19:48:41 +09:00
Yuya Nishihara
6edf7b4a6a phase: say "Returns 0" instead of "Return 0" like other command help 2014-03-03 15:50:45 +09:00
Pierre-Yves David
3eab08d896 resolve: use "other" changeset from merge state (issue4163)
We can use the "other" data from the recorded merge state instead of inferring
what the other could be from working copy parent. This will allow resolve to
fulfil its duty even when the second parent have been dropped.

Most direct benefit is fixing a regression in backout.
2014-02-25 18:45:01 -08:00
Piotr Klecha
0968676adc pull: close peer repo on completion (issue2491) (issue2797)
When pulling changes from a compressed bundle Mercurial first uncompresses it
to a temporary file in .hg directory. This file will not be deleted unless
the bundlerepo (other) is explicitly closed.

This is similar to cleanup that occurs after incoming.
2014-02-25 21:26:25 +01:00
FUJIWARA Katsunori
2add9630f2 grep: exit loop immediately, if matching is found in the file for "hg grep -l"
Before this patch, internal function "display()" of "hg grep" is not
efficient for "-l"/"--files-with-matches", because loop is continued,
even after the first matching is found in the specified file.

This patch exits loop immediately, if matching is found for
"--files-with-matches".

In this case, "before is None" is equal to "opts.get('files_with_matches')".
2014-02-15 19:54:14 +09:00
FUJIWARA Katsunori
e9f33efda3 grep: use "found" instead of "filerevmatches" examination for efficiency
Before this patch, internal function "display()" of "hg grep" stores
whether matching is already found or not into the dictionary
"filerevmatches" by "(fn, rev)" tuple as the key.

But this is redundant, because:

  - "filerevmatches" is local variable of "display()", so each
    "display()" invocations don't affect others

  - both "fn" and "rev" (gotten from "ctx" argument) are never changed
    in each "display()" invocations

Then, "filerevmatches" should have only one entry at most, and "(fn,
rev) in filerevmatches" should be equal to "found".

This patch uses "found" instead of "filerevmatches" examination for
efficiency.
2014-02-15 19:54:05 +09:00
FUJIWARA Katsunori
b011fa5100 grep: reuse the first "util.binary()" result for efficiency
Before this patch, to check whether the file in the specified revision
is binary or not, "util.binary()" is invoked via internal function
"binary()" of "hg grep" once per a line of "hg grep" output, even
though binary-ness is not changed in the same file.

This patch reuses the first "util.binary()" invocation result by
annotating internal function "binary()" with "@util.cachefunc".

Performance improvement measured by "hgperf grep -r 5e9e7af9ae01 vfs
mercurial/scmutil.py":

  before this patch:
    ! wall 0.024000 comb 0.015600 user 0.015600 sys 0.000000 (best of 118)

  after this patch:
    ! wall 0.023000 comb 0.015600 user 0.015600 sys 0.000000 (best of 123)

Status of recent(5e9e7af9ae01) "mercurial/scmutil.py":

  # of lines:     919 (may affect cost of search)
  # of bytes:   29633 (may affect cost of "util.binary()")
  # of matches:    22 (may affect frequency of "util.binary()")
2014-02-15 19:52:36 +09:00
Matt Mackall
cc86d3f245 help: add examples to incoming 2014-03-26 12:52:57 -05:00
Mads Kiilerich
eb672bcfce backout: improve confusing 'cannot backout change on a different branch' abort
These days 'branch' usually refer to a named branch.

Instead, abort with 'cannot backout change that not is an ancestor'.
2014-02-24 22:42:14 +01:00
Mads Kiilerich
2629efac4f config: set a 'source' in most cases where config don't come from file but code
Some extensions set configuration settings that showed up in 'hg showconfig
--debug' with 'none' as source. That was confusing.

Instead, they will now tell which extension they come from.

This change tries to be consistent and specify a source everywhere - also where
it perhaps is less relevant.
2014-03-19 02:45:14 +01:00
Matt Mackall
2b7a5581ef config: mention edit options and config topic in help 2014-03-18 18:57:19 -05:00