Commit Graph

772 Commits

Author SHA1 Message Date
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
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