Commit Graph

992 Commits

Author SHA1 Message Date
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
Matt Mackall
488f376f73 qimport: record imported revs incrementally (issue3874)
When an import fails, this doesn't lose the state for the earlier
revisions.
2014-07-31 16:32:12 -05: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
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
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
Jordi Gutiérrez Hermoso
465e05be10 strip: remove -b/--backup codepaths
cset 21b4faf3787e has removed this option. This commit just tidies the
code that was associated to it. It also fixes the internal calls to
the strip() function.

Before this change, any function that thought it would want as a final
safety to keep a partial backup bundle (bundling changes not linearly
related to the current change being stripped), had to explicitly pass
a backup="strip" option. With this change, these backups are always
kept in case of an exception and always removed if there is no
exception. Only full backups can be specified with backup=True or no
full backups with backup=False.
2014-07-24 15:06:08 -04:00
Pierre-Yves David
7a1c469474 mq: wrap qimport 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:07 -07:00
Pierre-Yves David
6f74d76989 mq: wrap qfinish 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:48:51 -07:00
FUJIWARA Katsunori
66fb22c0d4 mq: 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:

  - MQ command names (qnew/qrefresh/qfold) are used as COMMAND
  - ROUTE is omitted
2014-08-02 21:46:26 +09:00
Gregory Szorc
fb9bbaae28 mq: define inferrepo in command decorator 2014-05-04 22:30:47 -07:00
Gregory Szorc
bb3762da6d mq: define norepo in command decorator 2014-05-04 22:04:14 -07:00
FUJIWARA Katsunori
5ea4e92a4f qfold: allow to specify '--message/'--logfile' and '--edit' at the same time
Before this patch, 'hg qfold' disallows to specify
'--message/'--logfile' and '--edit' at the same time.

'hg qfold' has disallowed such combination since Mercurial 0.9.2, but
this restriction seems not to be reasonable for recent Mercurial,
because all other commands creating new changeset allow it.

This patch allows 'hg qfold' to specify '--message/'--logfile' and
'--edit' at the same time like other commands creating new changeset.
2014-06-01 00:08:33 +09:00
FUJIWARA Katsunori
872d5bce44 qrefresh: allow to specify '--message/'--logfile' and '--edit' at the same time
Before this patch, 'hg qrefresh' disallows to specify
'--message/'--logfile' and '--edit' at the same time.

'hg qrefresh' has disallowed such combination since Mercurial 0.9.2,
but this restriction seems not to be reasonable for recent Mercurial,
because all other commands creating new changeset allow it.

This patch allows 'hg qrefresh' to specify '--message/'--logfile' and
'--edit' at the same time like other commands creating new changeset.
2014-06-01 00:08:32 +09:00
FUJIWARA Katsunori
9af54bf260 mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qrefresh/qfold)
This patch also replaces "editor = False" by "editor =
cmdutil.getcommiteditor()", because:

  - it allows to hook commit message determination easily, even in the
    case without "--edit"

  - it avoids regression (or additional care) around saving
    "last-message.txt", even if MQ's "newcommit()" changes its
    implementation logic from "localrepository.commit" to
    "localrepository.commitctx" with "memctx" in the future

    to save commit message into "last-messge.txt" with "memctx",
    "editor" should be valid function.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
86d8361294 mq: fold the code paths to invoke editor into specific logic (qrefresh/qfold)
This factoring simplifies the succeeding patch to switch from
"ui.edit()" to "getcommiteditor()" for qrefresh/qfold.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
55e621635c mq: use the editor gotten by "getcommiteditor()" instead of "ui.edit()" (qnew)
This patch also replaces "editor = False" by "editor =
cmdutil.getcommiteditor()", because:

  - the latter allows to hook commit message determination easily,
    even in the case without "--edit"

  - the latter can avoid regression (or additional care) around saving
    "last-message.txt", even if MQ's "newcommit()" changes its
    implementation logic from "localrepository.commit" to
    "localrepository.commitctx" with "memctx" in the future

    to save commit message into "last-messge.txt" with "memctx",
    "editor" should be valid function.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
5d5193e6c8 mq: fold the code path to invoke editor into specific logic (qnew)
This factoring simplifies the succeeding patch to switch from
"ui.edit()" to "getcommiteditor()" for qnew.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
0c74e7c7d1 mq: eliminate unused variable for test-check-pyflakes.t
"user" in "fold()" has become useless since ab68b153ce34.
2014-05-09 08:44:53 +09:00
FUJIWARA Katsunori
8430e60754 qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
Before this patch, "hg qrefresh" and "hg qfold" invoke "ui.edit()"
explicitly to get commit message edited manually.

This requires explicit "localrepository.savecommitmessage()"
invocation to save edited commit message into ".hg/last-message.txt",
because unexpected exception raising may abort command execution
before saving it in "localrepository.commit()".

This patch uses "editor" argument of "localrepository.commit()"
instead of explicit "ui.edit()" invocation for "hg qnew" and "hg qfold"

"localrepository.commit()" will invoke "desceditor()" function newly
added by this patch, and save edited commit message into
".hg/last-message.txt" automatically.

This patch passes not "editor" but "desceditor" to "commit()", because
"hg qnew" and "hg qfold" require editor function to return edited
message (and invoke "patchheader.setmessage()" with it) if not empty,
or default message otherwise.

This patch also avoids "not q.applied" check at "hg qrefresh --edit",
because it is also checked in "queue.refresh()", and it is not needed
to get commit message from patch header before "queue.refresh()".
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
0a1ee5ebe2 qrefresh: relocate message/patch-header handling to delay message determination
Before this patch, commit message for refreshed MQ changeset is
determined, and written into refreshed patch file before
"localrepository.commit()" invocation.

This makes refactoring to use "editor" argument of "commit()" instead
of explicit "ui.edit()" invocation in succeeding patch difficult.

This patch relocates message/patch-header handling to delay message
determination.
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
9cb2df4ecc qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
Before this patch, "hg qnew" invokes "ui.edit()" explicitly to get
commit message edited manually.

This requires explicit "localrepository.savecommitmessage()"
invocation to save edited commit message into ".hg/last-message.txt",
because unexpected exception raising may abort command execution
before saving it in "localrepository.commit()".

This patch uses "editor" argument of "localrepository.commit()"
instead of explicit "ui.edit()" invocation for "hg qnew".

"localrepository.commit()" will invoke "desceditor()" function newly
added by this patch, and save edited commit message into
".hg/last-message.txt" automatically.

This patch passes not "editor" but "desceditor" to "commit()", because
"hg qnew" requires editor function to return edited message if not
empty, or default message otherwise.

This patch applies "rstrip()" on "defaultmsg" at comparison between
"nctx.description()" and "defaultmsg", because the former should be
stripped by "changelog.stripdesc()" and the latter may have tail white
spaces inherited from "patchfn".
2014-05-05 21:26:40 +09:00
Mads Kiilerich
a0586f61a1 mq: repo['.'] is not a wctx, repo[None] is
The parameters passed to subrepo.submerge are confusing anyway.
2014-04-07 23:10:20 +02:00
Pierre-Yves David
8ab4eab6ab push: pass a pushoperation object to localrepo.checkpush
The `pushoperation` object contains strictly more data the arguments currently
passed to `localrepo.checkpush` we pass the new object instead. This function is
used by MQ to abort push that includes MQ changesets.

Note: extension that may use this function will have to align.
2014-04-01 13:45:48 -07:00
FUJIWARA Katsunori
ccc7916e45 localrepo: omit ".hgsubstate" also from "added" files
Before this patch, "localrepository.commit()" omits ".hgsubstate" from
"modified" (changes[0]) and "removed" (changes[2]) file list before
checking subrepositories, but leaves one in "added" (changes[1]) as it
is.

Then, "localrepository.commit()" adds ".hgsubstate" into "modified" or
"removed" list forcibly, according to subrepository statuses.

If "added" contains ".hgsubstate", the committed context will contain
two ".hgsubstate" in its "files": one from "added" (not omitted one),
and another from "modified" or "removed" (newly added one).

How many times ".hgsubstate" appears in "files" changes node hash,
even though revision content is same, because node hash calculation
uses the specified "files" directly (without duplication check or so).

This means that node hash of committed revision changes according to
existence of ".hgsubstate" in "added" at "localrepository.commit()".

".hgsubstate" is treated as "added", not only in accidental cases, but
also in the case of "qpush" for the patch adding ".hgsubstate".

This patch omits ".hgsubstate" also from "added" files before checking
subrepositories. This patch also omits ".hgsubstate" exclusion in
"qnew"/"qrefresh" introduced by changeset bbb8109a634f, because this
patch makes them meaningless.

"hg parents --template '{files}\n'" newly added to "test-mq-subrepo.t"
enhances checking unexpected multiple appearances of ".hgsubstate" in
"files" of created/refreshed MQ revisions.
2014-03-22 23:39:51 +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
FUJIWARA Katsunori
e280ea2008 mq: omit ".hgsubstate" from qnew/qrefresh target list for consistent node hash
Before this patch, even if specified file patterns and -I/-X options
cause listing ".hgsubstate" up in the target list, qnew/qrefresh put
".hgsubstate" into the target list individually and forcibly.

This changes how many times ".hgsubstate" appear in the target list
according to run-time conditions, and causes inconsistent node hash,
even though revision content is same, because node hash calculation
uses the specified target list directly (without duplication check or
so).

This patch always omits ".hgsubstate" from qnew/qrefresh target list
for consistent node hash.

This omitting doesn't miss including ".hgsubstate" changes, because:

  - "localrepository.commit()" puts ".hgsubstate" into the target list
    for "commitctx()" forcibly if needed

  - "mq.putsubstate2changes()" puts ".hgsubstate" into the target list
    for "patch.diff()" if it is not yet listed up
2014-03-20 00:10:45 +09:00
FUJIWARA Katsunori
ff356918e1 qnew: omit meaningless and harmful putting subrepositories into target list
Before this patch, qnew puts updated subrepositories into target list
forcibly, if any of -I, -X or patterns are specified.

But this is meaningless and harmful, because:

  - putting subrepositories into target list doesn't affect the result
    of "localrepository.status()"

    "dirstate.status()" invoked via "localrepository.status()" always
    omits subrepositories from the result of it

  - any -I/-X opts and empty "pats" causes unexpected failure

    when any -I/-X opts are specified, "inclsubs" are always added to
    "pats", even if "pats" is empty.

    but this changes meaning of "pats" from "including all to be
    included" to "including only listed subrepositories"

    this may exclude ".hgsub" and cause unexpected exception raising
    ("can't commit subrepos without .hgsub" ).

  - qnew at other than repository root (with -I, -X or any patterns)
    causes unexpected failure

    "scmutil.match()" treats pattern without syntax type as 'relpath'
    type (= one rooted at cwd).

    but qnew puts subrepository paths rooted at the repository root,
    and it causes unexpected exception raising ("SUBREPO not under
    root ROOT" in "pathutil.canonpath()"), if "hg qnew" is executed at
    other than repository root with -I, -X or any patterns.

This patch omits meaningless and harmful putting subrepositories into
target list.

This omitting doesn't miss including updated subrepositories, because
subrepositories are specified to "scmutil.matchfiles()" directly, to
get "match" object for "localrepository.commit()".
2014-03-20 00:10:45 +09:00
Matt Mackall
ea6ffc9a80 merge with stable 2014-03-18 14:25:28 -05:00
FUJIWARA Katsunori
d87cd6b53c qfold: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "hg qfold -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 qfold -e" into
".hg/last-message.txt" just after user editing. This patch doesn't
save the message specified by -m/-l options 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.

This patch uses repository wrapping class for exception raising before
saving commit message in "localrepository.commit()" easily and
certainly, because such exception requires corner case condition.
2014-03-19 01:07:41 +09:00
FUJIWARA Katsunori
84f2d9a815 qnew: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "hg qnew -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 qnew -e" into
".hg/last-message.txt" just after user editing. This patch doesn't
save the message specified by -m/-l options 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.

This patch uses repository wrapping class for exception raising before
saving commit message in "localrepository.commit()" easily and
certainly, because such exception requires corner case condition.
2014-03-19 01:07:41 +09:00
Yuya Nishihara
16bbd89ec4 cmdserver: recreate mq object on runcommand in case queue path was changed
repo.mq needs to be recreated after queue path change.  Since there is little
benefit to keep invalidated mq object, it always delete repo.mq.
2014-03-03 19:41:30 +09:00
Yuya Nishihara
ff2e18c10c cmdserver: reload mq on each runcommand request to avoid corruption
If mq was changed by another process, command server should invalidate caches.
Otherwise, mq status would go wrong.
2014-03-03 19:41:26 +09:00
Lucas Moscovicz
e0f8aa1f35 hgext: updated extensions to return a baseset when adding symbols 2014-02-11 09:00:38 -08:00
Matt Mackall
a08d7350cb mq: fix qimport url check 2014-02-09 17:30:49 -06:00
Matt Mackall
5f4b3d5487 qimport: allow importing URLs 2014-02-07 17:54:10 -06:00
Kevin Bullock
938beaeee7 mq: prefer a loop to a double-for list comprehension
The [x for y in l for x in y] syntax is nigh-incomprehensible, and this
is a particularly easy case to expand into a loop since there's no 'if'
condition in the list comprehension.
2013-11-24 17:29:10 -06:00
Mads Kiilerich
429aab87ea mq: don't add '* * *' separators when there is no commit message 2013-11-16 15:46:28 -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
Mads Kiilerich
eabc047878 spelling: random spell checker fixes 2013-10-24 01:49:56 +08:00
Brodie Rao
e5bfb7187d mq: refactor usage of repo.branchmap().iteritems() with itervalues() 2013-04-01 20:01:16 -07:00
David Soria Parra
e6d74860f3 shelve: allow shelving of a change with an mq patch applied
We allow shelving of of changes on top of a MQ repository. MQ will
not allow repository changes on top of applied patches. We introduce
checkapplied in MQ to bypass this check.
2013-08-29 09:22:15 -07:00
Pierre-Yves David
9a065a615c mq: extract strip function as its standalone extension (issue3824)
Strip now lives in its own extension

reminder: The extension is surprisingly called `strip`.  The `mq` extension
force the use of the strip extension when its enabled. This is both necessary
for backward compatibility (people expect `mq` to comes with strip) and become
some utility function used by `mq` are now in the strip extension.
2013-09-26 23:57:21 +02:00
Pierre-Yves David
7d361f0e67 strip: move the strip helper function for mq to strip
The next patch finally move the command. No joke! (hey, this is for issue3824)
2013-09-26 23:43:00 +02:00
Pierre-Yves David
c041cca5aa strip: move checklocalchanges from mq to strip
One more step for issue3824.
2013-09-26 23:32:52 +02:00
Pierre-Yves David
c91342584d strip: move checksubstate from mq to strip
One more step for issue3824
2013-09-26 23:12:43 +02:00
Pierre-Yves David
7cc217e108 mq: prepare a strip extension for extraction
Strip will lives in its own extension. The extension is surprisingly called
`strip`. (as discussed in issue3824) The `mq` extension force the use of the
strip extension when its enabled. This will both necessary for backward
compatibility (people expect `mq` to comes with strip) and become some utility
function used by `mq` will move in the strip extension.
2013-09-26 23:10:11 +02:00
Pierre-Yves David
775803a1d5 mq: have the strip command functionnal on repo without mq
This is the last step before being able to extract `strip` in its own extension.
The changes are made in mq to allow a move only extraction without touching a
line of code.
2013-09-25 14:16:51 +02:00
Pierre-Yves David
a85f87aed5 mq: extract mq.queue.strip
It does not depend on `mq.queue` anymore.
2013-09-25 14:07:37 +02:00
Pierre-Yves David
b35e49d479 mq: drop the use of mq.queue.qparent in mq.queue.strip
Same as in the previous changeset, rev is never `None`. We can just copy the two
relevant lines in in `queue.strip`. This help having `queue.strip` independent
from `queue`. One further step toward the extraction of `strip` in an independent
extension. (As discussed in issue3824).
2013-09-25 13:41:43 +02:00
Pierre-Yves David
e78203d763 mq: drop the use of mq.queue.qparent in mq.strip
In this case, rev is never `None`. We can just copy the two relevant lines in
in `strip`. This help having `strip` independent from `queue` one
further step toward its extraction in an independent extension. (As
discussed in issue3824).
2013-09-25 14:10:34 +02:00
Pierre-Yves David
cdfc54ba34 mq: document repo.mq.qparents
The function is not very complex but writing this doc helped me to check if
I got everything right.
2013-09-25 19:34:45 +02:00
Pierre-Yves David
63702d52a8 mq: use the new checklocalchange in the strip command
The strip command never use the `refresh` argument. So we can use the function
we just extracted.
2013-09-25 19:32:53 +02:00
Pierre-Yves David
c66ccb3bbf mq: extract checklocalchanges from mq.queue
The core part of `checklocalchanges` is now mq independent. We can extract it in
a standalone function to help the extraction of `strip` as discussed in issue3824.

A `checklocalchanges` function stay in `mq.queue` with the part related to
"refresh first" messages.
2013-09-25 12:43:14 +02:00
Pierre-Yves David
b30305598b mq: extract checksubstate from the queue class
This function does not need any of the the `mq.queue` method or attributes. It
is indirectly used by the `strip` command. We are trying to extract this command
in a standalone extension as discussed in issue issue3824.
2013-09-25 11:24:43 +02:00
Pierre-Yves David
0f912df18c mq: simplifies the refresh hint in checklocalchanges
The `checklocalchanges` function in the `mq.queue` class takes a `refresh` argument that
changes the error message of raised exception. When refresh is
`True` the exception message is "local changes found, refresh first" otherwise,
the message is just "local changes found".

This changeset is the first of a series that extract `strip` into a standalone
extension (as discussed in issue3824). This `checklocalchanges` function is
indirectly used by the strip command. But in a standalone strip extension the
concept of "refresh first" has no sense. In practice, When used in the context
of the strip commands `refresh`'s value is always `False`.

So my final goal is a be able to extract the `checklocalchanges` logic in a
standalone extension but to keep the part related to "refresh first" in the mq
extension. However the refresh handling is deeply entangled into the
`checklocalchanges` code. It is handled as low a possible at the point we raise
the exception.

So we moves handling of refresh upper in the `checklocalchanges` code. This will
allow the extraction of a simple version in the strip extension while mq can
still inject its logic when needed.

Two helper functions `localchangesfound` and `localchangedsubreposfound` died in
the process they are replaced by simple raise lines.
2013-09-25 12:28:40 +02:00
Matt Mackall
ef33fd3506 merge with stable 2013-09-20 11:47:03 -05:00
Sean Farley
6064a14daf strip: set current bookmark to None if stripped 2013-09-07 15:07:10 -05:00
Brodie Rao
cb4c4b7e31 mq: remove unused repo._committingpatch-related code
This was introduced in f59671804f58 but its usage was removed in
ffd6ded23224.
2013-09-16 01:08:29 -07:00
Augie Fackler
a3022f6834 mq: rename next() to nextpatch() to avoid confusing a future check-code patch
next() is a builtin starting in 2.6, so it's also nice to avoid
shadowing the builtin.
2013-07-25 10:42:36 -04:00
Angel Ezquerra
98ae79f962 mq: update subrepos when applying / unapplying patches that change .hgsubstate
Up until now applying or unapplying a patch that modified .hgsubstate would not
work as expected because it would not update the subrepos according to the
.hgsubstate change. This made it very easy to lose subrepo changes when using
mq.

This revision also changes the test-mq-subrepo test so that on the qpop / qpush
tests. We no longer use the debugsub command to check the state of the subrepos
after the qpop and qpush operations. Instead we directly run the id command on
the subrepos that we want to check. The reason is that using the debugsub
command is misleading because it does not really check the state of the subrepos
on the working directory (it just returns what the change that is specified on a
given revision). Because of this the tests did not detect the problem that this
revision fixes (i.e. that applying a patch did not update the subrepos to the
corresponding revisions).


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1376350710 -7200
#      Tue Aug 13 01:38:30 2013 +0200
# Node ID 60897e264858cdcd46f89e27a702086f08adca02
# Parent  2defb5453f223c3027eb2f7788fbddd52bbb3352
mq: update subrepos when applying / unapplying patches that change .hgsubstate

Up until now applying or unapplying a patch that modified .hgsubstate would not
work as expected because it would not update the subrepos according to the
.hgsubstate change. This made it very easy to lose subrepo changes when using
mq.

This revision also changes the test-mq-subrepo test so that on the qpop / qpush
tests. We no longer use the debugsub command to check the state of the subrepos
after the qpop and qpush operations. Instead we directly run the id command on
the subrepos that we want to check. The reason is that using the debugsub
command is misleading because it does not really check the state of the subrepos
on the working directory (it just returns what the change that is specified on a
given revision). Because of this the tests did not detect the problem that this
revision fixes (i.e. that applying a patch did not update the subrepos to the
corresponding revisions).
2013-08-13 01:38:30 +02:00
Angel Ezquerra
d278e5fc26 mq: look for modified subrepos when checking for local changes
It was possible to apply, unapply, fold, patches (etc) with modified subrepos,
which resulted in surprising behavior. For example it was easy to apply a patch
with a modified subrepo, and then the refresh it and accidentally end up
including the modified subrepo on the refreshed patch.

A test has been added to verify this new check.


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1375742979 -7200
#      Tue Aug 06 00:49:39 2013 +0200
# Node ID a5c90acff5e61aae714ba6c9457d766c54b4f124
# Parent  bacc55ce64d5de9d1eb7fcefccd3829161d5dcf7
mq: look for modified subrepos when checking for local changes

It was possible to apply, unapply, fold, patches (etc) with modified subrepos,
which resulted in surprising behavior. For example it was easy to apply a patch
with a modified subrepo, and then the refresh it and accidentally end up
including the modified subrepo on the refreshed patch.

A test has been added to verify this new check.
2013-08-06 00:49:39 +02:00
Matt Mackall
99270e3bb3 mq: add checkunfinished support (issue3955) 2013-07-25 00:00:47 -05:00
Matt Mackall
8954b4fab8 mq: remove reference to tip 2013-07-11 19:25:44 -05:00
Pierre-Yves David
3defa86817 mq: use an unfiltered property cache for the queue object
The same `queue` object should be used in all situations. This allows to store
global states on the object (like the reworked shelve extension plans to).  The
queue object does not need to be distinct for all possible views (no reference
to the repo/view used at creation time) it's even a bit surprising that mq still
works with the current code.
2013-07-14 17:23:07 +02:00
Bryan O'Sullivan
84ed4f2032 mq: switch to new summary hook mechanism 2013-05-14 11:23:16 -07:00
Simon Heimberg
08371841f9 mq: do not inherit settings form base repo in mqrepo (Fixes issue2358)
This is done by using repo.baseui when creating the queue repo.
2013-04-18 23:53:39 +02:00
Mads Kiilerich
a8db98ea05 spelling: fix typos and spelling errors 2013-04-15 01:37:23 +02:00
Durham Goode
83b3faf2ec strip: make --keep option not set all dirstate times to 0
hg strip -k was using dirstate.rebuild() which reset all the dirstate
entries timestamps to 0.  This meant that the next time hg status was
run every file was considered to be 'unsure', which caused it to do
expensive read operations on every filelog. On a repo with >150,000
files it took 70 seconds when everything was in memory.  From a cold
cache it took several minutes.

The fix is to only reset files that have changed between the working
context and the destination context.

For reference, --keep means the working directory is left alone during
the strip. We have users wanting to use this operation to store their
work-in-progress as a commit on a branch while they go work on another
branch, then come back later and be able to uncommit that work and
continue working.  They currently use 'git reset HARD^' to accomplish
this in git.
2013-03-06 20:13:09 -08:00
Pierre-Yves David
853b87cfc0 mq: comply with filtering when injecting fake tags (issue3812)
mq was injecting fake tags whenever the revisions were accessible
to the filtering level.

This issue impacts hgweb since it's common to have "secret" mq
patches. As secret changesets are filtered by hgweb, the tags
computation could break.
2013-02-11 16:21:48 +01:00
Mads Kiilerich
5787baee50 spelling: fix some minor issues found by spell checker 2013-02-10 18:24:29 +01:00
Mads Kiilerich
4f5178beb0 mq: stabilize update after strip of parent revision
Strip will (if it updates) update to the parent of revs[0], where revs are the
roots of the tree that is stripped.

When revs was list(set) it was thus undefined which root parent it would update
to. With sorted(set) it is at least stable what it updates to. (But it is very
possible that another more useful and predictable behaviour could be defined
... such as updating to the tip-most surviving wd ancestor.)
2013-01-15 02:59:13 +01:00
Mads Kiilerich
2d6545f8b6 subrepos: process subrepos in sorted order
Add sorted() in places found by testing with PYTHONHASHSEED=random and code
inspection.

An alternative to sprinkling sorted() all over would be to change substate to a
custom dict with sorted iterators...
2012-12-12 02:38:14 +01:00
Mads Kiilerich
d913c8547f mq: checktoppatch should only check if p1 is qtip
There is no way qtip in p2 could be used for anything, and there is thus no
reason to check and accept it.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
60f82115fc mq: fix qpop of working directory parent patch when not at qtip
mq assumed that it had to update from qtip to qparent, and instead of updating
from where it was it failed with:
  abort: working directory revision is not qtip
2013-01-15 01:05:12 +01:00
Pierre-Yves David
4dda0af56b mq: drop _cacheabletip usage
Strip have dedicated work around to solve the same problem, strip is even a
fraction faster without that thanks to simpler update process of the branchcache.
2012-12-28 03:42:21 +01:00
Mads Kiilerich
275333d6c9 util: fold ENOENT check into unlinkpath, controlled by new ignoremissing flag
Refactor a common pattern.
2012-12-28 11:55:57 +01:00
Pierre-Yves David
6f3f4215a3 branchmap: simplify _branchtags using a new _cacheabletip method
The current _branchtags method is a remnant of an older, much larger function.
Its only remaining role is to help MQ to alter the version of branchcache we
store on disk. As MQ mutates the repository it ensures persistent cache does not
contain anything it is likely to alter.

This changeset makes explicit the stable vs volatile part of repository and
reduces the MQ specific code to the computation of this limit. The main
_branchtags code now handles this possible limit in all cases.

This will help to extract the branchmap logic from the repository.

The new code of _branchtags is a bit duplicated, but as I expect major
refactoring of this section I'm not keen to setup factorisation function here.
2012-12-20 11:52:50 +01:00
Mads Kiilerich
f53a267ea1 mq: don't fail when removing a patch without patch file from series file 2012-12-09 00:25:21 +01:00
Mads Kiilerich
ac8e1fc147 check-code: there must also be whitespace between ')' and operator
The check pattern only checked for whitespace between keyword and operator.

Now it also warns:
 >     x = f(),7
 missing whitespace after ,
 >     x = f()+7
 missing whitespace in expression
2012-12-09 23:33:16 +01:00
Pierre-Yves David
eef465996b clfilter: mq should not warn about filtered mq patches
MQ warns when qstatus contains unknown nodes. With changelog filtering,
a node may be unknown because it is filtered. Thus, an unfiltered repo
is used for this check.
2012-10-08 20:01:40 +02:00
Pierre-Yves David
53c1ae6f54 clfilter: ensure that mq performs commits on unfiltered repos 2012-10-08 18:02:25 +02:00
Bryan O'Sullivan
469a80b047 mq: don't refer to a random name-captured repo object
Previously, we used a repo object captured at the time of monkeypatching.
2012-11-20 11:52:47 -08:00
Augie Fackler
9766845689 bookmarks: introduce a bmstore to manage bookmark persistence
Bookmarks persistence still showed a fair amount of its legacy as a
monkeypatching extension. This encapsulates all bookmarks
serialization and parsing in a single class, and offers a single
location where other bookmarks storage engines can be substituted
in. As a result, many files no longer import the bookmarks module,
which strikes me as an encapsulation win.

This doesn't do anything to the current bookmark state yet, but I'm
hoping put that in the bmstore class as well.
2012-11-07 16:21:39 -06:00
FUJIWARA Katsunori
536e35fc32 i18n: make column positioning message of MQ summary output translatable
Before this patch, one of column positioning messages of MQ summary
output is not translatable, and patches are always listed up at fixed
column position like below, when patch queue is not empty:

    mq:     1 applied, 1 unapplied

But column positioning messages for other summarized information are
translatable, so other information may be displayed at different
column position on non-English locale environments.

This patch makes column positioning message of MQ summary output
translatable.
2012-10-31 03:59:28 +09:00
FUJIWARA Katsunori
f05ff4243c i18n: add "i18n" comment to column positioning messages of "hg summary"
This comment makes it easier to distinguish such messages from others
for message translators.
2012-10-31 03:59:28 +09:00
Durham Goode
a2ecd990ef mq: fix qrefresh case sensitivity (issue3271)
When calling qrefresh with filenames, the filenames were being
treated as case-sensistive on case-insensitive file systems.
So 'qrefresh foo' would not match file 'Foo', and it failed silently.
This fix makes it work correctly on case-insensitive file systems.

Previously the matching function was applied directly to the filenames.
Now we apply the matching function through repo.status, which handles
the case logic for us. A side effect of using repo.status is that
if the qrefresh file doesn't exist, there is output stating it
doesn't exist.

Adds a test to an existing mq refresh case test.
2012-10-30 13:19:06 -07:00
Siddharth Agarwal
acc48ffd83 url: use open and not url.open for local files (issue3624) 2012-10-17 21:30:08 -07: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
David Soria Parra
fb0ed62638 mq: update bookmarks during qrefresh
Bookmarks are updated during qpop and qpush, but they are not updated
during qrefresh. This behaviour makes it hard to work on an evolving
changeset at the head of a branch. qrefresh should update all bookmarks
that point to the refreshed commit with the new nodeid.
2012-10-01 02:44:46 +02:00
Bryan O'Sullivan
52fd9933cb mq: improve qqueue message with patches applied (issue3036) 2012-10-04 17:00:32 -05:00
Mads Kiilerich
2372d51b68 fix wording and not-completely-trivial spelling errors and bad docstrings 2012-08-15 22:39:18 +02:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Sune Foldager
ffe56435bf peer: introduce peer methods to prepare for peer classes
This introduces a peer method into all repository classes, which currently
simply returns self. It also changes hg.repository so it now raises an
exception if the supplied paths does not resolve to a localrepo or descendant.

Finally, all call sites are changed to use the peer and local methods as
appropriate, where peer is used whenever the code is dealing with a remote
repository (even if it's on local disk).
2012-07-13 21:46:53 +02:00
FUJIWARA Katsunori
54911ad11a mq: check subrepo synchronizations against parent of workdir or other appropriate context
Before this patch, MQ checks each subrepo synchronizations against the
working directory context, so ".hgsubstate" updating is not imported
into MQ revision correctly in cases below:

  - qrefresh when current ".hgsubstate" is already synchronized with
    each subrepos: you can reproduce this easily by just twice or more
    qrefresh invocations

  - qnew just after rollback of commit which updates ".hgsubstate"

This patch resolves this by checking subrepo states against:

  - the parent of "qtop" for qrefresh, or
  - the parent of working context otherwise
2012-06-27 22:03:27 +09:00
FUJIWARA Katsunori
8ecc1d9d04 mq: create patch file after commit to import diff of ".hgsubstate" at qrefresh
Even though the committed revision contains diff of ".hgsubstate", the
patch file created by qrefresh doesn't contain it, because:

  - ".hgsubstate" is not listed up as one of target files of the patch
    for reasons below, so diff of ".hgsubstate" is not imported into
    patch file

      - status of ".hgsubstate" in working directory is usually "clean"
      - ".hgsubstate" is not specified explicitly by users

  - the patch file is created before commit processing which updates
    or creates ".hgsubstate" automatically, so there is no diff for it
    at that time

This patch resolves this problem by:

  - putting ".hgsubstate" into target list of the patch, if needed:
    this allows "patch.diff()" to import diff of ".hgsubstate" into
    patch file.

  - creating the patch file after commit processing:
    this updates ".hgsubstate" before "patch.diff()" invocation.

For the former fixing, this patch introduces "putsubstate2changes()"
to share same implementation with qnew. This is invoked only once per
qnew/qrefresh at most, so there is less performance impact.

This patch also omits "match" argument for "patch.diff()" invocation,
because "patch.diff()" ignores "match" if "changes" is specified.
2012-06-27 22:03:27 +09:00
FUJIWARA Katsunori
fba032044a mq: add ".hgsubstate" to patch target list only if it is not listed up yet
If ".hgsubstate" is already listed up as one of commit targets, qnew
put diff of ".hgsubstate" twice into the patch file stored under
".hg/patches".

It causes rejections at applying such patches.

Other than the case like in added test script, this can also occur
when qnew is executed just after rolling back the committing updated
".hgsubstate".

This patch checks whether ".hgsubstate" is already listed up as one of
commit targets, and put it into the appropriate list only if it is not
listed up yet.
2012-06-27 22:03:22 +09:00
Matt Harbison
79530484c8 mq: defer command wrapping to extsetup (API)
mq wraps all commands that are not in commands.norepo, which is now performed in
this second phase of the extensions setup process.  This goes against the
current best practices on the wiki [1] as far as where command wrapping is
performed, but follows it regarding where global options are injected.

mq needs to be the first layer called when command dispatching in order to
consistently retarget to the patch repo, regardless of the load order of the
extensions.  This means being the last to wrap the command table.  Previously,
'hg <extdiff> --mq' would diff the main repo unless mq was enabled after
extdiff.

[1] http://mercurial.selenic.com/wiki/WritingExtensions
2012-06-08 23:27:59 -04:00
Matt Mackall
61aa1f42b8 merge with stable 2012-06-29 00:40:52 -05:00
Pierre-Yves David
49188ab1f7 strip: update help to state than you can strip public changeset
Multiple people have been confused by it.
2012-06-28 18:39:16 +02:00
Thomas Arendsen Hein
a0b2b2d9c7 strip: add optional -r to synopsis 2012-06-20 16:44:21 +02:00
Thomas Arendsen Hein
833af3cb43 qimport: use [FILE]... because if -r is used no file is needed 2012-06-20 16:43:09 +02:00
Thomas Arendsen Hein
9e0f26649a mq: abort if no files or revisions are specified for qimport 2012-06-20 16:22:58 +02:00
Martin Geisler
456b1eff3c mq: lowercase warning messages 2012-06-12 14:18:18 +02:00
Bryan O'Sullivan
141bd09daa revlog: descendants(*revs) becomes descendants(revs) (API)
Once again making the API more rational, as with ancestors.
2012-06-01 12:45:16 -07:00
Matt Mackall
42a5f1bd45 strip: move bookmark deletion before strip to deal with filecache invalidation 2012-06-01 23:42:27 -05:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Patrick Mezard
0e75723add mq: rename --check into --keep-changes
I named it --check because it felt like qpush & co were checking *more*
things to ensure local changes could not be lost. But it has been
pointed on the mailing list that --check is already used by update
command with a meaning almost opposite to this one. An alternative
was --keep but qfold and qdelete already have such an option to preserve
patch files and qfold may be a candidate for --check.

- qpush/qpop/qgoto --check becomes --keep-changes.
- mq.check becomes mq.keepchanges.
- The short option -c is dropped as -k may conflict with existing
  --keep. The availabilitity of mq.keepchanges should not make this too
  painful.
- Fix minor reST mistake in option description.
2012-05-13 14:00:58 +02:00
David Soria Parra
f8942bb230 strip: introduce -B option to remove a bookmark
Add a -B option to remove a bookmark. All revisions are unreachable
from a different head or a different bookmark will be removed too.

This helps with topic branch workflow. You can create a topic branch
and remove it if not needed anymore with hg strip -B topic/xyz.
2012-05-13 16:39:40 +02:00
Brodie Rao
7f47d4e347 check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
2012-05-13 13:18:06 +02:00
Matt Mackall
05e48d4041 merge with stable 2012-05-13 12:52:24 +02:00
Brodie Rao
a706d64a2c cleanup: replace naked excepts with except Exception: ... 2012-05-12 16:02:46 +02:00
Brodie Rao
c577fac135 cleanup: replace naked excepts with more specific ones 2012-05-12 16:02:45 +02:00
Brodie Rao
92158e04de cleanup: "raise SomeException()" -> "raise SomeException" 2012-05-12 16:00:58 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Patrick Mezard
641ee7d3ba phases: introduce phasecache
The original motivation was changectx.phase() had special logic to
correctly lookup in repo._phaserev, including invalidating it when
necessary. And at other places, repo._phaserev was accessed directly.

This led to the discovery that phases state including _phaseroots,
_phaserev and _dirtyphase was manipulated in localrepository.py,
phases.py, repair.py, etc. phasecache helps encapsulating that.

This patch replaces all phase state in localrepo with phasecache and
adjust related code except for advance/retractboundary() in phases.
These still access to phasecache internals directly. This will be
addressed in a followup.
2012-05-12 00:24:07 +02:00
Patrick Mezard
f06b17a700 mq: introduce mq.check setting
When:

  [mq]
  check = True

is set, qpush, qpop and qgoto behave as if -c/--check were passed. If
incompatible options like -f/--force or --exact are set, this setting is
ignored.

This setting enables what many users expect mq default behaviour to be.
2012-05-12 00:19:30 +02:00
Patrick Mezard
93529cbc7c mq: introduce qgoto --check 2012-05-12 00:19:30 +02:00
Patrick Mezard
b9c8ba9be4 mq: introduce qpush --check
qpush --check let you qpush with uncommitted files not overlapping
patched files.
2012-05-12 00:19:30 +02:00
Patrick Mezard
55a575b59a mq: introduce qpop --check
qpop --check let you qpop with uncommitted files if they do not
intersect with files touched by the popped patches.
2012-05-12 00:19:30 +02:00
Patrick Mezard
22eeeffed3 mq: add --no-backup for qpush/qpop/qgoto 2012-05-11 16:57:26 +02:00
Patrick Mezard
d775dd04bb mq: backup local changes in qpush --force
qpush help says the following about --force:
1- When -f/--force is applied, all local changes in patched files will
   be lost.
2- Apply on top of local changes

In practice, qpush --force will attempt to apply the patch on top of
local changes, and on success will merge them in the pushed patch. On
failure, patched files will contain a mix of local changes (where the
patch could not apply) and a mix of patch changes (were it applied). So,
local changes are less lost than entangled with a mass of other changes.

This patch makes qpush --force backup all locally modified files touched
by the next patch being applied. When multiple patches are being pushed,
this logic is repeated for each patch. Note that modified but
successfully patched files are preserved as well.
2012-05-11 16:18:47 +02:00
Patrick Mezard
b045ed706e mq: backup local changes in qpop --force (issue3433) 2012-05-11 16:17:02 +02:00
Patrick Mezard
2c65c226cf localrepo: add setparents() to adjust dirstate copies (issue3407)
The fix introduced in 3509b9cf8f86 was only partially successful. It is correct
to turn dirstate 'm' merge records into normal/dirty ones but copy records are
lost in the process. To adjust them as well, we need to look in the first
parent manifest to know which files were added and preserve only related
records. But the dirstate does not have access to changesets, the logic has to
moved at another level, in localrepo.
2012-04-29 22:25:55 +02:00
Matt Mackall
4ca25d50f9 merge with stable 2012-04-14 01:39:35 -05:00
Patrick Mezard
bdf6ede885 mq: replace hasattr() with util.safehasattr(), update check-code.py 2012-04-13 15:07:13 +02:00
FUJIWARA Katsunori
8ef345c7b4 mq: use list of already known target files instead of matching object for diff
'hg qnew' passes matching object to 'patch.diff()' to specify target
filenames, and it causes 'dirstate.walk()' via 'repo.status()' in
'patch.diff()'.

but target files are already known before 'patch.diff()' invocation.

to avoid useless 'dirstate.walk()' invocation, this patch uses
'changes' argument to pass already known target files to
'patch.diff()' instead of 'match' argument.

'changes' argument of 'patch.diff()' should have lists for modified,
added and removed files separately, so this patch saves status of
'.hgsubstate' before commit, and put it into appropriate list in
'changes'.
2012-04-05 23:52:55 +09:00
FUJIWARA Katsunori
7902b7f157 mq: use exact matching in the second dirstate walking for efficiency of 'qnew'
'hg qnew' with pattern/-I/-X creates matching object with them, and
uses it twice for 'dirstate.walk()': via 'repo.status()' and
'repo.commit()'.

this may cause full manifest scan in the second 'dirstate.walk()',
even though mq already knows complete target filenames at the first
'dirstate.walk()'.

this patch creates exact matching object also in this case, and use it
at 'repo.commit()' invocation to avoid full manifest scan in the
second 'dirstate.walk()'.

even though 'inclsubs' is added to 'pats' for original matching
object, it is also passed to exact matching object, because
subrepositories are deleted from result of 'dirstate.walk()' at the
end of it.
2012-04-05 23:52:06 +09:00
Mads Kiilerich
08bbe3eb2b mq: fix qpush --move with comments in series file between applied patches
The 'start' variable pointed to qtip in self.series, but it was used for
indexing self.fullseries.

When fullseries had holes and the patch was moved to self.fullseries[start]
it would end up too early in self.series and it could thus not be
found in self.series[start:] and it would crash.

Now the 'fullstart' index in fullseries is found used instead.
2012-03-29 00:35:00 +02:00
Matt Mackall
5a705b3a5d merge with stable 2012-03-30 14:35:06 -05:00
Matt Mackall
7f2dc15daf merge with stable 2012-03-27 14:37:17 -05:00
Pierre-Yves David
a6a8d8d05e qfinish: comply with the phases.new-commit option in secret mode (issue3335)
In secret mode qfinished changeset were move to the draft phase in all case[1]
without regard to phases.new-commit value

This changeset ensure qfinish does not automatically promote a changeset
further than the phases.new-commit value.

Note: This may also result in qfinished changeset made public if
phases.new-commit is set to public.

[1] "In all case" where parent have a compatible phase. Qfinish keep never
    altering phases of changeset not involved in the qfinish.
2012-03-24 12:06:49 +01:00
Matt Mackall
39c1d7334a merge with stable 2012-03-22 17:08:05 -05:00
Matt Mackall
73fcdcd76c strip: ignore -n (issue3326) (BC)
-n could be confused for --dry-run by foolhardy users, resulting in
 permanent data loss.

As leaving a backup when none was requested is significantly less
disastrous, the short option is silently ignored. Old scripts continue
to work, users only get lightly burned.
2012-03-22 17:07:39 -05:00
Matt Mackall
87d3671dbf merge with stable 2012-03-12 17:05:42 -05:00
Wagner Bruna
9653f097ec strip: enhance repair.strip to receive a list of nodes (issue3299)
Originally, mq.strip called repair.strip a single rev at a time.
repair.strip stores in a backup bundle any revision greater than
the revision being stripped, strips, then restores the backup with
repo.addchangegroup. So, when stripping revisions on more than one
topological branch, some could end up being restored from the backup
bundle, only to be later removed by a subsequent repair.strip call.

But repo.addchangegroup calls hooks for all those restore operations.
And 1671d21e8e41 changed it to delay all hook calls until the
repository lock were released - by mq.strip, after stripping all
revisions. Thus, the hooks could be called over revisions already
removed from the repository at that point.

By generating the revision lists at once inside repo.strip, we avoid
calling addchangegroup for temporary restores. Incidentally, this
also avoids creating many backup files for a single strip command.
2012-03-12 17:02:45 -03:00
Matt Mackall
f2a652218a i18n: fix all remaining uses of % inside _() 2012-03-08 13:35:27 -06:00
Patrick Mezard
9d058db6bd mq: fix qapplied --last and qprev documentation (issue3282)
qapplied --last is qprev not qtop.

v2:
- Replace "previous" with "preceding" as suggested here and there
2012-02-27 18:23:18 +01:00
Idan Kamara
01edf134f8 mq: no need to delete undo files after strip
repair.strip takes care of that
2012-03-06 18:43:05 +02:00
Matt Mackall
7f2d6a6af7 merge with stable 2012-03-08 15:59:33 -06:00
Matt Mackall
38ab0032cb merge with stable 2012-02-28 21:17:53 -06:00
Matt Mackall
272058d456 mq: expand qimport summary 2012-02-22 17:41:22 -06:00
Patrick Mezard
3141b1aa35 mq: make qimport --push push all imported patches (issue3130)
Only the first imported one was pushed.
2012-02-14 14:31:40 +01:00
Patrick Mezard
7b9cb90b98 mq: restore _branchtags() fast path (issue3223)
Since c06eb45e85a7, mq saves the nodeid of the first applied patch to
cache/branchheads, which breaks the optimized cache handling introduced in
1808e27e1362. The problem is the revision being committed is appended to
mqrepo.applied after the commit succeeds, which means mqrepo._branchtags()
performs a regular update and write the first applied patch to the branch
cache.

One solution is to set a context variable _committingpatch on the mqrepo while
it is committing a patch and to take it in account when deciding to fast-path
mqrepo._branchtags(). Not really elegant but it works.

The changes to test-mq-caches.t reverse changes introduced by c06eb45e85a7. The
cache should not have been updated with mq records.

The changes to test-keyword.t are indirectly caused by c06eb45e85a7.

Reported and analyzed by Yuya Nishihara <yuya@tcha.org>

Notes:
- qpush still makes a slow path _branchtags() call when checking heads. Maybe
  this can be optimized.
- be careful when merging this patch in default as secretcommit() was renamed
  newcommit() right after the end of the code freeze.
2012-02-07 18:47:16 +01:00
Patrick Mezard
4ddca18cf5 mq: ensure all mq commits are made with secretcommit()
Having a common code path helps fixing things globally.
2012-02-07 18:47:13 +01:00
Patrick Mezard
b7f936bb8a mq: make qprev return the previous applied patch (issue3245)
The current behaviour is to return the previous one in the series but at the
same time the implementation is buggy because it does not take guarded patches
in account.
2012-02-03 19:47:09 +01:00
Patrick Mezard
0b8c39f5e8 mq: fix qnext when all remaining patches are guarded
When all remaining patches are guarded, qnext used to return the last of the
queue anyway.
2012-02-03 19:38:31 +01:00