Commit Graph

1003 Commits

Author SHA1 Message Date
Pulkit Goyal
134a289843 py3: add b'' to regular expressions which are raw strings
Differential Revision: https://phab.mercurial-scm.org/D1538
2017-11-29 04:47:27 +05:30
Yuya Nishihara
feaa3f8a8c mq: copy pager attributes back to qrepo.ui
If the legacy pager extension is enabled, a pager is started through repo.ui
at dispatch._runcommand(). After that, mqcommand() creates a qrepo with a
fresh repo.baseui, at which point pager information was lost and another pager
would be spawned by the modern pager interface.

This is a minimal workaround for the problem.
2017-10-21 13:42:43 +09:00
Boris Feld
2bb2294b69 mq: use the newcommitphase utility
We use the official API instead of doing the operation manually. This will help
storing the default value for phases properly in the next changeset.
2017-10-09 17:33:03 +02:00
Pulkit Goyal
8cf2ab1237 py3: fix keyword arguments handling in mq
This patch fixes the handling of keyword arguments to functions on Python 3. On
python3, the keys of keyword arguments need to str which is unicode. So any
keyword argument will get will have str keys and any dictionary we pass as
kwargs must have all the keys as str.

This patch uses pycompat.(strkwargs|byteskwargs) to do so conversion between
bytes keys and str keys and use r'' if there are very less uses and conversion
can be prevented.

Differential Revision: https://phab.mercurial-scm.org/D972
2017-10-02 04:46:17 +05:30
Boris Feld
4345bf1f3c configitems: register the 'mq.secret' config 2017-06-30 03:43:17 +02:00
Boris Feld
470745da2b configitems: register the 'mq.plain' config 2017-06-30 03:43:16 +02:00
Boris Feld
c931b71704 configitems: register the 'mq.keepchanges' config 2017-06-30 03:43:15 +02:00
Boris Feld
96e05f8397 configitems: register the 'mq.git' config 2017-06-30 03:43:14 +02:00
Yuya Nishihara
6de6cb029d doctest: upgrade old-style "except" clause 2017-09-03 15:16:01 +09:00
Yuya Nishihara
dcc07e5503 doctest: use print_function and convert bytes to unicode where needed 2017-09-03 14:56:31 +09:00
Yuya Nishihara
a71f259bd2 doctest: bulk-replace string literals with b'' for Python 3
Our code transformer can't rewrite string literals in docstrings, and I
don't want to make the transformer more complex.
2017-09-03 14:32:11 +09:00
Augie Fackler
85e2672134 merge with stable 2017-09-12 11:18:35 -04:00
Mads Kiilerich
3676051d80 mq: create non-lossy patches, also with custom global diff configuration
Users with custom [diff] configuration most certainly didn't intend it to make
mq lose changes. It could:

 * git is handled perfectly fine.

 * nobinary could make mq leave some files out from the patches.

 * noprefix could make mq itself (and probably also other tools) fail to apply
   patches without the usual a/b prefix.

 * ignorews, ignorewsamount, or ignoreblanklines could create patches with
   missing whitespace that could fail to apply correctly.

Thus, when refreshing patches, use patch.difffeatureopts, optionally with git
as before, but without the config options for whitespace and format changing
that most likely will cause loss or problems.

(patch.diffopts is just patch.difffeatureopts with all options enabled and can
be replaced with that.)
2017-09-11 00:42:24 +02:00
Martin von Zweigbergk
cb8b36b8aa cleanup: rename "matchfn" to "match" where obviously a matcher
We usually call matchers either "match" or "m" and reserve "matchfn"
for functions.

Differential Revision: https://phab.mercurial-scm.org/D641
2017-09-05 15:06:45 -07:00
Boris Feld
a55b1d3f9f bookmark: use 'applychanges' in the mq extension 2017-07-10 17:44:25 +02:00
Augie Fackler
e2774d9258 python3: wrap all uses of <exception>.strerror with strtolocal
Our string literals are bytes, and we mostly want to %-format a
strerror into a one of those literals, so this fixes a ton of issues.
2017-08-22 20:03:07 -04:00
Yuya Nishihara
6c2103bc71 commands: move templates of common command options to cmdutil (API)
The goal is to get rid of the debugcommands -> commands dependency.

Since globalopts is the property of the commands, it's kept in the commands
module.
2017-05-14 16:19:47 +09:00
Augie Fackler
73cf882ca2 mq: migrate to context manager for changing dirstate parents 2017-05-18 17:10:53 -04:00
Yuya Nishihara
3e663dde68 registrar: move cmdutil.command to registrar module (API)
cmdutil.command wasn't a member of the registrar framework only for a
historical reason. Let's make that happen. This patch keeps cmdutil.command
as an alias for extension compatibility.
2016-01-09 23:07:20 +09:00
Pulkit Goyal
60e05dd544 py3: convert key to str to make kwargs.pop work in mq
The keys are passed here and there as unicodes and our transformer make things
bytes. Due to that, mq was not poped and this results in error on Py3.
Here we abuse r'' to make that str on Python 3.
2017-05-05 04:48:42 +05:30
Yuya Nishihara
5ede78a765 mq: reject new patch name containing leading/trailing whitespace
We could create a patch of such name, but it wouldn't be processed properly
by mq as parseseries() strips leading/trailing whitespace.

The test of default message (added by 063a2c623014) is no longer be useful
so removed.

This issue was reported as:
https://bitbucket.org/tortoisehg/thg/issues/4693/
2017-03-20 11:38:37 +09:00
Jun Wu
96f89b96ad mq: get rid of ui.backupconfig 2017-03-16 14:39:18 -07:00
Pierre-Yves David
0d3c7adc2c mq: explicitly tests for None
Changeset 97936471dc8d removed the mutable default value, but did not explicitly
tested for None. Such implicit testing can introduce semantic and performance
issue. We move to an explicit testing for None as recommended by PEP8:

https://www.python.org/dev/peps/pep-0008/#programming-recommendations
2017-03-15 15:05:54 -07:00
Pierre-Yves David
1df4bd9f0c mq: don't use mutable default argument value
Caught by pylint.
2017-03-14 23:46:48 -07:00
Gregory Szorc
ad67019046 mq: don't use mutable default argument value 2017-03-12 21:55:46 -07:00
Pierre-Yves David
ec94f0410e mq: directly use repo.vfs.join
The 'repo.join' method is about to be deprecated.
2017-03-08 16:52:16 -08:00
Mads Kiilerich
30045d0a29 vfs: use repo.vfs.rename 2017-03-11 11:04:14 -08:00
Mads Kiilerich
a936a7f3a7 vfs: use repo.wvfs.unlinkpath 2015-01-14 01:15:26 +01:00
Pierre-Yves David
485053e2a1 vfs: use 'vfs' module directly in 'hgext.mq'
Now that the 'vfs' classes moved in their own module, lets use the new module
directly. We update code iteratively to help with possible bisect needs in the
future.
2017-03-02 13:31:23 +01:00
Pierre-Yves David
e5cb48ac36 vfs: replace 'scmutil.opener' usage with 'scmutil.vfs'
The 'vfs' class is the first class citizen for years. We remove all usages of
the older API. This will let us remove the old API eventually.
2017-03-02 03:52:36 +01:00
Augie Fackler
bcf9ea0406 qdiff: migrate to modern pager API
This results in the default pager-attend list being empty. Sadly, we
can't let the code be that way, because some legacy extensions depend
on hooking the pager's attend list at import time (and we'd like to
not break them), and if the list is actually *empty* that triggers
magic behavior in the extension that attends everything. Instead, we
put a long, improbable command name as the only entry in the attend
list.
2017-02-06 23:57:21 -05:00
Yuya Nishihara
b2229f5117 revset: split language services to revsetlang module (API)
New revsetlang module hosts parser, tokenizer, and miscellaneous functions
working on parsed tree. It does not include functions for evaluation such as
getset() and match().

  2288 mercurial/revset.py
   684 mercurial/revsetlang.py
  2972 total

get*() functions are aliased since they are common in revset.py.
2017-02-19 18:19:33 +09:00
Yuya Nishihara
d63d83be69 revset: import set classes directly from smartset module
Follows up 97d0be4019ac.
2017-02-19 18:16:09 +09:00
Yuya Nishihara
0e09faf65f help: uppercase command placeholder
'command' isn't a valid help topic but a placeholder text. Make it upper
case to avoid confusion.
2017-01-25 22:35:40 +09:00
Pulkit Goyal
97f340e354 py3: use pycompat.getcwd() instead of os.getcwd()
We have pycompat.getcwd() which returns bytes path on Python 3. This patch
changes most of the occurences of the os.getcwd() with pycompat one.
2016-11-23 00:03:11 +05:30
Augie Fackler
6154ef8eaf mq: refer to dirstateguard by its new name 2016-11-21 21:05:52 -05:00
Augie Fackler
d3b8e6d277 dispatch: stop supporting non-use of @command
We said we'd delete this after 3.8. It's time.
2016-11-21 21:51:23 -05:00
Durham Goode
64058b3c19 manifest: remove usages of manifest.read
Now that the two manifestctx implementations have working read() functions,
let's remove the existing uses of manifest.read and drop the function.
2016-11-10 02:13:19 -08:00
Pierre-Yves David
0d0d0a7af9 mq: release lock after transaction in qrefresh
The transaction should be closed within the lock.
2016-08-11 15:05:17 +02:00
timeless
80ebd8528d mq: use single quotes in use warning 2016-09-20 23:44:59 +00:00
Augie Fackler
4e1c384d0a extensions: change magic "shipped with hg" string
I've caught multiple extensions in the wild lying about being
'internal', so it's time to move the goalposts on people. Goalpost
moving will continue until third party extensions stop trying to
defeat the system.
2016-08-23 11:26:08 -04:00
Pierre-Yves David
62e206c945 mq: take wlock when 'qqueue' is doing write operations
Apparently when this command was added, the locking was forgotten. No code
changes beside the indentation from the locking context.
2016-08-07 17:00:45 +02:00
Pulkit Goyal
336149484f py3: make hgext/mq.py use absolute_import 2016-05-06 21:54:31 +05:30
Yuya Nishihara
f591623eb5 dispatch: extract function that tests command attributes
This function will host the compatibility layer for old third-party commands.
See the next patch for details.
2016-03-14 00:14:43 +09:00
Matt Mackall
6d2484af42 merge with stable 2016-03-11 15:24:27 -06:00
Pierre-Yves David
a74c6e1e14 mq: restrict generated patch name to 75 characters (issue5117)
Super long first line in description lead to very long file name that
windows is unhappy about. We restrict the name to 75 char to avoid the
issue.

75 seems fine and leave some extra room for '__#' suffix in case of conflict.

I does not seems worthwhile to add a dedicated config option to configure the
length. It can be done in the future if there is an actual user demand for it.
2016-03-09 22:21:08 +00:00
FUJIWARA Katsunori
60e9ee2742 revset: replace extpredicate by revsetpredicate of registrar
This patch consists of changes below (these can't be applied
separately).

  - replace revset.extpredicate by registrar.revsetpredicate in
    extensions

  - remove setup() on an instance named as revsetpredicate in
    uisetup()/extsetup() of each extensions

    registrar.revsetpredicate doesn't have setup() API.

  - put new entry for revsetpredicate into extraloaders in dispatch

    This causes implicit loading predicate functions at loading
    extension.

    This loading mechanism requires that an extension has an instance
    named as revsetpredicate, and this is reason why
    largefiles/__init__.py is also changed in this patch.

Before this patch, test-revset.t tests that all decorated revset
predicates are loaded by explicit setup() at once ("all or nothing").

Now, test-revset.t tests that any revset predicate isn't loaded at
failure of loading extension, because loading itself is executed by
dispatch and it can't be controlled on extension side.
2016-03-08 23:04:53 +09:00
Mads Kiilerich
e251ec4f82 mq: check for reserved patch name with qimport -r (issue5033)
Fix regression from fd27c5170cac.

Catching aborts might not be pretty but it works and is a small change.
2016-01-19 06:00:59 +01:00
Mads Kiilerich
68f8e91ce2 mq: refactor makepatchname into class method 2016-01-19 06:00:30 +01:00
Bryan O'Sullivan
1ac3200b15 with: use context manager for transaction in qimport 2016-01-15 13:14:47 -08:00