Commit Graph

7648 Commits

Author SHA1 Message Date
Pierre-Yves David
1b61d96256 revert: bring back usage of subset & ps in parents
Changeset 1440ec8e33c0 switched the order of the operand of the "&" computation
to work around an issue from repo-wide spanset. The need for a workaround has been
alleviated by the introduction of `fullreposet`. So we restore it to normal.

The benchmark shows no significant changes as expected.

We also revert the bogus test change introduced by 1440ec8e33c0. The order is
actually important.
2014-09-17 04:55:55 -07:00
Mads Kiilerich
26870bfa1d filemerge: switch the default name for internal tools from internal:x to :x 2014-09-28 17:15:28 +02:00
Mads Kiilerich
59a85f7e89 filemerge: introduce :x as short version of internal:x merge tool name
"internal:" is so much typing - it is frequently specified on the command line
and gives options that are longer than any other I have seen.
2014-09-28 17:15:25 +02:00
Yuya Nishihara
f415387791 branches: include active, closed and current flags in template output 2014-10-02 23:26:02 +09:00
Yuya Nishihara
ff85e4128c branches: merge white space to format string
Diffs of test output should be harmless.  A white space character is moved
into "log.changeset" color region.
2014-10-02 23:13:56 +09:00
Yuya Nishihara
690eb8ddf7 branches: port to generic templater 2014-10-02 22:59:56 +09:00
Matt Mackall
b33bebd371 tag: use an abort hint 2014-10-02 18:39:57 -05:00
Martin von Zweigbergk
9df9b5260f fetch: use cmdutil.bailifchanged()
Use the existing method cmdutil.bailifchanged() instead of
implementing it again in fetch.py. An effect of this is that the error
messages in case of uncommited changes will be different.
2014-10-01 14:48:42 -07:00
Mads Kiilerich
031ab4d02f merge: mute the status message when bid merge kicks in
Bid merge is now the default and it is not necessary to tell the user that an
experimental feature kicked in.

(It could however still be relevant to get a notice that it is one of the rare
criss-cross merge situations so the user is warned that the situation is more
tricky than usual.)
2014-10-01 03:42:00 +02:00
Mads Kiilerich
9ecbab9de8 merge: use bid merge by default (BC)
In most cases merges will work exactly as before.

The only difference is in criss-cross merge situations where there is multiple
ancestors. Instead of picking an more or less arbitrary ancestor, it will
consider both ancestors and pick the best bids.

Bid merge can be disabled with --config merge.preferancestor='!'.
2014-10-01 03:41:11 +02:00
Mads Kiilerich
b4b06de04d changectx: skip all invalid merge.preferancestor values
A better fix for 0e1533a3ded2 that will ignore other kinds of "invalid"
revisions.
2014-10-01 03:40:51 +02:00
Anton Shestakov
ca791cb0ef templater: add count template filter, plus tests
Previously there was no way of telling how much children or bookmarks or tags a
certain changeset has in a template. It was possible to tell if a changeset has
either 0 or not 0 bookmarks, but not to tell if it has 1 or 2 of them, for
example.

This filter, simply named count, makes it possible to count the number of items
in a list or the length of a string (or, anything that python's len can count).
E.g.: {children|count}, {bookmarks|count}, {file_adds|count}.

Testing the filter on node hash and shortened node hash is chosen because they
both have defined length.

As for lists of strings - children, tags and file_adds are used, because they
provide some variety and also prove that what's counted is the number of string
items in the list, and not the list stringified (they are lists of non-empty,
multi-character strings).

Additionally, revset template function is used for testing the filter, since
the combination is very flexible and will possibly be used together a lot.

(The previous version of this patch had an incorrect email subject and was
apparently lost - patchwork says the patch has been accepted, but it's not so.
The changes between that and this patch are minimal: now the filter does not
disturb the alphabetical order of function definitions and dict keys.)
2014-09-09 22:14:13 +09:00
Pierre-Yves David
ba05aeb114 bundle2: split test in two
We split the test between the one dedicated to the binary format and the one
dedicated to checking the exchange of data using pull and push.
2014-10-01 23:55:22 -05:00
Pierre-Yves David
23ce37ca7e pull: merge bookmark updates and imports
We do all the things in one go now, updating existing bookmark, adding new ones,
and overwriting the ones explicitly specified for --bookmark. This impacts the
tests by removing some duplicated or unnecessary output.
2014-09-28 14:07:56 -07:00
Pierre-Yves David
f69b4810ae push: gather all bookmark decisions together
The discovery phases for bookmarks now use the list of explicitly pushed bookmarks
to do addition, removal and overwriting.

Tests are impacted because this reduces the amount of listkeys calls issued, removes
some duplicated messages and improves the accuracy of some messages.
2014-09-27 20:51:53 -07:00
Pierre-Yves David
f84dab4656 clone: remove duplicated bookmark pulling
Now that all clone methods (copy, pull and push) also transport bookmarks, we can
safely drop the manual pulling that was performed during clone.
2014-09-26 13:56:20 -07:00
Pierre-Yves David
c27d2d3986 clone: explicitly push bookmarks when cloning from local to remote
We need to explicitly push all local bookmarks when doing the clone from a local
repo to a remote one through ssh. This will let us remove the manual export of
bookmarks in clone and rely on the official exchange in push and pull instead.
2014-09-26 15:15:49 -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
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
bfd39d13a8 revert: properly back up added files with local modification
These files were previously not backed up because the backup mechanism was not
smart enough. This leads to data lose for the user since uncommitted contents
were discarded.

We now properly move the modified version to <filename>.orig before deleting it.

We have to use a small hack to do a different action if "--no-backup" is
specified. This is needed because the backup process is actually a move (not a
copy) so the file is already missing when we backup. The internet kitten is a
bit disapointed about that, but such is life.

This patch concludes the "lets refactor revert" phases. We can now open the
"Lets find stupid bug with renames and merge" phases.

I'm sure that now that the code is clearer we could do it in another simpler
way, but I consider the current improvement good enough for now.
2014-08-31 13:01:00 +02: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
Mads Kiilerich
3a64b6d7ed subrepo: remove superfluous newline from subrepo prompt 2014-10-01 01:08:17 +02:00
Mads Kiilerich
29285eb86d ui: show prompt choice if input is not a tty but is forced to be interactive
The tests often set ui.interactive to control normally interactive prompts from
stdin. That gave an output where it was non-obvious what prompts got which
which response, and the output lacked the newline users would see after input.

Instead, if the input not is a tty, write the selection and a newline.
2014-10-01 01:04:18 +02:00
Matt Mackall
0602ddc218 merge with stable 2014-09-30 18:22:58 -05: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
Yuya Nishihara
525193c247 templater: fix precedence of --style and --template options
Since 266cfa7de44d, --template option is ignored if --style is specified,
which is wrong according to the doc of show_changeset():

    Display format will be the first non-empty hit of:
    1. option 'template'
    2. option 'style'
    ...
2014-09-30 23:15:56 +09:00
Anton Shestakov
1119de7215 hgweb: refresh hgweb.repo on phase change (issue4061)
Make hgweb.refresh() also look at phaseroots file (in addition to 00changelog.i
file) and reload the repo when os.stat returns different mtime or size than
cached, signifying the file was modified.

This way if user changes phase of a changeset (secret <-> draft), there's no
need to restart hg serve to see the change.
2014-09-27 21:59:55 +09:00
Anton Shestakov
20c415845d hgweb: fail if an invalid command was supplied in url path (issue4071)
Traditionally, the way to specify a command for hgweb was to use url query
arguments (e.g. "?cmd=batch"). If the command is unknown to hgweb, it gives an
error (e.g. "400 no such method: badcmd").

But there's also another way to specify a command: as a url path fragment (e.g.
"/graph"). Before, hgweb was made forgiving (looks like it was made in
cd356f4efd91) and user could put any unknown command in the url. If hgweb
couldn't understand it, it would just silently fall back to the default
command, which depends on the actual style (e.g. for paper it's shortlog, for
monoblue it's summary). This was inconsistent and was breaking some tools that
rely on http status codes (as noted in the issue4071). So this patch changes
that behavior to the more consistent one, i.e. hgweb will now return "400 no
such method: badcmd".

So if some tool was relying on having an invalid command return http status
code 200 and also have some information, then it will stop working. That is, if
somebody typed foobar when they really meant shortlog (and the user was lucky
enough to choose a style where the default command is shortlog too), that fact
will now be revealed.

Code-wise, the changed if block is only relevant when there's no "?cmd" query
parameter (i.e. only when command is specified as a url path fragment), and
looks like the removed else branch was there only for falling back to default
command. With that removed, the rest of the code works as expected: it looks at
the command, and if it's not known, raises a proper ErrorResponse exception
with an appropriate message.

Evidently, there were no tests that required the old behavior. But, frankly, I
don't know any way to tell if anyone actually exploited such forgiving behavior
in some in-house tool.
2014-09-22 23:46:38 +09:00
Matt Mackall
4afe2f8b38 commit: catch changed exec bit on files from p1 (issue4382) 2014-09-21 10:07:06 -05:00
FUJIWARA Katsunori
d8d8f99761 mq: examine "pushable" of already applied patch correctly
Before this patch, "hg qselect" with --pop/--reapply may pop patches
unexpectedly, even when all of patches applied before "qselect" are
still pushable.

Strictly speaking about the condition of this issue:

  - before "qselect"
    - there are N applied patches
    - the index of the guarded patch X in the series is less than N

  - after "qselect"
    - X is still guarded, and
    - all of applied patched are still pushable

In the case above, "hg qselect" should keep current status, but it
actually tries to pop patches because of X.

The index in "the series" should be used to examine "pushable" of a
patch by "mq.pushablek()", but the index in "applied patches" is used,
and this may cause unexpected examination of guarded patch.

To examine "pushable" of already applied patch correctly, this patch
uses "mq.applied[i].name": "pushable" is the function introduced by
the previous patch, and it returns "mq.pushable(mq.applied[i].name)[0]".
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
396a8e0831 mq: pop correct patches when changing pushable-ness of already applied ones
Before this patch, "hg qselect" with --pop/--reapply may pop incorrect
patches, because the index in "applied patches" is used to pop patches
by "mq.pop()", even though the index in "the series" should be used.

For example, when the already applied patch becomes guarded and it
follows the already guarded (= not yet applied) one, "hg qselect" is
aborted, because it tries to pop to guarded one.

This patch uses "mq.applied[i - 1].name" to pop to the patch, of which
the index in the "applied ones" is "i - 1".
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
3efcc894d8 mq: use "mq.applied[i].name" instead of "mq.appliedname(i)" for safety
Before this patch, "hg qselect --reapply" is aborted when "--verbose"
is specified, because "mq.appliedname()" returns "INDEX PATCHNAME"
instead of "PATCHNAME" in such case and "mq.push" can't accept the
former as the name of patch.

This patch uses "mq.applied[i].name" instead of "mq.appliedname(i)" as
the name of the patch to be pushed for safety.

Now, there is no code path using "mq.appliedname()", and it should be
removed to prevent developers from using it in the wrong way like this
issue.
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
5e22c34bd1 mq: report correct numbers for changing "number of guarded, applied patches"
Before this patch, "hg qselect" may report incorrect numbers for
"number of guarded, applied patches has changed", because it examines
"pushable" of patches by the index not in "the series" but in "applied
patches", even though "mq.pushable()" expects the former.

To report correct numbers for changing "number of guarded, applied
patches", this patch uses the name of applied patch to examine
pushable-ness of it.

This patch also changes the result of existing "hg qselect" tests,
because they doesn't change pushable-ness of already applied patches.

This patch assumes that "hg qselect" focuses on changing pushable-ness
only of already applied patches, because:

  - the report message uses not "previous" (in the series) but
    "applied"

  - the logic to pop patches for --pop/--reapply examines
    pushable-ness only of already applied ones (in fact, there are
    some incorrect code paths)
2014-09-12 02:29:19 +09:00
FUJIWARA Katsunori
0d1dc1fcfa dispatch: check shell alias again after loading extensions (issue4355)
Before this patch, the shell alias causes failure when it takes its
specific (= unknown for "hg") options in the command line, because
"_parse()" can't accept them.

This is the regression introduced by 7849ac1dbc57.

It fixed the issue that ambiguity between shell aliases and commands
defined by extensions was ignored. But it also caused that ambiguous
shell alias is handled in "_parse()" even if it takes specific options
in the command line.

To avoid such failure, this patch checks shell alias again after
loading extensions.

All aliases and commands (including ones defined by extensions) are
completely defined before the 2nd (= newly added in this patch)
"_checkshellalias()" invocation, and "cmdutil.findcmd(strict=False)"
can detect ambiguity between them correctly.

For efficiency, this patch does:

  - omit the 2nd "_checkshellalias()" invocation if "[ui] strict= True"

    it causes "cmdutil.findcmd(strict=True)", of which result should
    be equal to one of the 1st invocation before adding aliases

  - avoid removing the 1st "_checkshellalias()" invocation

    it causes "cmdutil.findcmd(strict=True)" invocation preventing
    shell alias execution from loading extensions uselessly
2014-09-10 00:41:44 +09:00
Pierre-Yves David
65dc6712bd test: protect the run-tests.py --json test behind an hghave rule
We add a rules to detect availability of a json module and skip if json is not
available.
2014-09-18 11:43:47 -07:00
Matt Mackall
275eb5bdd1 merge with stable 2014-09-29 17:23:38 -05:00
Mads Kiilerich
69f5c2ecc6 ssl: on OS X, use a dummy cert to trick Python/OpenSSL to use system CA certs
This will give PKI-secure behaviour out of the box, without any configuration.

Setting web.cacerts to any value or empty will disable this trick.

This dummy cert trick only works on OS X 10.6+, but 10.5 had Python 2.5 which
didn't have certificate validation at all.
2014-09-26 02:19:48 +02:00
Yuya Nishihara
03d7086901 test-commandserver: make runcommand message bolder
It seems ' runcommand' is difficult to distinguish from command output.
'*** runcommand' is slightly better.
2014-09-28 17:21:38 +09:00
Yuya Nishihara
a55d222f7b test-commandserver: rewrite manual substitution of output by (glob) match 2014-09-28 14:46:57 +09:00
Yuya Nishihara
095547c625 test-commandserver: remove redundant banner output
Since test output was inlined, "testing <func>" message should no longer
be necessary.
2014-09-28 16:59:30 +09:00
Yuya Nishihara
44811e417e test-commandserver: remove .py test which was ported to .t 2014-09-28 16:55:14 +09:00
Yuya Nishihara
60e5066f88 test-commandserver: port test functions from .py to .t
Though we have to duplicate import statements, .t test is still more handy
than .py test which has cryptic .out file.

This change allows to skip a part of test by #if conditional, which my next
patch series depends on.
2014-09-28 16:05:37 +09:00
Yuya Nishihara
bd1f3e4e18 test-commandserver: add stub for .t test by copying .out with 2-space indent
Currently test-commandserver.t only contains output, so it is skipped by
#require false.
2014-09-28 14:27:40 +09:00
Yuya Nishihara
1d33f9598f test-commandserver: split helper functions to new hgclient module
This prepares for porting test-commandserver.py to .t test.

Though command-server test needs many Python codes, .t test will be more
readable than .py test thanks to inlined output.
2014-09-28 13:31:16 +09:00
Yuya Nishihara
7c09e032d1 heredoctest: do not append extra newline character to continuation line
Trailing newline characters are kept in lines.
2014-09-28 15:13:35 +09:00
Yuya Nishihara
c82190e72c heredoctest: use the same dict for local/global contexts as in doctest
In order to mimic module-level evaluation, globals and locals should be the
same object, so doctest does not pass separate locals dict.

https://docs.python.org/2.7/reference/simple_stmts.html#exec

This fixes NameError in the following example:

    >>> import foo
    >>> def bar():
    ...     foo  # must exist in globalvars
2014-09-28 14:15:43 +09:00
Matt Mackall
dd1fdce87e merge with stable 2014-09-27 14:47:52 -05:00
Matt Mackall
e3f89597c5 commands: add debuglocks to report/clear lock state 2014-09-26 16:44:11 -05:00
Siddharth Agarwal
731b532719 test-convert-git.t: make copy detection deterministic
Since both 'bar' and 'bar-copied' matched 'bar-copied2', Git's copy detection
would sometimes result in 'bar' being the source for 'bar-copied2' and
sometimes 'bar-copied'. Change bar in a separate commit so that that would no
longer be the case.
2014-09-24 11:20:35 -07: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