Commit Graph

5503 Commits

Author SHA1 Message Date
Bryan O'Sullivan
f176ae0f45 with: use context manager for wlock in unshelve 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
7d902f7f8f with: use context manager for wlock in shelve deletecmd 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
274fcb4437 with: use context manager for wlock in shelve cleanupcmd 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
74eae160f6 with: use context manager for wlock in shelve createcmd 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
2ced15165a with: use context manager for lock in histedit cleanupnode 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
ed2500cd97 with: use context manager for lock in qimport 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
3feacd382c with: use context manager for wlock in qfold 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
4b7071051f with: use context manager for wlock in qrefresh 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
e826ea566e with: use context manager for wlock in qpop 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
4003062696 with: use context manager for wlock in qpush 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
68786b4a3e with: use context manager for wlock in qnew 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
e41ff99cd6 with: use context manager for wlock in mergeupdate 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
ab04c813f9 with: use context manager for wlock in overridepurge 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
070b1b5491 with: use context manager for wlock in cmdutilforget 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
b83485ed82 with: use context manager for wlock in overriderevert 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
3538da229b with: use context manager for wlock in removelargefiles 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
ccc94927e6 with: use context manager for wlock in addlargefiles 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
c7a59c74b6 with: use context manager for wlock in updatelfiles 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
65ee17ba0b with: use context manager for wlock in kw_dorecord 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
a9fe3cefa5 with: use context manager for wlock in kw_copy 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
85a3bcab4f with: use context manager for wlock in kw_amend 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
6b60d65449 with: use context manager for wlock in keyword demo 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
82870250ec with: use context manager for wlock in _kwfwrite 2016-01-15 13:14:46 -08:00
Bryan O'Sullivan
a2f04de9b6 with: use context manager for wlock in sign 2016-01-15 13:14:46 -08:00
Yuya Nishihara
1eaa3db7b3 chgserver: mark as a built-in extension 2015-12-23 22:37:24 +09:00
Yuya Nishihara
c4a6a3f863 chgserver: import background server extension from cHg
This extension is copied from
https://bitbucket.org/yuja/chg/ -r 86feb5f2e971

It could be imported as mercurial/chgserver.py, but in that case, we would
have to resolve circular import between chgserver and commandserver. So I
decided to keep it as an extension.

  chgserver.chgcmdserver -> commandserver.server
  commandserver._servicemap -> chgserver.chgunixservice
2015-12-23 22:23:56 +09:00
Laurent Charignon
d72e8db6ef rebase: small refactoring to allow better extensibility from extensions
Inhibit, one of evolve's extension, would like to change the way rebase works
with obsolete changesets. During a rebase with inhibit, the inhibition of the
obsolescence markers should be lifted for the rebase.
With this small refactoring, inhibit and can wrap the _filterobsoleterevs
function to lift inhibition cleanly and at the same time this change makes
rebases' code more legible.
2016-01-14 11:50:28 -08:00
Bryan O'Sullivan
584240dc82 shelve: use a context manager for file I/O in listcmd 2016-01-12 14:47:21 -08:00
Bryan O'Sullivan
4e29b6de19 largefiles: use util.readfile in lfconvert 2016-01-12 14:31:02 -08:00
Bryan O'Sullivan
ebfc6943c7 largefiles: use util.readfile in overrides 2016-01-12 14:29:34 -08:00
Bryan O'Sullivan
f936f9a539 largefiles: use a context manager in _getfile 2016-01-12 14:27:42 -08:00
Bryan O'Sullivan
c490d3c96d patchbomb: replace file I/O with util.readfile 2016-01-12 15:57:18 -08:00
Laurent Charignon
0faf1a71c4 rebase: prevent creating divergence
Before this patch rebase would create divergence when you were rebasing obsolete
changesets on a destination not containing one of its successors.
This patch introduces rebase.allowdivergence to explicitly allow
divergence creation with rebase.
2016-01-12 13:43:41 -08:00
Laurent Charignon
83309d717a rebase: create a new variable to make the next patch more legible 2016-01-06 12:55:56 -08:00
Laurent Charignon
9d840a1d82 rebase: minor refactoring of _computeobsoletenotrebased
This patch is a refactoring of the code skipping obsolete changesets already
present in destination. It makes the following patches more legible.
Instead of passing all the revs to be rebased to _computeobsoletenotrebased,
we only pass the obsolete revisions of the rebaseset.
2016-01-06 12:55:56 -08:00
Gregory Szorc
5732d02b64 exchange: make clone bundles non-experimental and enabled by default
The clone bundles feature was introduced in Mercurial 3.6 behind an
experimental and disabled by default flag. The feature has been enabled
on hg.mozilla.org for a few months and has served many terabytes of
clones. Users have been encouraged to use the feature and reception
has been very positive (mainly due to faster clones as a result of
connecting to a CDN). I have heard no feedback about changing the
feature other than inquiries about when it will be enabled by default.
So, I think the feature is ready to be enabled by default.

This patch renames experimental.clonebundles to ui.clonebundles,
documents the option, and enables it by default. References to the
experimental state of clone bundles have been removed. The remaining
config option docs in clonebundles.py have been removed because they
are redudant with `hg help config`.

There are some oddities with behavior of clone bundles. Because clones
with clone bundles are effectively 2 `hg pull` operations, there may be
2 transactions. This could result in hooks running twice. If the
subsequent pull is aborted, it could result in partial rollback and an
incomplete clone. This behavior is a bit wonky and should probably
be documented. If this patch is accepted, I'll send a follow-up to
document it. I don't think this behavior should prevent the feature
being enabled by default. Reworking the clone mechanism to support
interrupted or multi-part clones feels like a major new feature and
something that when implemented can change the hook and rollback
semantics of clone bundles. Besides, partial clone is better than
full rollback and hooks running on initial clone are likely rare, so I
think the impact is minimal.
2016-01-08 10:58:04 -08:00
Gregory Szorc
0436f8dd18 exchange: make clonebundleprefers non-experimental
In preparation for making the feature enabled by default.
2016-01-08 10:57:01 -08:00
Gregory Szorc
2c9adcd9c5 clonebundles: remove advertisement of feature
I screwed up.

When clone bundles is enabled on the server and a compatible client
without the feature enabled clones, the server sends down an
advertisement saying to enable the feature. The server creates the
message which is printed verbatim on the client as an "output" part.
There are 2 problems:

1) The message doesn't respect the client's localization
2) The message contains a reference to the "experimental.clonebundles"
   option.

Since clone bundles is about to be marked as non-experimental and the
goal of the advertisement was to encourage clients to test the
experimental feature, let's just remove the broken advertisement since
it no longer serves a purpose.
2016-01-08 10:53:07 -08:00
Martin von Zweigbergk
ee22e78a3b convert: use manifest.diff() instead of ctx.status()
mercurial_source.getchanges() seems to care about files whose nodeid
has changed even if their contents has not (i.e. it has been
reverted/backed out). The method uses ctx1.status(ctx2) to find
differencing files. However, that method is currently broken and
reports reverted changes as modified. In order to fix that method, we
first need to rewrite getchanges() using manifest.diff(), which does
report reverted files as modified (because it's about differences in
the manifest, so about nodeids).
2016-01-09 22:58:10 -08:00
Martin von Zweigbergk
933fd7efd0 convert: replace cache of (m,a,r) by (ma,r)
The next commit will rewrite the way we find changes between two
manifests. By making the cache not care about the difference between
added and modified files, we don't require the rewritten code to care
about that difference either. Also extract the call to ctx.status() to
simplify the next commit.
2016-01-10 21:07:34 -08:00
Martin von Zweigbergk
16f9affccf convert: use _ prefix for private methods in hg sink
This makes it clearer which methods are part of the interface defined
by the superclass.
2016-01-09 21:42:48 -08:00
timeless
699a790124 children: update help with replacement 2016-01-06 17:18:18 +00:00
timeless
78198d84e4 graphlog: update help with replacement 2016-01-06 17:17:49 +00:00
timeless
c5e6ac2fdd histedit: clarify modes
also fix terse command syntax
2015-12-23 06:36:47 +00:00
timeless
6e7d73e833 histedit: explain basics of histedit commands
This should be hooked into @action via an extended
help argument, but that is future work.
2015-12-22 23:21:53 +00:00
timeless
f130e904b6 histedit: report the unacceptable changeset 2015-12-23 07:37:45 +00:00
Bryan O'Sullivan
9fc5431d91 patchbomb: treat empty address list as no addresses
Previously it wasn't possible to use configuration to avoid
being prompted for e.g. a CC list when using patchbomb to send
emails.

We now make it possible to supply an empty value.
2016-01-07 20:02:47 -08:00
timeless
ce2180cfc6 shelve: hook afterresolvedstates 2016-01-05 22:23:27 +00:00
Yuya Nishihara
699ec74ad9 extdiff: use @command decorator to set up diff commands
It can set "inferrepo" attribute appropriately.
2016-01-01 22:35:34 +09:00
Yuya Nishihara
daf4a450f1 extdiff: factor out list of common options 2016-01-04 22:13:46 +09:00
timeless
35854385ce transplant: specify the right file and path for unfinishedstates 2016-01-06 04:59:46 +00:00
timeless
aa6a7a6e4d transplant: only use checkunfinished if not continue 2016-01-06 04:59:21 +00:00
timeless
57af46935b transplant: correct language to use working directory 2016-01-05 22:46:04 +00:00
timeless
37bdcf185f histedit: replace @addhisteditaction with @action
@action supports verbs, messages, priority, and internal

messages should be translated.
internal means the action should not be listed.

geteditcomment will construct the verbs list based on
@actions (prefering priority over non priority, otherwise
favoring verbs with short forms over verbs without).
2015-12-23 21:30:38 +00:00
timeless
84c6183618 histedit: prefer edit commit, edit message, use commit
Selecting editing commits, rewording commit messages, and
selecting commits are key actions, we will prefer them more
generally in a future commit, this pulls them ahead before
that to make the diffs easier to read.

The remaining commands are left alphabetically sorted
2015-12-23 21:20:08 +00:00
timeless
3b48ba0db9 histedit: replace editcomment with a function 2015-12-23 21:17:45 +00:00
Siddharth Agarwal
2584b69484 merge: add a new 'backup' argument to get actions
We're going to use this in an upcoming patch to back untracked files up when
they're replaced by tracked ones.
2016-01-02 03:02:57 -08:00
Siddharth Agarwal
0efe3372e4 origpath: move from cmdutil to scmutil
This is a lower-level function so it doesn't need to be in cmdutil, and putting
it here avoids a bunch of potential import cycle issues.
2016-01-02 03:02:57 -08:00
timeless
ebb1d48658 cleanup: remove superfluous space after space after equals (python) 2015-12-31 08:16:59 +00:00
timeless
4ac12a9abc histedit: hide --outgoing warnings 2015-12-22 23:25:17 +00:00
timeless
c5945ca9d0 histedit: list action when intervention is required 2015-12-23 08:57:04 +00:00
timeless
cc8aba7ca7 histedit: hook afterresolvedstates 2015-12-24 20:41:17 +00:00
timeless
b2b9fb00e6 rebase: hook afterresolvedstates 2015-12-24 20:41:40 +00:00
timeless
bc013751ae histedit: fix comment in newnodestoabort 2015-12-30 04:04:51 +00:00
timeless
f7a4033ef1 histedit: fix comment in applychanges 2015-12-30 04:02:04 +00:00
timeless
4c1b57259a histedit: remove unused variable state 2015-12-31 15:39:38 +00:00
FUJIWARA Katsunori
4d06739a86 revset: use delayregistrar to register predicate in extension easily
Previous patch introduced 'revset.predicate' decorator to register
revset predicate function easily.

But it shouldn't be used in extension directly, because it registers
specified function immediately. Registration itself can't be restored,
even if extension loading fails after that.

Therefore, registration should be delayed until 'uisetup()' or so.

This patch uses 'extpredicate' decorator derived from 'delayregistrar'
to register predicate in extension easily.

This patch also tests whether 'registrar.delayregistrar' avoids
function registration if 'setup()' isn't invoked on it, because
'extpredicate' is the first user of it.
2015-12-29 23:58:30 +09:00
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
timeless
4714e37c78 transplant: use Oxford comma 2015-11-30 19:28:26 +00:00
timeless
15faf26352 convert/svn: quiet check-config 2015-12-08 08:37:12 +00:00
FUJIWARA Katsunori
6cb3588722 censor: make censor acquire locks before processing
Before this patch, "hg censor" executes below:

  - without acquisition of wlock, examine whether the working
    directory refers the revision of the file to be censored or not

  - without acquisition of store lock (slock), replace existing
    filelog of file to be censored with censored one,

    Replacement consists of steps below, and it is assumed that the
    destination filelog at (1) isn't changed before renaming at (3).

    1. read existing filelog in
    2. write filelog entries (both censored and not) into temporary file
    3. rename from temporary file to existing filelog to be censored

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

This patch makes "hg censor" acquire wlock and slock before
processing.
2015-12-09 08:28:53 +09:00
FUJIWARA Katsunori
f9e9bdfb4f transplant: widen wlock scope of transplant for consitency while processing
Before this patch, "hg transplant" executes below before acquisition
of wlock.

  - cmdutil.checkunfinished()
  - repo.status() for dirty check
  - repo.dirstate.parents()

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

This patch makes "hg transplant" acquire wlock before processing
instead of acquiring wlock in each of 'transplanter.apply()' and
'transplanter.recover()'.
2015-12-09 08:28:53 +09:00
FUJIWARA Katsunori
3c4a554b71 shelve: remove redundant acquisition of wlock for sub commands of unshelve
Previous patch ensures that wlock is acquired before processing for
"hg unshelve". It makes acquisition of wlock in each functions below
redundant.

  - unshelveabort() for "unshelve --abort"
  - unshelvecontinue() for "unshelve --continue"
2015-12-09 08:28:53 +09:00
FUJIWARA Katsunori
d4f8b1a01a shelve: widen wlock scope of unshelve for consistency while processing
Before this patch, "hg unshelve" of shelve extension executes below
before acquisition of wlock:

  - cmdutil.checkunfinished()
  - examine existence of (specified) shelve file

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

This patch widens wlock scope of "hg unshelve" of shelve extension for
consistency while processing.
2015-12-09 08:28:53 +09:00
Gregory Szorc
0c976d1ad3 histedit: pick an appropriate base changeset by default (BC)
Previously, `hg histedit` required a revision argument specifying which
revision to use as the base for the current histedit operation. There
was an undocumented and experimental "histedit.defaultrev" option that
supported defining a single revision to be used if no argument is
passed.

Mercurial knows what changesets can be edited. And in most scenarios,
people want to edit this history of everything on the current head that
is rewritable. Making histedit do this by default and not require
an explicit argument or additional configuration is a major usability
win and will enable more people to use histedit.

This patch changes the behavior of the experimental and undocumented
"histedit.defaultrev" config option to select an appropriate base
revision by default. Comprehensive tests exercising the edge cases
in the new, somewhat complicated default revset have been added.
Surprisingly, no tests broke. I guess we were never testing the
behavior with no ANCESTOR argument (it used to fail with
"abort: histedit requires exactly one ancestor revision"). The new
behavior is much more user friendly.

The functionality for choosing the default base revision has been
moved to destutil.py, where it can easily be modified by extensions.
2015-10-24 19:56:39 +01:00
Yuya Nishihara
a588ddbc95 rebase: remove extra "if" from check of collapsing named branches 2015-12-05 23:50:13 +09:00
Yuya Nishihara
d1c7989b16 rebase: drop redundant functions to keep branch and graft source explicitly
All entries in extra dict are propagated by default since 5293d4f88aef.
2015-12-05 23:48:22 +09:00
Yuya Nishihara
2298c7a029 color: drop useless override of ui.popbuffer()
Because labels are applied at write() time since ce03e7329682,
colorui.popbuffer() is useless and it doesn't update _bufferapplylabels
correctly. Removing it should fix the problem.
2015-12-05 23:41:11 +09:00
Laurent Charignon
c7dc44265f rebase: only clear rebase status after the rebase transaction has completed
In 6e6b18aab8b2, I made the mistake of moving the step "clearing the status
after a rebase" to inside the rebase transaction.
This was wrong, since we don't want to clear the status (and the rebase state)
if something went wrong during the transaction: if something goes wrong we
want to keep the rebase state to be able to abort.
It broke rebase with evolve + inhibit.
2015-12-03 08:31:20 -08:00
timeless
538843243e histedit: improve missing rule suggestion
include actual suggested text
2015-12-02 07:41:35 +00:00
Mateusz Kwapich
0016ccb3cd histedit: get rid of state.rules
Now we are using state.actions instead of state.rules everywhere.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
eb6e47fe5e histedit: change state.rules uses to state.actions
This change is replacing most of state.rules uses with state.actions
uses. The next change will change histeditstate class to actually
uses state actions.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
45bd81cd16 histedit: add tostate method to histedit action
the format of rules that we store in state file format is different from the rule
format that we present to users. We need a way of dumping action to state file.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
5cf03a9c5a histedit: remove makedesc
It's a dead code now.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
574ed39bd6 histedit: use torule instead of makedesc in ruleeditor 2015-12-02 12:19:01 -08:00
Mateusz Kwapich
644cc338bd histedit: add torule method to histedit action objects
To make histedit action objects responsible for understanding
the format of their action lines we are adding a torule method
which for a histedit action will return a string which can be
saved in histedit state or shown in text editor when editing the
plan.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
278e9a38b4 histedit: add verify() to histeditaction
This commits splits the parsing of the histedit rule from its semantic analysis.
It's necessary because sometimes we want to do first without doing the former (reading the
histedit state).
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
29346eb944 histedit: add addhisteditaction decorator
This decorator will is allowing us to move the registering the action
in actiontable closer to the action code. Also it is storing the
verb inside histedit action so the action is aware of the verb
needed to trigger it.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
122e188cce histedit: add actions property to histedit state
I want to refactor histedit to use action objects instead of (verb, rest)
pairs whenever possible. At the end of this series I want the rules to
be translated into action objects when reading state and translated back
when writing state. All histedit internals should use action objects instead
of state rules.

To migrate histedti internals sequentially I'm introducing the state.actions
property to translate rules on the fly so we can use both state.actions and
state.rules until refactoring is done.
2015-12-02 12:19:01 -08:00
FUJIWARA Katsunori
fc6772c5fc shelve: execute checkunfinished inside wlock scope
Before this patch, "hg shelve" of shelve extension executes
'cmdutil.checkunfinished()' before acquisition of wlock.

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

To avoid this issue, this patch executes 'cmdutil.checkunfinished()'
inside wlock scope of "hg shelve".

This also fixes issue4957, because now 'cmdutil.checkunfinished()'
isn't invoked at "hg shelve" with options below:

  --cleanup
  --delete
  --list
  --patch
  --stat
2015-12-02 03:12:08 +09:00
FUJIWARA Katsunori
157a86fc91 shelve: widen wlock scope of shelve for consistency while processing
Before this patch, "hg shelve" of shelve extension executes/refers
below before acquisition of wlock:

  - 'repo.dirstate.parents()' via 'repo[None].parents()'
  - 'repo._activebookmark'

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

This patch widens wlock scope of "hg shelve" of shelve extension for
consistency while processing.
2015-12-02 03:12:08 +09:00
FUJIWARA Katsunori
f05ee67a9f gpg: make sign acquire wlock before processing
Before this patch, "hg sign" of gpg extension executes/evaluates below
without acquisition of wlock.

  - repo.dirstate.parents()
  - '.hgsigs' not in repo.dirstate

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

To avoid this issue, this patch makes "hg sign" of gpg extension
acquire wlock before processing.
2015-12-02 03:12:08 +09:00
Augie Fackler
c6a7c82c31 bookmarks: hoist getbkfile out of bmstore class
It's totally fine that this hook exists, but I don't see a need for it
to live inside the bmstore class.
2015-11-11 20:45:38 -05:00
timeless
787afdd271 histedit: mention histedit-last-edit.txt on abort
Users may spend a lot of effort writing histedit rules,
getting an abort without being told they can recover their work
is very frustrating.

Avoid that by telling them where to find their work.
2015-12-02 08:07:36 +00:00
timeless
40357ef4f4 histedit: add missing raise keyword to statement 2015-12-02 07:40:42 +00:00
timeless
139b830297 histedit: improve grammar for _histedit comment 2015-12-02 07:39:49 +00:00
Augie Fackler
840125d439 commands: inline definition of localrepo.parents() and drop the method (API)
localrepo.parents() has relatively few users, and most of those were
actually implicitly looking at the wctx, which is now made explicit
via repo[None].
2015-11-11 20:07:15 -05:00
Mykola Nikishov
0ee9a8cf79 histedit: edit with custom filename
For instance, Emacs allows to open file with special features enabled
(AKA mode) based on the path/name of the file [1]. For such cases, use
'hg-histedit-XXX.txt' as filename pattern.

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html
2015-11-21 17:40:26 +02:00
timeless
9b00c9388a patchbomb: rename email function
I see no reason for the function not to be email ...
2015-11-29 06:51:23 +00:00
timeless
dfb7d692a0 graphlog: rename glog function
I see no reason for the function not to be glog ...
2015-11-29 06:51:23 +00:00
Mike Edgar
8d4be9cc8f rebase: propagate extra dict from rebase source changeset
This corrects extra propagation for the rebase command and the shelve command.
2015-11-28 04:11:14 -05:00