Commit Graph

916 Commits

Author SHA1 Message Date
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
Patrick Mezard
f99a853422 localrepo: add savecommitmessage() to write last-message.txt 2011-06-04 15:56:48 +02:00
Idan Kamara
69cc9dd98e mq: no need to make a copy of seriesopts
the command decorator takes care of copying the
options (introduced in a1338167b2ad)
2011-05-30 21:44:03 +03:00
Martin Geisler
57e33178d6 mq: print "'foo' 'bar'", not "['foo', 'bar']" when showing guards
The internal list representation of guards was leaking into the
output. The guards were always printed using repr(guard) and that
style was kept.

When "hg qguard -l" prints several guards for a patch, it does so by
joining the names with " " and that style was used for the error
messages too.
2011-05-31 08:47:16 +02:00
Idan Kamara
1c58f33fac mq: allow --mq for qrecord 2011-05-27 17:49:54 +03:00
Matt Mackall
c6e850b04b context: make forget work like commands.forget
Switch users of wctx.delete(..., False) to forget.
2011-05-26 17:15:35 -05:00
Matt Mackall
97c6e7b48d dirstate: rename forget to drop
It has substantially different semantics from forget at the command
layer, so change it to avoid confusion.

We can't simply combine it with remove because we need to explicitly
drop non-added files in some cases like commit.
2011-05-26 17:15:35 -05:00
Idan Kamara
91b788592f record: check patch name is valid before prompting in qrecord 2011-05-24 19:17:02 +03:00
Idan Kamara
9f1caed9d1 mq: use checkpatchname
This also fixes a bug where qrename would allow
renaming a patch to a reserved name.
2011-05-24 19:16:51 +03:00
Idan Kamara
d59ad12260 mq: wrap patch file name checks in a function 2011-05-24 19:16:51 +03:00
Idan Kamara
e6848b9ffb mq: strip all leading slashes from url when importing
When trying to import a url that ends with a slash
os.path.basename() would return an empty string. So
when seeing a leading slash, remove it and infer the
patch name from the remaining url.

e.g. `hg qimport http://paste.pocoo.org/raw/xxx/`
deduced '.' to be the patch name. Now we'll deduce 'xxx'.
2011-05-20 21:20:24 +03:00
Idan Kamara
34655369cc mq: check patch name is valid before reading imported file 2011-05-20 21:19:33 +03:00
Patrick Mezard
78738c3822 patch: remove patch.patch() cwd argument 2011-05-19 22:44:01 +02:00
Patrick Mezard
42f681d4d9 patch: add lexists() to backends, use it in selectfile()
At this point, all applydiff() filesystem calls should pass through fsbackend.
2011-05-17 23:46:38 +02:00
Matt Mackall
0832007f60 scmutil: drop aliases in cmdutil for match functions 2011-05-13 14:58:24 -05:00
Matt Mackall
cf07129983 scmutil: move revsingle/pair/range from cmdutil
This allows users at levels below the command layer to avoid import loops.
2011-05-13 14:06:28 -05:00
Martin Geisler
0edbd90511 mq: use cmdutil.command decorator 2011-05-12 14:25:08 +02:00
Matt Mackall
81206f7383 check-code: complain about set.isdisjoint 2011-05-08 11:39:24 -05:00
Patrick Mezard
e0378ee5bd patch: make patch()/internalpatch() always update the dirstate 2011-05-08 17:48:31 +02:00
Patrick Mezard
88e958194e patch: move updatedir() from cmdutil into patch
Also, create an artificial wdutil.py to avoid import cycles between patch.py
and cmdutil.py.
2011-05-08 17:48:30 +02:00
Patrick Mezard
2ab321beb7 mq: explicitly updatedir() even if patch() fails
It already works that way in practice, and we intend to merge updatedir() into
patch().
2011-05-08 17:48:29 +02:00
Idan Kamara
707c7fe40d mq: allow to qpop/push with a dirty working copy (issue2780)
It's safe to do so if the sets of changed files in the
working copy and patches are disjoint.
2011-05-06 19:55:46 +03:00
Idan Kamara
28e4be21c2 mq: don't hide the patch module 2011-05-06 19:03:45 +03:00
Idan Kamara
ea58266774 mq: loosen except clause when reading patch headers 2011-05-06 18:45:12 +03:00
Idan Kamara
7489f95c93 mq: add a 'mq()' revset predicate that returns applied mq csets 2011-05-06 16:07:35 +03:00
Idan Kamara
64876670a4 mq: don't suggest to refresh when qpushing with no applied patches 2011-05-04 23:12:23 +03:00
Matt Mackall
bf126992e1 merge with stable 2011-05-03 22:04:23 -05:00
Kevin Bullock
a19d7654b7 mq: strip extra whitespace from node ids in header (issue2790)
This makes `hg qpush --exact` work with patches created by `hg export`.
2011-05-03 11:46:02 -05:00
timeless
4f44952021 remove unused variables 2011-05-01 17:20:40 +02:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00
Idan Kamara
856702f469 mq: add '.' and '..' to list of forbidden patch names
When an empty string is being passed to normname
it would return '.' causing checkfile() to always
return that a patch with that name exists.
2011-04-29 22:21:13 +03:00
timeless@gmail.com
4f2e8b67dc mq: fix qselect help for qguard 2011-03-29 16:45:23 +03:00
Stefano Tortarolo
d1da6cf615 mq: fix typo in docstring 2011-03-15 14:55:16 +01:00
Idan Kamara
6862ebb98f mq: be more explicit on invalid patch name message 2011-04-29 22:21:13 +03:00
Matt Mackall
3b61150db3 merge with stable 2011-04-30 03:44:31 -05:00
Patrick Mezard
5457fb5aec strip: make it clear that --force discards changes (issue310) 2011-04-29 14:56:23 +02:00
Pierre-Yves David
7b3f2de931 mq: prevent traceback when qfinish patches not in series.
When mq status entry referencing a patches that is not in series  `hg qfinish
-a` used to issue a traceback. This states is inconsistent but might happen
regularly when people misuse hg up -mq.

This changeset prevent hg from crashing. The faulty entry is finished anyway and
a warning is issued.
2011-04-25 14:03:12 +02:00
Adrian Buehlmann
cf126bb7dd move opener from util to scmutil 2011-04-20 19:54:57 +02:00
Matt Mackall
a8dd64dcb0 misc: replace .parents()[0] with p1() 2011-04-04 16:21:59 -05:00
Martin Geisler
0b9696bd15 merge with stable 2011-03-29 16:25:48 +02:00
Martin Geisler
f881346b4c mq: do not let qrefresh write bad patch 2011-03-13 16:18:46 +01:00
Martin Geisler
3334dc51b6 mq: forbid commit of merge involving mq patches 2011-03-02 14:09:06 +01:00
Matt Mackall
d0fa4e0180 mq: fix qpush recursion in _findtags when status file is wrong (issue2664)
test from timeless to guard against regressing this
2011-02-28 17:41:40 -06:00
Pierre-Yves David
fa5d7584dd mq: gracefully handle malformated status file
This patch prevent mq to crash when .hg/patches/status contains Malformed lines
(without ":"). Blank lines are ignored and other malformed lines issue a
warning.
2011-02-11 13:10:39 +01:00
André Sintzoff
d724f20ddb mq: remove undo after a qimport 2011-02-15 20:02:52 +01:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Steve Borho
4d71f24e4c merge with stable 2011-02-14 14:12:48 -06:00
Afuna
acdbba3dff mq: catch attempt to qpush to an earlier patch (issue2587)
We can't assume that all pushable patches early in the series have already been
applied. If a hg qselect is done while you already have patches applied, some
patches with guards may now be pushable, even though they come earlier in the
series.

So instead of checking only applied patches, explicitly check where we are in
the series against the position of the patch we want to qpush to.
2011-02-12 16:08:41 +08:00
Patrick Mezard
7700d1350b mq: factor out push conditions checks
Some extensions (e.g. hgsubversion) completely override push command. Because
extensions load order is unspecified, if hgsubversion loads before mq, mq
checks about not pushing applied patches will be bypassed. Short of finding a
way to fix load order, extracting the checking logic will allow
hgsubversion-like extensions to run the check themselves.
2011-01-31 22:16:33 +01:00
Matt Mackall
6c9be0381b mq: avoid using revlog.nodemap unnecessarily 2011-01-11 17:06:07 -06:00
Adrian Buehlmann
721e368ac1 rename util.unlink to unlinkpath 2011-01-02 19:34:41 +01:00
Steve Borho
4ef6c62600 mq: record more data in patchheader class (no behavior changes)
* parse branch and nodeid header lines
* remember the line number where diffs started

Combined, these make mq.patchheader() very useful for parsing and
preserving a patch header through edits. TortoiseHg will use the
nodeid and parent to display these header datums in the graph when
patches are unapplied, and uses diffstartline to parse patch files
using record.parsepatch().
2010-12-31 17:09:38 -06:00
Matt Mackall
49ec3df937 merge with stable 2011-01-01 18:42:04 -06:00
Jacek Sowiński
d5b7a5d84f strip: typo bugfix related to '--nobackup -> --no-backup' rename (issue2377)
'--no-backup' in cmdline means *'no_backup'* in code'
2010-12-31 15:14:51 +01:00
Kevin Bullock
5c61f5f136 mq: update .hgsubstate if subrepos are clean (issue2499)
This patch prevents MQ from creating an inconsistent subrepo state. If
the .hgsub file has been changed, and none of the subrepos have
uncommitted changes, creating or updating a patch (using qnew, qrefresh,
or qrecord) will update .hgsubstate accordingly.

If any subrepos _do_ have uncommitted changes, qnew/qrefresh/qrecord
will abort.

Thanks to pmezard for proposing this solution.
2010-12-07 22:14:43 -06:00
Kevin Bullock
ed11f126c8 backout 0880564992de 2010-12-07 22:14:43 -06:00
Kevin Bullock
79f5039252 mq: ignore subrepos (issue2499)
If MQ allows modifying .hgsub or .hgsubstate in a patch, it can easily
lead to an inconsistent subrepo state. This patch prevents qrefresh from
adding any modifications to .hgsub or .hgsubstate to a patch. The user
is warned that these files are not included in the patch.

The tests test both the slightly irrational and the pathological cases.
2010-11-16 13:06:07 -06:00
Martin Geisler
02c90a666d qnew: distinguish between existing file and directory (issue2464) 2010-10-29 14:06:06 +02:00
Martin Geisler
3bd0773df5 qnew: give better feedback when doing 'hg qnew foo/' (issue2464) 2010-10-29 15:25:21 +02:00
Patrick Mezard
1ba47f6d3d mq: qrename should not touch the dirstate if src is untracked (issue2460) 2010-10-28 22:04:33 +02:00
Thomas Arendsen Hein
6fd4e6aaec coding style: fix gratuitous whitespace after Python keywords 2010-12-03 11:30:45 +01:00
Matt Mackall
8e2f7d14eb merge with stable 2010-11-22 13:11:46 -06:00
Steve Losh
72ee3af1d8 mq: add an '-e/--exact' option to qpush
This patch adds an '--exact/-e' option to qpush that will try to push the
patches in the correct location in the DAG.  Specifying this option does the
following:

* If --move is specified, abort. It makes no sense to move a patch to the front
  of the queue and try to apply it to its parent, because its parent is one of
  the patches we just moved it in front of!
* If patches are already applied, abort. We don't want patch changesets
  scattered throughout the DAG.
* If local changes are present, abort unless --force is used, as usual.
* Find the first patch we're going to push (if we're pushing multiple patches
  with a target or --all).
* If that patch doesn't have a parent, abort, obviously.
* If the parent doesn't exist in the repo, abort.  Something is wrong.
* Update to the parent, then continue pushing the patches as normal.
2010-11-17 21:18:44 -05:00
Martin Geisler
6a3d9310ab code style: prefer 'is' and 'is not' tests with singletons 2010-11-22 18:15:58 +01:00
Martin Geisler
8e20190ebb mq: fix comment to reflect change in 900672e7d1f7 2010-11-17 09:06:38 +01:00
Kevin Bullock
fb0785e3d1 mq: clean up unused variable in qrefresh
Removes the unused variable `aa2` that holds the list of deleted files
returned from repo.status().
2010-11-16 13:06:04 -06:00
Nicolas Dumazet
f4ae25089e mq: use sets instead of lists for speed
The code eventually converts data through sets to ensure unicity:
do it earlier to allow faster __contains__ lookups and avoid
`del l[l.index(x)]` kind of code.
2010-11-07 22:03:28 +09:00
Martin Geisler
41f0f0af10 mq: expand 'repo' -> 'repository' in error message 2010-10-26 18:01:35 +02:00
Martin Geisler
79f93adec2 mq: mark strings that should not be translated 2010-10-26 17:59:21 +02:00
timeless
788c88e3ef qrestore: trying to improve the English 2010-10-26 14:41:58 +03:00
Wagner Bruna
ac73474eb7 mq: mark string for i18n 2010-10-20 12:29:55 -02:00
Wagner Bruna
e934c64ad0 strip: support revision sets 2010-10-18 18:31:38 -02:00
Erik Zielke
69888281fd mq: switched to `` around * * *
So it can be parsed by rst.
2010-10-18 14:37:50 +02:00
Augie Fackler
42c8b2cf07 termwidth: move to ui.ui from util 2010-10-10 10:06:36 -05:00
Augie Fackler
35723d1610 strip: add --keep flag to avoid modifying wc during strip
Fixes issue1564.
2010-10-09 11:02:11 -05:00
Dan Villiom Podlaski Christiansen
cf9291fa61 mq: silence spurious output.
When using a versioned patch repository, you would get a spurious
warning when deleting and adding the same patch.

Before:

  $ hg qdelete --keep 3.diff
  $ hg qimport --existing 3.diff
  adding 3.diff to series file
  3.diff already tracked!

After:

  $ hg qdelete --keep 3.diff
  $ hg qimport --existing 3.diff
  adding 3.diff to series file
2010-10-09 11:53:48 -05:00
Dan Villiom Podlaski Christiansen
f7370d289b mq: handle deleting the same patch twice in one command (issue2427) 2010-10-09 10:36:50 -05:00
Erik Zielke
e46861ba72 mq: Removed extra ... in short help for qdelete
Update to d7d43954f372, which left a ... too much, after removing
-r [REV]
2010-09-30 12:37:45 +02:00
Erik Zielke
0e2a10ee21 mq: removed short option in help for deprecated options
Removed help for deprecated short option for:
  -n NAME for qpush
  -n NAME for qpop
  -r REV for qdelete|qremove|qrm
2010-09-27 11:27:58 +02:00
Mads Kiilerich
bf24a5099a mq: explain qpush -f better 2010-09-29 01:32:50 +02:00
Erik Zielke
9f22da182d mq: removed return from callers to patchheader.qseries
Some callers to patchheader.qseries returned the value
further, but pathcheader.qseries does not explicitly
return anything. It was confusing this was returned
further
2010-09-23 15:18:10 +02:00
Erik Zielke
f65e38950f mq: added return 0 on success
I have added return 0 on success in docstrings of
the different not deprecated mq commands.
2010-09-23 16:56:32 +02:00
Martin Geisler
1bb28d1ed3 merge with stable 2010-09-27 10:20:19 +02:00
Erik Zielke
0c1276bb2d mq: removed -m from qpush help (Issue2401)
The -m option became deprecated in changeset 1e63d4dee4f6,
but the option still appeared in the help line for the qpush
command
2010-09-27 09:19:48 +02:00
Patrick Mezard
23ced90ea0 mq: always require --force when pushing patches (issue2363)
--force was not necessary when passing --rev since cb494d252290, but this
behaviour is usually harmful when branch names are passed instead of explicit
revisions.
2010-09-22 23:51:10 +02:00
Dan Villiom Podlaski Christiansen
4a1790f181 mq: fix the deprecation comment for qsave & qrestore.
Changeset 1e63d4dee4f6 deprecated qsave and qrestore. In the
deprecating comment, users were referred to 'rebase --mq' which -- at
the time the message was written -- didn't exist. Currently, on the
default branch, rebase *does* take a '--mq' option, but it probably
doesn't do what Dirkjan expected it to do when he wrote the message.

In the original, deprecating commit, little context was provided as to
why this change was made. Based on my recollection, concensus at the
Paris Sprint in February 2010 was that one of the problems with MQ was
that it exposed far too many commands. Notable among these were qsave
& qrestore: very few core developers understood what they did and even
fewer (none, IIRC) actually used them. However, they couldn't be
removed; not only do the usual backwards compatibility reasons apply,
but the hg book refers to them.
2010-09-20 13:31:02 +02:00
Patrick Mezard
979ccf4590 Use lexists() instead of exists() where appropriate 2010-09-20 21:46:56 +02:00
Erik Zielke
c732a9771b Use note admonition 2010-09-22 16:23:55 +02:00
Matt Mackall
b05cd46be9 merge with stable 2010-09-22 18:29:41 -05:00
Matt Mackall
6b5c5e35ef merge with stable 2010-09-20 16:56:57 -05:00
Patrick Mezard
614db673f4 Merge with stable 2010-09-20 22:29:13 +02:00
Christian Ebert
e3631413e0 mq: rename strip --nobackup option to --no-backup (issue2377)
Same option name as for hg revert --no-backup.
Deprecate strip --nobackup.
2010-09-14 22:11:53 +02:00
Christian Ebert
3cef19604e mq: consistently use opts.get() to prevent potential KeyError 2010-09-14 22:11:46 +02:00
Martin Geisler
112ea7d5ed patch: break import cycle with cmdutil
The patch module imported cmdutil but used it only in updatedir.
2010-09-13 13:08:09 +02:00
Patrick Mezard
de8b1fa045 mq: add newline after qfold warning 2010-09-10 22:36:04 +02:00
Martin Geisler
5f46f16fb7 Lowercase error messages 2010-08-29 22:37:58 +02:00
Martin Geisler
cb36142754 Merge with stable 2010-08-29 22:55:37 +02:00
Brodie Rao
0f9d940cb9 cleanup: remove unused variables 2010-08-27 13:32:40 -04:00
Dan Villiom Podlaski Christiansen
5e79668de4 mq: extend support for the --mq argument to extension commands
This allows commands like `purge' to accept the --mq option.
2010-08-13 16:05:08 +02:00
Matt Mackall
eef168b604 merge with stable 2010-08-19 10:25:41 -05:00
Mads Kiilerich
b27d1fd3b8 mq: don't inherit default and default-push paths with --mq (issue2333)
Configuration from the outer repo is inherited to the patches repo when --mq is
used.

In case the patches repo only has paths.default configured but the outer repo
has paths.default-push then the inherited default-push will win. Very
confusing.

Inheriting the default paths is however wrong in all sane cases, so now we
explicitly remove them.
2010-08-18 02:43:45 +02:00