Commit Graph

5233 Commits

Author SHA1 Message Date
Laurent Charignon
901d6a2088 rebase: better error message when rebased changes are all in destination
Before this patch, when rebasing a set of obsolete revisions that were plain
pruned or already present in the destination, we were displaying:

abort: no matching revisions

This was not very helpful to understand what was going on, instead we replace
the error message by:

abort: all requested changesets have equivalents or were marked as obsolete
(to force the rebase, set the config experimental.rebaseskipobsolete to False)
2015-12-29 15:32:12 -08:00
timeless
303f2b32c3 histedit: handle exceptions from node.bin in fromrule 2015-12-23 23:51:29 +00:00
timeless
2e291bf611 histedit: limit cleanup of histedit-last-edit.txt to success 2015-12-23 23:23:28 +00:00
timeless
f32fa41604 histedit: use parse-error exception for parsing 2015-12-27 03:33:09 +00:00
timeless
81170df509 histedit: limit mentioning histedit-last-edit.txt
Before histedit-last-edit.txt would be mentioned for any failure.
After, it should only be mentioned for failures relating to user
input.
2015-12-11 07:08:09 +00:00
timeless
d96f3f0401 histedit: check fold of public change during verify 2015-12-28 22:53:22 +00:00
timeless
9a911bf754 histedit: pass previous action to verify 2015-12-28 22:52:48 +00:00
Bryan O'Sullivan
dd14bb51a5 histedit: don't bother with cPickle, demand-load pickle
We're unlikely to ever need the pickle module, so there's no good
reason to force loading of its faster cousin.
2015-12-23 16:22:20 -08:00
Matt Mackall
798e034a3c merge with stable 2015-12-28 10:11:48 -06:00
Bryan O'Sullivan
9c2d540690 histedit: only use pickle if not using the modern save format
This avoids a case where PyPy's cPickle module throws a more confusing
error than CPython's.
2015-12-27 23:55:54 +09:00
Bryan O'Sullivan
cf9489897c eol: make output stable
This eliminates a divergence in behaviour between PyPy and Python.
2015-12-27 23:55:54 +09:00
FUJIWARA Katsunori
4d3a0ec7d1 mq: use fallback patch name if no alpha-numeric in summary line (issue5025)
Before this patch, "hg qimport -r REV" fails, if the summary line of
description of REV doesn't contain any alpha-numeric bytes.

In this case, all bytes in the summary line 'title' are dropped from
'namebase' by the code path below.

     namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_')

'makepatchname()' immediately returns this empty string as valid patch
name, because patch name conflicting against empty string never
exists.

Then, "hg qimport -r REV" is aborted at creation of patch file with
empty filename.

This situation isn't so rare. For example, ordinary texts in Japanese
often consist of non alpha-numeric bytes in UTF-8.

This patch makes 'makepatchname()' use fallback patch name if the
summary line of imported revision doesn't contain any alpha-numeric
bytes.
2015-12-23 22:28:52 +09:00
timeless
32124ab7e3 rebase: mention conflict in documentation instead of merge 2015-12-18 18:32:15 +00:00
timeless
a11d42f514 rebase: simplify documentation about heads 2015-12-18 18:31:45 +00:00
timeless
99e9c1b2d0 rebase: simplify documentation about --keep
Also include a warning about bookmarks
2015-12-18 18:22:03 +00:00
timeless
30016e92bc rebase: simplify documentation about selecting commits to rebase 2015-12-18 18:24:41 +00:00
timeless
16c4277abb rebase: simplify documentation about public commits
add reference to graft
2015-12-18 18:06:43 +00:00
timeless
4d95bd2b9d histedit: add progress support 2015-12-18 06:19:22 +00:00
Mateusz Kwapich
011f0f625e histedit: delete to drop
The default behaviour to forbid this makes a lot of sense for novice users
because it's safeguarding them from dangerous behavior but making it
configurable will be apprieciated by power users in at least one big
organization.

It allows an user to look an histedit rules from declarative perspective and
make the rules reflect the state after histedit.  If we can move lines t move
commits why can't we drop lines to drop commits?

Let's put this behind config knob and inform users about this feature the very
moment they are trying to use it so they can choose desired behaviour.
2015-12-15 13:27:09 -08:00
Mathias De Maré
0e11ed0ee2 clonebundles: fix bundlespec typo 2015-12-16 12:33:54 +01:00
timeless
2abe9172f6 histedit: omit useless message from update (edit)
specifically:
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2015-12-14 23:04:17 +00:00
timeless
26fb25b6cd histedit: omit useless message from update (_histedit)
specifically:
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2015-12-14 22:37:31 +00:00
timeless
5551448efc histedit: omit useless message from update (histeditaction)
specifically:
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2015-12-14 21:43:16 +00:00
timeless
0853af047a histedit: omit useless message from abort
specifically:
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2015-12-14 22:08:14 +00:00
liscju
ab17d6f05d rebase: add returning value from pullrebase function
So far pullrebase function has always returned None value, no matter
what orig function returned. This behaviour made impossible for
pull to change returned value from mercurial process (it has always
ended with 0 value by default). This patch makes pullrebase returning
with returned value from orig.
2015-11-15 22:18:48 +01:00
FUJIWARA Katsunori
3536b81882 share: wrap bmstore._writerepo for transaction sensitivity (issue4940)
4bc805f938a0 made 'bmstore.write()' transaction sensitive, to restore
original bookmarks correctly at failure of a transaction.

For example, shelve and unshelve imply steps below:

  before 4bc805f938a0:
    1. move active bookmark forward at internal rebasing
    2. 'bmstore.write()' writes updated ones into .hg/bookmarks
    3. rollback transaction to remove internal commits
    4. restore updated bookmarks manually

  after 4bc805f938a0:
    1. move active bookmark forward at internal rebasing
    2. 'bmstore.write()' doesn't write updated ones into .hg/bookmarks
       (these are written into .hg/bookmarks.pending, if external hook
       is spawn)
    3. rollback transaction to remove internal commits
    4. .hg/bookmarks should be clean, because it isn't changed while
       transaction running: see (2) above

But if shelve or unshelve is executed in the repository created with
"shared bookmarks" ("hg share -B"), this doesn't work as expected,
because:

  - share extension makes 'bmstore.write()' write updated bookmarks
    into .hg/bookmarks of shared source repository regardless of
    transaction activity, and

  - intentional transaction failure at the end of shelve/unshelve
    doesn't restore already updated .hg/bookmarks of shared source

This patch makes share extension wrap 'bmstore._writerepo()' instead
of 'bmstore.write()', because the former is used to actually write
bookmark changes out.
2015-11-13 02:36:30 +09:00
Javi Merino
65fb643f36 clonebundles: fix typo s/comand/command/ 2015-11-05 10:31:20 +00:00
Gregory Szorc
61b9ffeec8 wireproto: move clonebundles command from extension (issue4931)
The SSH peer class accesses wireproto.commands[cmd] as part of encoding
command arguments. Previously, the wire protocol command was defined in
the clonebundles extension. If the client didn't have this extension
enabled (which it likely doesn't since it is meant as a server-side
extension), then clients attempting to clone via ssh:// would get a
crash due to a KeyError accessing wireproto.commands['clonebundles']
when cloning from a server that is advertising clone bundles.

Moving the definition of the wire protocol command to wireproto.py makes
this problem go away.

A side effect of this code move is servers will always respond to
"clonebundles" wire protocol command requests. This should be fine: the
server will return an empty response unless a clone bundles manifest
file is present and clients shouldn't call the command unless the server
is advertising the capability, which only happens if the clonebundles
extension is enabled and the manifest file exists.
2015-11-03 12:31:33 -08:00
FUJIWARA Katsunori
f850c84e84 localrepo: discard objects in _filecache at transaction failure (issue4876)
'repo.invalidate()' deletes 'filecache'-ed properties by
'filecache.__delete__()' below via 'delattr(unfiltered, k)'. But
cached objects are still kept in 'repo._filecache'.

    def __delete__(self, obj):
        try:
            del obj.__dict__[self.name]
        except KeyError:
            raise AttributeError(self.name)

If 'repo' object is reused even after failure of command execution,
referring 'filecache'-ed property may reuse one kept in
'repo._filecache', even if reloading from a file is expected.

Executing command sequence on command server is a typical case of this
situation (e0a0f9ad3e4c also tried to fix this issue). For example:

  1. start a command execution

  2. 'changelog.delayupdate()' is invoked in a transaction scope

     This replaces own 'opener' by '_divertopener()' for additional
     accessing to '00changelog.i.a' (aka "pending file").

  3. transaction is aborted, and command (1) execution is ended

     After 'repo.invalidate()' at releasing store lock, changelog
     object above (= 'opener' of it is still replaced) is deleted from
     'repo.__dict__', but still kept in 'repo._filecache'.

  4. start next command execution with same 'repo'

  5. referring 'repo.changelog' may reuse changelog object kept in
     'repo._filecache' according to timestamp of '00changelog.i'

     '00changelog.i' is truncated at transaction failure (even though
     this truncation is unintentional one, as described later), and
     'st_mtime' of it is changed. But 'st_mtime' doesn't have enough
     resolution to always detect this truncation, and invalid
     changelog object kept in 'repo._filecache' is reused
     occasionally.

     Then, "No such file or directory" error occurs for
     '00changelog.i.a', which is already removed at (3).

This patch discards objects in '_filecache' other than dirstate at
transaction failure.

Changes in 'invalidate()' can't be simplified by 'self._filecache =
{}', because 'invalidate()' should keep dirstate in 'self._filecache'

'repo.invalidate()' at "hg qpush" failure is removed in this patch,
because now it is redundant.

This patch doesn't make 'repo.invalidate()' always discard objects in
'_filecache', because 'repo.invalidate()' is invoked also at unlocking
store lock.

  - "always discard objects in filecache at unlocking" may cause
    serious performance problem for subsequent procedures at normal
    execution

  - but it is impossible to "discard objects in filecache at unlocking
    only at failure", because 'releasefn' of lock can't know whether a
    lock scope is terminated normally or not

    BTW, using "with" statement described in PEP343 for lock may
    resolve this ?

After this patch, truncation of '00changelog.i' still occurs at
transaction failure, even though newly added revisions exist only in
'00changelog.i.a' and size of '00changelog.i' isn't changed by this
truncation.

Updating 'st_mtime' of '00changelog.i' implied by this redundant
truncation also affects cache behavior as described above.

This will be fixed by dropping '00changelog.i' at aborting from the
list of files to be truncated in transaction.
2015-10-24 18:58:57 +09:00
Mads Kiilerich
f3cdae8f42 largefiles: don't mute and obfuscate http errors when putlfile fails
'unexpected putlfile response: None' when an http error occurs is not very
helpful.

Instead, leave the handling of urllib2.HTTPError exceptions to other layers.
2015-10-23 21:27:29 +02:00
Mads Kiilerich
24ee58b9f9 largefiles: check hash of files in the store before copying to working dir
If the store somehow got corrupted, users could end up in weird situations that
were very hard to recover from or lead to propagation of the corruption.

Instead, spend the extra time checking the hash when copying to the working
directory. If it doesn't match, emit a warning, and don't put wrong content in
the working directory.
2015-10-23 21:27:29 +02:00
Mads Kiilerich
602d83e7e6 largefiles: fix explicit commit of normal/largefile switch
Commit of corresponding normal/largefiles pairs would only commit the standin.
That is usually fine, except if either the normal file or the standin is a
remove while the other is an add. In that case it would either give duplicate
colliding entries or lose the file.

Instead, commit both filenames if one of them is a remove.
2015-10-21 00:18:11 +02:00
Mads Kiilerich
84f1b9864b convert: fix Python syntax in 'splice in' message
Instead of reporting
  spliced in ['82544090e14fe18091e04f1fb0f0d7991cbe6e7e'] as parents of 369fd983d9e13330e9f12d9fce820deae84ea223
report
  spliced in 82544090e14fe18091e04f1fb0f0d7991cbe6e7e as parents of 369fd983d9e13330e9f12d9fce820deae84ea223
2015-10-19 16:49:54 +02:00
Mads Kiilerich
58681faacf rebase: fix wrong 'no changes to commit' when using --collapse
--collapse will do that rebase doesn't commit until the final commit. The lack
of a new commit would make it look like the rebase didn't contribute any
changes.

Instead, only warn about no commits when not using --collapse.
2015-10-19 16:29:35 +02:00
Pierre-Yves David
a5218017f2 shelve: properly process bundle2 bundle 2015-10-19 15:42:50 +02:00
Pierre-Yves David
eaea148fdb histedit: properly apply bundle2 backups
If the histedit fails, we restore a backup. We make sure this backup bundle can
be in bundle2 format as general delta will require.
2015-10-20 03:07:23 +02:00
Mads Kiilerich
09567db49a spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
timeless@mozdev.org
ff22eee5cd mq: consistently use qrefresh 2015-10-14 03:30:27 -04:00
timeless@mozdev.org
1b8a3b4ea1 grammar: use does instead of do where appropriate 2015-10-14 02:06:54 -04:00
timeless@mozdev.org
716b455ed5 l10n: use %d instead of %s for numbers 2015-10-14 22:29:03 -04:00
Durham Goode
6c10065cf4 histedit: make histedit prune when obsolete is enabled
Back in June we made histedit use obsolete markers to cleanup when possible.
This was rolled back as part of bb3db0db4037 (which should have only rolled back
the --abort stuff, but rolled back everything). This caused a nasty bug when
used in conjuction with the inhibit+directaccess extensions where histedit would
leave old nodes around even after they had been squashed away.

The root of the problem is that we first clean up old nodes, and then we clean
up temp nodes. In the first pass, when we obsoleted old nodes, some would become
unobsolete because they had temp nodes on top of them, thus making them stick
around even after the histedit finished.

The fix is to A) move the temp node cleanup to be before the old node cleanup
(since they are topological on top of the old nodes), and B) use obsolete
markers instead of stripping.
2015-10-17 12:32:23 -07:00
Gregory Szorc
508a4655f7 clonebundles: rewrite documentation
There are a lot of considerations server operators need to know before
deploying clone bundles. They should be documented. So I rewrote the
extension docs to contain this information.
2015-10-17 11:23:54 -07:00
FUJIWARA Katsunori
54ce7de850 dirstate: show develwarn for write() invocation without transaction
This is used to detect 'dirstate.write()' invocation without the value
gotten by 'repo.currenttransaction()' (mainly focused on 3rd party
extensions).
2015-10-17 01:15:34 +09:00
FUJIWARA Katsunori
106983607a dirstate: make dirstate.write() callers pass transaction object to it
Now, 'dirstate.write(tr)' delays writing in-memory changes out, if a
transaction is running.

This may cause treating this revision as "the first bad one" at
bisecting in some cases using external hook process inside transaction
scope, because some external hooks and editor process are still
invoked without HG_PENDING and pending changes aren't visible to them.

'dirstate.write()' callers below in localrepo.py explicitly use 'None'
as 'tr', because they can assume that no transaction is running:

  - just before starting transaction
  - at closing transaction, or
  - at unlocking wlock
2015-10-17 01:15:34 +09:00
Christian Delahousse
5fbe511f90 rebase: reduce scope of try catch in restorestate
Refactoring by reduce the scope of the try catch block so that it only captures
what it needs.  I could have made it smaller but another patch in the series
will add onto it.
2015-10-15 15:20:44 -07:00
Christian Delahousse
dd6c27ee5b rebase: on abort delete rebase state file no matter what
When a user's repository is in an unfinished rebase state and they choose to
abort, at a minimum, the repo should be out of that state. We've found
situations where the user could not leave the state unless manually deleting the
rebasestate file. This fix ensures that no matter what exception may be raised
during the abort, the rebase state file will be deleted, the user will be out of
the rebase state and they can get their repository into a workable condition.
2015-10-15 12:13:46 -07:00
Gregory Szorc
120d4eb9b6 share: pass named arguments
They are defined as named arguments and previous called as positional
arguments. As part of wrapping hg.share in an extension, I had to
extract arguments using some hacky techniques. Using named arguments
makes wrapping much simpler.
2015-12-12 22:07:40 -05:00
Mathias De Maré
14d32d90ac clonebundles: fix typo 2015-12-15 07:17:15 +01:00
Augie Fackler
a84cc516e7 merge: restate calculateupdates in terms of a matcher
Once we get a matcher down into manifestmerge, we can make narrowhg
work more easily and potentially let manifest.match().diff() do less
work in manifestmerge.
2015-12-14 20:37:41 -05:00
Augie Fackler
0a19647501 merge: have merge.update use a matcher instead of partial fn
This is relatively rarely used functionality, but migrating this to a
matcher will make future work on narrow clones more feasible.
2015-12-14 18:54:03 -05:00