Commit Graph

261 Commits

Author SHA1 Message Date
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
FUJIWARA Katsunori
419251cb13 keyword: make restrict mode False while updating files for rollback
This is a preparation for using 'repo.rollback()' instead of aborting
a current running transaction for "shelve" and "unshelve".

Before this patch, updating files as a part of 'repo.rollback()'
overridden by keyword extension always follows 'restrict' mode of the
command currently executed.

"merge", "unshelve" and so on should be 'restrict'-ed, because keyword
expansion may cause unexpected conflicts at merging while these
commands.

But, if 'repo.rollback()' is invoked while executing 'restrict'-ed
commands, modified files in the working directory are marked as
"CLEAN" unexpectedly by code path below:

        # 'lookup' below is True at updating modified files for rollback
        kwcmd = self.restrict and lookup # kwexpand/kwshrink
            :
                if kwcmd:
                    self.repo.dirstate.normal(f)

On the other hand, "rollback" command isn't 'restrict'-ed, because
rollbacking itself doesn't imply merging.

Therefore, disabling 'restrict' mode while updating files as a part of
'repo.rollback()' regardless of current 'restrict' mode should be
reasonable.
2015-10-04 21:33:29 +09:00
Matt Mackall
5e1b4ad958 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
Augie Fackler
f95a6caba1 extensions: document that testedwith = 'internal' is special
Extension authors (notably at companies using hg) have been
cargo-culting the `testedwith = 'internal'` bit from hg's own
extensions, which then defeats our "file bugs over here" logic in
dispatch. Let's be more aggressive about trying to give extension
authors a hint about what testedwith should say.
2015-04-28 16:44:37 -04:00
Yuya Nishihara
71c4aa007f templater: remove noop calls of parsestring(s, quoted=False) (API)
Since e926f2ef639a, parsestring(s, quoted=False) just returns s.
2015-05-04 10:01:03 +09:00
Christian Ebert
add4536ffa keyword: use wvfs.rmtree to remove kwdemo directory
Pass repo.root explicitly as argument to indicate that removal of the temporary
repo is intentional in this case.
2015-04-18 15:39:26 +02:00
Siddharth Agarwal
ae273dc918 keyword: monkeypatch patch.diff more generically
This function doesn't need access to any of the args or kwargs, so make the
monkeypatching more robust. (In upcoming patches we'll introduce another
argument to patch.diff, and this function would break if it weren't for this
patch.)
2015-03-17 15:33:34 -07:00
Siddharth Agarwal
7383237886 keyword: rename kw_diff to kwdiff in keeping with Mercurial style rules
In an upcoming patch we'll change this function's signature. If the name is
kept the same, test-check-commit-hg.t complains.
2015-03-17 15:52:28 -07:00
Jordi Gutiérrez Hermoso
8eb132f5ea style: kill ersatz if-else ternary operators
Although Python supports `X = Y if COND else Z`, this was only
introduced in Python 2.5. Since we have to support Python 2.4, it was
a very common thing to write instead `X = COND and Y or Z`, which is a
bit obscure at a glance. It requires some intricate knowledge of
Python to understand how to parse these one-liners.

We change instead all of these one-liners to 4-liners. This was
executed with the following perlism:

    find -name "*.py" -exec perl -pi -e 's,(\s*)([\.\w]+) = \(?(\S+)\s+and\s+(\S*)\)?\s+or\s+(\S*)$,$1if $3:\n$1    $2 = $4\n$1else:\n$1    $2 = $5,' {} \;

I tweaked the following cases from the automatic Perl output:

    prev = (parents and parents[0]) or nullid
    port = (use_ssl and 443 or 80)
    cwd = (pats and repo.getcwd()) or ''
    rename = fctx and webutil.renamelink(fctx) or []
    ctx = fctx and fctx or ctx
    self.base = (mapfile and os.path.dirname(mapfile)) or ''

I also added some newlines wherever they seemd appropriate for readability

There are probably a few ersatz ternary operators still in the code
somewhere, lurking away from the power of a simple regex.
2015-03-13 17:00:06 -04:00
Laurent Charignon
b5de5559b7 record: move dorecord from record to cmdutil
Part of a serie of patches to move record from hgext to core
2015-03-10 17:14:33 -07:00
Angel Ezquerra
79698da278 localrepo: remove all external users of localrepo.wopener
This change touches every module in which repository.wopener was being used, and
changes it for the equivalent repository.wvfs.

It should now be possible to remove localrepo.wopener.
2015-01-11 01:51:52 +01:00
Angel Ezquerra
6e49f7def8 localrepo: remove all external users of localrepo.sopener
This change touches every module in which repository.sopener was being used, and
changes it for the equivalent repository.svfs.

It should now be possible to remove localrepo.sopener.
2015-01-11 00:25:54 +01:00
Angel Ezquerra
88cbab7845 localrepo: remove all external users of localrepo.opener
This change touches every module in which repository.opener was being used, and
changes it for the equivalent repository.vfs. This is meant to make it easier
to split the repository.vfs into several separate vfs.

It should now be possible to remove localrepo.opener.
2015-01-15 23:17:12 +01:00
Christian Ebert
798b4a0800 keyword: update copyright year 2015-01-03 11:12:44 +00:00
Christian Ebert
e083e1dece keyword: use vfs.reljoin and util.unlinkpath to remove kwdemo 2015-01-03 11:11:46 +00:00
Christian Ebert
0c25396920 keyword: handle resolve to either parent
Merged files are considered modified at commit time even if only 1 parent
differs. In this case we must use the change context of this parent for
expansion.

The issue went unnoticed for long because it is only apparent until the next
update to the merge revision - except in test-keyword where it was always
staring us in the face.
2014-12-21 13:02:59 +00:00
Martin von Zweigbergk
f5a6951636 keyword: use parent of working copy as base for status
Instead of calling repo[None].status(), use the more common form that
uses the parent of the working copy as the base:
repo['.'].status(). Note that the former defaults to comparing to
revision '.', while the latter defaults to revision None, so the
contexts being compared are the same.

It might seem like this would result in a reverse diff, but it turns
out that workingctx.status() incorrectly reverses the result. That bug
will be fixed in a later commit.
2014-10-23 13:17:37 -07:00
Martin von Zweigbergk
2565ab5473 keyword: access status fields by name rather than index 2014-10-03 10:05:54 -07:00
Christian Ebert
a93ce4c3e8 keyword: bump copyright year 2014-08-02 09:44:45 +01:00
Christian Ebert
5f45792045 keyword: really clean up kwdemo temp tree 2014-08-02 09:44:11 +01:00
Gregory Szorc
ef5fffe0f4 keyword: define inferrepo in command decorator 2014-05-04 22:32:15 -07:00
Gregory Szorc
edfe6d451c keyword: define optionalrepo in command decorator 2014-05-04 22:16:56 -07:00
FUJIWARA Katsunori
be42d4e90f keyword: suppress keyword expansion while 'hg fetch' for internal merge
Before this patch, 'hg fetch' may cause unexpected conflict, if 'hg
fetch'-ed changes are located near lines in which keywords are
embedded, because keywords are substituted with other strings in the
working directory.

This patch suppresses keyword expansion while 'hg fetch' for internal
merge by adding 'fetch' to 'restricted' command list like 'merge'.

This patch uses 'hg import' to safely create the new head to be merged
at succeeding 'hg fetch', because:

  - branch of revision #10 is different from one of #11 in 'Test'
    repository, so just 'hg fetch -r 11' doesn't cause merging between
    them

    this means the new head should be created manually.

  - 'hg import' is easier and safer than 'cat <<EOF' and 'hg commit'
    to replay same changes including special characters like '$'

    safeness of 'hg import' with keyword extension is already examined
    in 'test-keyword.t'.
2014-06-05 16:47:14 +09:00
FUJIWARA Katsunori
72499b84e4 keyword: suppress keyword expansion while 'hg histedit' for internal merge
Before this patch, 'hg histedit' may cause unexpected conflict, if 'hg
histedit'-ed changes are located near lines in which keywords are
embedded, because keywords are substituted with other strings in the
working directory.

This patch suppresses keyword expansion while 'hg histedit' for
internal merge by adding 'histedit' to 'restricted' command list like
'merge'.

Test in this patch just swaps order of revision #13 and #14: this is
enough to cause internal merge.
2014-06-05 16:47:14 +09:00
FUJIWARA Katsunori
28390e14b9 keyword: suppress keyword expansion while 'hg backout' for internal merge
Before this patch, 'hg backout' may cause unexpected conflict, if 'hg
backout'-ed changes are located near lines in which keywords are
embedded, because keywords are substituted with other strings in the
working directory.

This patch suppresses keyword expansion while 'hg backout' for
internal merge by adding 'backout' to 'restricted' command list like
'merge'.
2014-06-05 16:47:14 +09:00
FUJIWARA Katsunori
7975a9241d keyword: suppress keyword expansion while 'hg graft' for internal merge
Before this patch, 'hg graft' may cause unexpected conflict, if 'hg
graft'-ed changes are located near lines in which keywords are
embedded, because keywords are substituted with other strings in the
working directory.

This patch suppresses keyword expansion while 'hg graft' for internal
merge by adding 'graft' to 'restricted' command list like 'merge'.
2014-06-05 16:47:14 +09:00
FUJIWARA Katsunori
eba66d1a78 keyword: suppress keyword expansion while 'hg rebase' for internal merge
Before this patch, 'hg rebase' may cause unexpected conflict, if 'hg
rebase'-ed changes are located near lines in which keywords are
embedded, because keywords are substituted with other strings in the
working directory.

This patch suppresses keyword expansion while 'hg rebase' for internal
merge by adding 'rebase' to 'restricted' command list like 'merge'.

This patch specifies '--keep' to 'hg rebase', because revision #10 is
useful also for tests in succeeding patches.
2014-06-05 16:47:13 +09:00
FUJIWARA Katsunori
571246a1be keyword: suppress keyword expansion while 'hg unshelve' for internal merge
Before this patch, 'hg unshelve' may cause unexpected conflict, if 'hg
unshelve'-ed changes are located near lines in which keywords are
embedded, because keywords are substituted with other strings in the
working directory.

This patch suppresses keyword expansion while 'hg unshelve' for
internal merge by adding 'unshelve' to 'restricted' command list like
'merge'.
2014-06-05 16:47:13 +09: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
94e268974b templating: make -T much more flexible
It can now accept styles and paths and references to settings in
[templates].
2014-03-08 17:38:50 -06:00
Matt Mackall
694de7920e changeset_templater: remove use_template method 2014-03-08 16:14:08 -06:00
Simon Heimberg
87f6969b7b cleanup: Remove the only ever used skip-check-code pragma
Use the work-around suggested by the rule instead
2014-01-07 22:29:39 +01:00
Christian Ebert
2d9f477387 keyword: wlock while setting branch in kwdemo 2013-11-20 12:55:08 +00:00
Augie Fackler
213fff305a pathutil: tease out a new library to break an import cycle from canonpath use 2013-11-06 18:19:04 -05:00
Simon Heimberg
25ae76fc48 documentation: add an extra newline after note directive
Like this no docutils version interprets any line in the following text as
argument of note.
2013-11-05 08:59:55 +01:00
Simon Heimberg
9e6ca20cff repo: repo isolation, do not pass on repo.ui for creating new repos
A repo should not get the configuration from an other repo, so create it with
the global configuration in repo.baseui.
This is done too when recreating a repo. The repo configuration is reread
anyway. And now deleted repo configuration does not persist.
2012-10-10 21:55:49 +02:00
Christian Ebert
a53e549921 keyword: move commands.inferrepo for code maintenance 2012-10-17 17:32:01 +02:00
Siddharth Agarwal
a5e71891bd commands: don't infer repo for commands like update (issue2748)
Maintain a whitelist of commands to infer the repo for instead. The whitelist
contains those commands that take file(s) in the working dir as arguments.
2012-10-16 11:43:15 -07:00
Christian Ebert
15900b9e01 templatefilters: avoid traceback caused by bogus date input (issue3344)
Wrap datefilters which split date texts with util.parsedate.

We do not abort, as the bogus date must have been given by the user.
2012-08-10 20:37:20 +01:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Christian Ebert
01fcbdd680 keyword: use ui.formatter for kwfiles output 2012-06-28 15:06:41 +01:00
Christian Ebert
840a657147 keyword: update copyleft 2012-05-26 20:49:51 +02:00
Christian Ebert
932da89b94 keyword: wlock cmdutil.copy wrapper
Expanding/shrinking happens outside the wrapped copy function;
therefore write lock the repo.
2012-05-26 20:49:44 +02:00
Christian Ebert
06fe63f255 keyword: support commit --amend (issue3471)
Include a test as well.
2012-05-26 20:46:12 +02:00
Christian Ebert
0ce6a128c9 keyword: rename kwt.record attribute to kwt.postcommit
A more general descriptive name, as the attribute will be used
for commit --amend as well.
2012-05-25 19:32:29 +02:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Christian Ebert
7b42c28269 keyword: intentionally ignore check-code warning about unwrapped ui message 2012-05-13 14:26:26 +01:00
Brodie Rao
a7ef0a0cc5 cleanup: "not x in y" -> "x not in y" 2012-05-12 16:00:57 +02:00
Christian Ebert
12742c63ce keyword: update filectx.cmp monkeypatch to handle '\1\n' at start of file
Analogous to fe250fe8487d.
2012-01-15 13:37:33 +01:00
Matt Mackall
2988d59e97 keyword: backout realpath change (issue3071) 2011-10-30 12:10:11 -05:00