Commit Graph

170 Commits

Author SHA1 Message Date
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
Pierre-Yves David
9b498a89e0 transplant: directly use repo.vfs.join
The 'repo.join' method is about to be deprecated.
2017-03-08 16:52:49 -08:00
Pierre-Yves David
2e94eebbe6 vfs: use 'vfs' module directly in 'hgext.transplant'
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:39 +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
Simon Farnsworth
947a0b6d19 transplant: set a blockedtag when invoking external filter 2017-03-06 03:27:41 -08:00
Yuya Nishihara
d63d83be69 revset: import set classes directly from smartset module
Follows up 97d0be4019ac.
2017-02-19 18:16:09 +09:00
Pulkit Goyal
56031921a5 py3: convert the mode argument of os.fdopen to unicodes (2 of 2) 2017-02-13 22:15:28 +05:30
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
FUJIWARA Katsunori
1d2fb0ab99 hgext: use templatekeyword to mark a function as template keyword
This patch replaces registration of template keyword function in
bundled extensions by registrar.templatekeyword decorator all at once.
2016-03-13 05:17:06 +09:00
timeless
c63b17c586 transplant: use absolute_import 2016-03-01 04:53:43 +00:00
timeless
1e52ec82b3 transplant: switch to using nodemod for hex+short 2016-03-11 16:07:22 +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
Bryan O'Sullivan
64b55549f8 with: use context manager for wlock in transplant 2016-01-15 13:14:47 -08:00
timeless
35854385ce transplant: specify the right file and path for unfinishedstates 2016-01-06 04:59:46 +00:00
timeless
aa6a7a6e4d transplant: only use checkunfinished if not continue 2016-01-06 04:59:21 +00:00
timeless
57af46935b transplant: correct language to use working directory 2016-01-05 22:46:04 +00:00
FUJIWARA Katsunori
4d06739a86 revset: use delayregistrar to register predicate in extension easily
Previous patch introduced 'revset.predicate' decorator to register
revset predicate function easily.

But it shouldn't be used in extension directly, because it registers
specified function immediately. Registration itself can't be restored,
even if extension loading fails after that.

Therefore, registration should be delayed until 'uisetup()' or so.

This patch uses 'extpredicate' decorator derived from 'delayregistrar'
to register predicate in extension easily.

This patch also tests whether 'registrar.delayregistrar' avoids
function registration if 'setup()' isn't invoked on it, because
'extpredicate' is the first user of it.
2015-12-29 23:58:30 +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
timeless
4714e37c78 transplant: use Oxford comma 2015-11-30 19:28:26 +00:00
FUJIWARA Katsunori
f9e9bdfb4f transplant: widen wlock scope of transplant for consitency while processing
Before this patch, "hg transplant" executes below before acquisition
of wlock.

  - cmdutil.checkunfinished()
  - repo.status() for dirty check
  - repo.dirstate.parents()

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

This patch makes "hg transplant" acquire wlock before processing
instead of acquiring wlock in each of 'transplanter.apply()' and
'transplanter.recover()'.
2015-12-09 08:28:53 +09:00
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
f2187903e7 dirstate: remove meaningless dirstateguard
Previous patch made dirstate changes in a transaction scope "all or
nothing". Therefore, 'dirstateguard' is meaningless, if its scope is
as same as one of the related transaction.

This patch removes such meaningless 'dirstateguard' usage.
2015-10-09 03:53:46 +09:00
Pierre-Yves David
7b5d19b0d7 transplant: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:52:21 -07:00
FUJIWARA Katsunori
2fb0db56cb transplant: restore dirstate correctly at unexpected failure
Before this patch, transplant can't restore dirstate as expected at
failure other than one while patching. This causes:

  - unexpected file status

  - dirstate refers already rollback-ed parent
    (only at failure of transplanting the 2nd or later revision)

To restore dirstate correctly also at unexpected failure, this patch
encloses scope of store lock and transaction by 'dirstateguard'.

This is temporary fixing for stable branch. See
DirstateTransactionPlan wiki page for detail about the future plan to
treat dirstate consistently around scope boundary of transaction.

    https://mercurial.selenic.com/wiki/DirstateTransactionPlan

This patch also adds 'if lock' examination for safety
'lock.release()', because creating 'dirstateguard' object may fail
unexpectedly (e.g. IOError for saving dirstate).

BTW, in the test script, putting section header '[extensions]' into
'.hg/hgrc' is needed to fix incomplete disabling 'abort' extension at
d0d06f4ca862.
2015-07-30 06:22:09 +09:00
Matt Mackall
ef6c4dec08 transplant: mark some undocumented options deprecated 2015-06-25 17:42:09 -05:00
Matt Mackall
b050378961 merge with stable 2015-07-01 16:33:31 -05:00
Pierre-Yves David
a7b191b4b3 transplant: only pull the transplanted revision (issue4692)
For some reason, transplant was pulling all remote revisions when transplanting
from a remote repository (unless --branch was
specified).
2015-06-29 19:09:42 -07:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Yuya Nishihara
610665ea76 commands: say "working directory" in full spelling 2015-03-17 21:53:17 +09:00
Pierre-Yves David
171c6e502b transplant: properly skip empty changeset (issue4423)
If resolving a merge conflict result in an empty changesets, we now properly
skip the changeset instead of crashing.

Original patch from Robert Collins <robertc@robertcollins.net>.
2015-01-08 21:36:12 -08: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
Siddharth Agarwal
b06bac1ae7 transplant: don't honor whitespace and format-changing diffopts
transplant uses diff purely internally.
2014-11-18 21:49:05 -08:00
Yuya Nishihara
ceda6fbba9 util.system: use ui.system() in place of optional ui.fout parameter 2014-11-08 13:06:22 +09:00
Pierre-Yves David
3668994bce transplant: use exchange.pull
localrepo.pull is going away. See 88d9d4ec499e for details.
2014-10-03 11:21:52 -05:00
FUJIWARA Katsunori
67129a7816 transplant: change "editform" to distinguish merge commits from others
"editform" argument for "getcommiteditor" is decided according to the
format below:

  EXTENSION[.COMMAND][.ROUTE]

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

This patch newly adds "normal" and "merge" as ROUTE, to distinguish
merge commits from other.

This patch adds 4 test patterns to test combination of "merge"(x2) and
"--continue"(x2).
2014-08-16 10:43:59 +09:00
FUJIWARA Katsunori
1220ea4bc4 transplant: pass 'editform' argument to 'cmdutil.getcommiteditor'
This patch passes 'editform' argument according to the format below:

  EXTENSION[.COMMAND][.ROUTE]

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

In this patch, COMMAND and ROUTE are omitted.
2014-08-02 21:46:26 +09:00
FUJIWARA Katsunori
71a4736498 transplant: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-transplant.t", because "hg transplant"
hasn't been explicitly tested around editor invocation and "--edit"
option.
2014-05-11 00:49:35 +09:00
Mads Kiilerich
d164c93242 transplant: use context ancestor instead of changelog ancestor
We want to move in this direction. ctx.ancestor is in a better position for
handling a situation with multiple ancestors.
2014-04-07 23:17:51 +02:00
Lucas Moscovicz
e0f8aa1f35 hgext: updated extensions to return a baseset when adding symbols 2014-02-11 09:00:38 -08:00
FUJIWARA Katsunori
636302d19b transplant: use "ui.extractchoices()" to show the list of available responses
Before this patch, transplant extension shows the list of available
responses by specific string, even though the prompt string passed to
"ui.promptchoice()" has enough (maybe i18n-ed) information.

This patch uses "ui.extractchoices()" to show the list of available
responses.
2013-12-02 00:50:30 +09:00
FUJIWARA Katsunori
ecea0f8fc0 transplant: use "ui.promptchoice()" for interactive transplant
Before this patch, transplant extension uses "ui.prompt()" for
interactive transplant, and has to check whether user response
returned by "ui.prompt()" is valid or not in own code.

In addition to it, transplant extension uses response characters
(e.g. "y", "n", and so on) directly in own code, and this disallows to
use another response characters by translation, even though the help
shown by '?'  typing is translatable.

This patch uses "ui.promptchoice()" instead of "ui.prompt()" to
resolve problems above.
2013-12-02 00:50:30 +09:00
FUJIWARA Katsunori
90dd1201ec transplant: use peer of source repository as "remote" for "repo.pull()"
Before this patch, transplant with "--merge" option fails with
traceback unexpectedly, if it causes pull from the source repository
on the local host.

"discovery.findcommonincoming()" invokes "capable()" method on the
object given from "localrepository.pull()", but it is
"localrepository" object in this case and doesn't have such method.

This patch uses peer object of source repository as "remote" argument
for "localrepository.pull()" invocation like other invocations of it
in transplant.py.
2013-11-16 23:14:20 +09:00
Mads Kiilerich
eabc047878 spelling: random spell checker fixes 2013-10-24 01:49:56 +08:00
Matt Mackall
6d0d30f28a checkunfinished: accommodate histedit quirk
Turns out histedit actually intends for commits (but not other
operations like update) to be possible during its operation.
2013-07-25 02:17:52 -05:00
Matt Mackall
d033919984 transplant: add checkunfinished (issue3955)
Nobody loves transplant anymore, but it was the first command to have
a --continue flag.
2013-07-24 23:51:44 -05:00
Mads Kiilerich
498a388ae4 transplant: use set for prune lookup 2013-04-16 19:31:59 +02:00
Mads Kiilerich
4abe784ebb transplant: improve documentation 2013-04-16 19:20:23 +02:00
Mads Kiilerich
c4edbe5043 transplant: clarify what --branch do - it has nothing to do with branches
--branch specifies heads and has nothing to do with named branches, and it only
deals with topological branches to the same extent as all other DAG operations
do.
2013-04-16 19:18:38 +02:00
Bryan O'Sullivan
747f253c06 transplant: pass source through to recover 2013-04-12 18:44:22 -07:00
Bryan O'Sullivan
6bdbf1a461 repoview: remove unreachable code
Found using Cython.
2013-04-12 17:18:52 -07:00