Commit Graph

916 Commits

Author SHA1 Message Date
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
Pierre-Yves David
55aec6a384 mq: prevent rewriting operation on public changeset
The following operation are denied if the mq changeset is public

* qrefresh
* qpop
* qfold

note: qimport was already denied.
2012-02-01 12:20:10 +01:00
Matt Mackall
cde4dd99cb qpush: avoid trying to manage existing history (issue2218) 2012-01-31 23:13:04 -06:00
Matt Mackall
94245d0910 mq: fix secret description in help 2012-01-30 16:04:14 -06:00
Pierre-Yves David
acf0dc2e27 mq: qimport need wlock for --push - do that after releasing lock
qimport locking was introduced for phases in 2d0f0ea02756.
2012-01-30 17:37:45 +01:00
Pierre-Yves David
13fe947391 qfinish: do not set secret changeset to draft if mq.secret=false
If mq.secret=false, mq should not touch phase
2012-01-30 15:17:08 +01:00
Pierre-Yves David
24ebf577e2 mq: take mq.secret configuration into account when picking the default phase 2012-01-30 17:39:05 +01:00
Pierre-Yves David
7728bdc44c qimport: when mq.secret=True set qimported revision as secret 2012-01-30 17:37:45 +01:00
Pierre-Yves David
d05f57b256 qrefresh: keep changeset phase during refresh 2012-01-30 17:36:30 +01:00
Matt Mackall
f549014354 mq: add secret setting 2012-01-29 12:59:21 -06:00
Matt Mackall
ee1d294b90 merge with stable 2012-02-16 16:40:29 -06:00
Matt Mackall
0d314915f7 merge with stable 2012-02-10 13:47:57 -06:00
Matt Mackall
153d38819f merge with stable 2012-02-03 15:45:13 -06:00
Pierre-Yves David
2e7e0826c5 mq: rename secretcommit to newcommit
This function create secret changeset only when mq.secret is true
2012-01-30 00:05:28 +01:00
Augie Fackler
b7b4c9e86d mq: pass qbase node instead of mq statusentry in phasedefaults
This was breaking my remotebranches extension in a completely
mystifying way, because repo.lookup was failing to resolve the
statusentry. I'm not sure how this works absent my remotebranches
extension, but doing it this way looks more correct and doesn't break
anything.
2012-01-21 21:39:27 -06:00
Pierre-Yves David
f813e53446 mq-safety: don't apply safety on non-outgoing changeset
When mq changeset are secret, they don't appear in outgoing and won't be
pushed. So it's not necessary to abort the push.

The checkpush call is protected by lock to prevent race on phase.
2012-01-20 18:45:29 +01:00
Matt Mackall
dbc9adfaa2 qimport: back out 1b64707da148
This patch presumed mq csets must always be secret, which isn't yet
established.
2012-01-19 11:35:06 -06:00
Pierre-Yves David
e813bac048 qfinish: set all qfinished patch as draft, not only qbase
Fix a silly bug.
2012-01-19 11:30:37 +01:00
Pierre-Yves David
73e1481d91 mq: ensure mq changesets are set to secret when no phase data are found 2012-01-18 17:18:38 +01:00
Pierre-Yves David
c4a53864db mq: qimporting revision set them to secret 2012-01-17 02:26:00 +01:00
Pierre-Yves David
3025e16875 mq: have mq create secret changeset only 2012-01-18 16:53:49 +01:00
Matt Mackall
a7e9cf682f qclone: ignore local qbase if secret 2012-01-18 19:16:01 -06:00
Pierre-Yves David
03d7b0dd77 qclone: add a few comment and blank line
This help readability.
2012-01-18 17:11:27 +01:00
Pierre-Yves David
e5a73a5bfb mq: turn changeset draft on qfinish (except if qparent is secret)
As mq automatically sets changesets as secret, it should make them draft when he
is done with it. We do not move them automatically to draft when we detect that
something else have also set them as secret through their parents.
2012-01-18 17:06:59 +01:00
Mads Kiilerich
b33a1b4058 mq: only save dirty files once when savedirty is called multiple times 2012-01-11 02:29:56 +01:00
Mads Kiilerich
5c89f9299b mq: remove early wlock release in qnew
It seems like something that missed the refactoring in bc2ce38db658.
2012-01-11 02:29:56 +01:00
Mads Kiilerich
b81d19317c mq: use .invalidate to cancel dirty mq state when cancelling transaction
Before the code optimistically relied on savedirty not being called a cancelled
transaction. If it was called it could save incorrect data.

Instead we now start using the invalidate method introduced in 469ecb6e5f24.
2012-01-11 02:29:55 +01:00
Mads Kiilerich
e5b01f05d2 mq: make qsave implementation more explicit
It wasn't obvious from the code how qsave mocked around with .hg/patches and
.hg/patches.? and what was going on.

This makes it more explicit so it will survive future refactorings.
2012-01-11 02:29:55 +01:00
Mads Kiilerich
10f59ac102 mq: consistently use boolean values for dirty flags 2012-01-11 02:28:36 +01:00
Mads Kiilerich
8af4e82c6b mq: minor cleanup 2012-01-11 02:28:12 +01:00
Matt Mackall
0fb748c56c merge with stable 2012-01-09 20:16:57 -06:00
Olav Reinert
16da43099e mq: Document that qdel requires exact patch identifiers 2012-01-06 15:05:51 +01:00
Patrick Mezard
0a3c1ef904 mq: avoid data loss upon qfold + qmv (issue3058)
When renaming a patch A as B where B was previously qfolded into A and
therefore marked as removed, a versioned MQ would first restore B before
marking it as a copy of A, thus losing A changes. The undelete() call is
probably a left-over, wctx.copy() explicitely handles the case where the
destination is removed.

Also note that status command represents "hg rm b; hg mv a b" as:

  A b
    a
  R a

which explains the first hunk in test-mq-qrename.t.
2011-10-20 16:43:31 +02:00
Idan Kamara
68b09c8a1d mq: eliminate explicit checks for file existence 2011-10-14 19:51:46 +02:00
Mads Kiilerich
ab16679cb8 mq: cleanup of lookup - handling of None is not relevant
Patch specifications in mq is passed around as a string or None. None is
generally used when no patch has been specified and there thus is nothing to
lookup and the calling code should do something else. One code path did however
pass None all the way to lookup. That case was handled in lookup, but there was
really need for that, it was undocumented, and it used to cause trouble back
when patches was specified as integers.
2011-10-14 02:50:06 +02:00
Pierre-Yves David
1415969654 phases: prevent mq to qimport immutable change. 2011-12-21 23:47:18 +01:00
Matt Mackall
30c1fc3bf2 mq: add a warning about uncommitted changes for qfinish 2011-11-10 15:40:34 -06:00
Mads Kiilerich
9c69ab7b0b mq: fix corner cases for handling of patch 0 in qselect
Most of the code paths in mq would always pass patch specifications as a
string. Patches can be specified by their index, but one code path passed that
(through pop) to lookup as an integer - all other code paths used a string.

Unfortunately pop and lookup (like many other parts of mq) used the boolean
value of the patch specification to see if it was None, and they would thus
incorrectly handle patch 0 as None.

This patch makes the code comply with the actual internal duck typing of patch
specifications: patch indices must be encoded as strings. The (now) unused code
for partial and thus incorrect handling of indices as integers is removed.
2010-10-31 18:29:56 +01:00
Jordi Gutiérrez Hermoso
b04feda8f3 mq.strip: allow -r option, optionally
Other commands let -r to be used for revisions, so just for syntactic
consistency, it's nice to have it for strip as well
2011-09-20 15:02:00 -05:00
Dan Villiom Podlaski Christiansen
17d62d70d3 mq: split up overly long line 2011-09-11 18:49:54 +02:00
Dan Villiom Podlaski Christiansen
2d65fa6cd1 mq: don't suppress patch tracebacks when applying patches 2011-09-11 18:49:38 +02:00
Greg Ward
bc1dfb1ac9 atomictempfile: make close() consistent with other file-like objects.
The usual contract is that close() makes your writes permanent, so
atomictempfile's use of close() to *discard* writes (and rename() to
keep them) is rather unexpected. Thus, change it so close() makes
things permanent and add a new discard() method to throw them away.
discard() is only used internally, in __del__(), to ensure that writes
are discarded when an atomictempfile object goes out of scope.

I audited mercurial.*, hgext.*, and ~80 third-party extensions, and
found no one using the existing semantics of close() to discard
writes, so this should be safe.
2011-08-25 20:21:04 -04:00
Yann E. MORIN
f490431880 mq/qqueue: print current queue name
Add an option to qqueue to print only the name of the current queue.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-07-29 20:26:52 +02:00
Augie Fackler
fdd2f9d735 globally: use safehasattr(x, '__call__') instead of hasattr(x, '__call__') 2011-07-25 16:24:37 -05:00
Idan Kamara
73a82e0b84 backout of a52e14fe37fb: allow to qpop/push with a dirty working copy
The new behavior was breaking existing tools that relied on a sequence such as
this:

1) start with a dirty working copy
2) qimport some patch
3) try to qpush it
4) old behavior would fail at this point due to outstanding changes.
   (new behavior would only fail if the outstanding changes and the patches
   changes intersect)
5) innocent user qrefreshes, gets his local changes in the imported patch

It's worth considering if we can move this behavior to -f in the future.
2011-06-24 23:25:42 +03:00
Matt Mackall
5ab97592f7 scmutil: switch match users to supplying contexts
The most appropriate context is not always clearly defined. The obvious cases:

For working directory commands, we use None
For commands (eg annotate) with single revs, we use that revision

The less obvious cases:

For commands (eg status, diff) with a pair of revs, we use the second revision
For commands that take a range (like log), we use None
2011-06-18 16:52:51 -05:00
Idan Kamara
1a9dd17406 mq: use ui.fin when importing patch from '-' 2011-06-08 14:54:52 +03:00
Idan Kamara
4f72223e4d cmdutil, logmessage: use ui.fin when reading from '-' 2011-06-08 14:54:52 +03:00
Yuya Nishihara
6cb9c38b6d mq: make qrefresh/qfold keep wlock until saving patch status
Because q.refresh() changes nodeid, .hg/patches/status gets invalid until
q.savedirty(). This patch changes mq not to unlock repository of incomplete
state.
2011-06-15 01:50:49 +09:00
Idan Kamara
68a8ad822b mq: catch correct exception when calling changelog.rev() 2011-06-12 23:30:39 +03:00
Adrian Buehlmann
78057a0d0f mq: rename abort_if_wdir_patched to abortifwdirpatched 2011-06-13 13:53:58 +02:00
Adrian Buehlmann
d3203ca1e7 mq: rename partial_name to partialname 2011-06-13 13:48:47 +02:00
Adrian Buehlmann
49d1864937 mq: rename write_list to writelist 2011-06-13 13:47:21 +02:00
Adrian Buehlmann
2e1cbd3d6d mq: rename series_dirty to seriesdirty 2011-06-13 13:45:48 +02:00
Adrian Buehlmann
15894cb481 mq: rename applied_dirty to applieddirty 2011-06-13 13:44:34 +02:00
Adrian Buehlmann
fc52238182 mq: rename guards_dirty to guardsdirty 2011-06-13 13:43:03 +02:00
Adrian Buehlmann
a91ab088dd mq: rename active_guards to activeguards 2011-06-13 13:41:58 +02:00
Adrian Buehlmann
c2841bd2c6 mq: rename guards_path to guardspath 2011-06-13 13:40:35 +02:00
Adrian Buehlmann
7830664889 mq: rename status_path to statuspath 2011-06-13 13:39:14 +02:00
Adrian Buehlmann
f6a797789d mq: rename series_path to seriespath 2011-06-13 13:38:04 +02:00
Adrian Buehlmann
75d2af97af mq: rename series_end to seriesend 2011-06-13 12:11:49 +02:00
Adrian Buehlmann
65422d1bc9 mq: rename full_series_end to fullseriesend 2011-06-13 12:09:29 +02:00
Adrian Buehlmann
9ac1360c75 mq: rename check_reserved_name to checkreservedname 2011-06-13 12:07:46 +02:00
Adrian Buehlmann
a7057a1a42 mq: rename check_localchanges to checklocalchanges 2011-06-13 12:06:32 +02:00
Adrian Buehlmann
87dca9fb58 mq: rename check_substate to checksubstate 2011-06-13 12:05:20 +02:00
Adrian Buehlmann
ea872e336a mq: rename check_toppatch to checktoppatch 2011-06-13 12:03:38 +02:00
Adrian Buehlmann
24dfc6dc4d mq: rename save_dirty to savedirty 2011-06-13 12:02:14 +02:00
Adrian Buehlmann
00a5574158 mq: rename explain_pushable to explainpushable 2011-06-13 12:00:56 +02:00
Adrian Buehlmann
4dce24691d mq: rename set_active to setactive 2011-06-13 11:59:35 +02:00
Adrian Buehlmann
ceb9dac69c mq: rename set_guards to setguards 2011-06-13 11:58:16 +02:00
Adrian Buehlmann
ac8c95ba7d mq: rename check_guard to checkguard 2011-06-13 11:57:21 +02:00
Adrian Buehlmann
2689b8a7ea mq: rename parse_series to parseseries 2011-06-13 11:55:46 +02:00
Adrian Buehlmann
323edaf5bd mq: rename find_series to findseries 2011-06-13 11:54:25 +02:00
Adrian Buehlmann
7ec3827482 mq: rename series_guards to seriesguards 2011-06-13 11:40:27 +02:00
Adrian Buehlmann
6eb8082b17 mq: rename full_series to fullseries 2011-06-13 11:06:11 +02:00
Patrick Mezard
6aaca90508 patch: turn patch() touched files dict into a set 2011-06-11 14:14:11 +02:00
Peter Arrenbrecht
d836ee3cea hg: add opts argument to clone for internal remoteui 2011-06-08 18:24:33 +02:00