Commit Graph

5824 Commits

Author SHA1 Message Date
Pulkit Goyal
770fabee34 py3: make hgext/hgk.py use absolute_import 2016-05-06 21:50:40 +05:30
Pulkit Goyal
21822d329b py3: make hgext/gpg.py use absolute_import 2016-05-06 21:46:17 +05:30
Pulkit Goyal
c83d2f743d py3: make hgext/graphlog.py use absolute_import 2016-05-06 21:48:17 +05:30
Pulkit Goyal
5d5b487562 py3: make hgext/fetch.py use absolute_import 2016-05-06 21:44:41 +05:30
Jun Wu
1de5a3a533 chgserver: add [alias] to confighash
The [alias] config section affects a global state: commands.table. It's hard
to trace whether an alias is added by a config option or an extension, and
add/remove aliases in a safe way per chg request. It will hurt performance a
bit if we clean the table and parse aliases every time. Therefore let's just
add it to confighash.

This will make chg pass test-pager.t.
2016-05-07 14:51:32 +01:00
Jun Wu
cbd2df17c1 chgserver: remove _clearenvaliases
Since we expand environment variables in alias lazily, the _clearenvaliases
hack is no longer necessary.

This resolves an issue that a non-shell alias which has environment variables
in its arguments and is set to use pager will not use pager running with chg.
2016-05-06 23:57:56 +01:00
liscju
45a5b8ca24 largefiles: makes verify batching stat calls to remote
Instead of sending stat calls for each files separately, it sends
one batch call with stat invocations for all files.
2016-05-03 23:48:31 +02:00
liscju
31a5cfa252 largefiles: change basestore._verifyfile to take list of files to check
Makes it easier to use batch stat calls in remotestore to decrease
number of round trips.
2016-05-03 23:31:32 +02:00
timeless
95228c418a rebase: handle successor targets (issue5198)
When a parent has a successor (indicated by revprecursor in state),
we need to use it.
2016-04-11 21:33:07 +00:00
Christian Ebert
81c2d303c5 keyword: replace use of _filerev with _filenode
To be independent of rev numbers.
Analogous to b558712637b8.
2016-04-19 11:00:15 +01:00
Pierre-Yves David
98d7d07c79 journal: properly check for held lock (issue5349)
The 'jlock' code meant to check for a held lock, but it actually just checking for a
lock object. With CPython, this worked because the 'jlock' object is not
referenced outside the '_write' function so reference counting would garbage
collect it and the '_lockref' would return None. With pypy, the garbage
collection would happen at an undefined time and the '_lockref' can still point
to a 'jlock' object outside of '_write'.

The right thing to do here is not only to check for a lock object but also to
check if the lock is held. We update the code to do so and reuse a utility
method that exist on 'localrepo' to help readability. This fix journal related
tests with pypy.
2016-09-13 20:30:19 +02:00
Pulkit Goyal
8b4f697218 py3: remove use of *L syntax
The int in Python 3 behaves as long so no need of L's in py3.
Moreover we dont need long here.
2016-09-01 02:29:46 +05:30
Martin von Zweigbergk
2fbf01764c util: rename checkcase() to fscasesensitive() (API)
I always read the name "checkcase(path)" as "do we need to check for
case folding at this path", but it's actually (I think) meant to be
read "check if the file system cares about case at this path". I'm
clearly not the only one confused by this as the dirstate has this
property:

  def _checkcase(self):
      return not util.checkcase(self._join('.hg'))

Maybe we should even inverse the function and call it fscasefolding()
since that's what all callers care about?
2016-08-30 09:22:53 -07:00
Augie Fackler
24579e9893 histedit: correct output of error when 'base' is from the edit list
This was made more obvious by marmoute's recent rearrangement of this code.
2016-08-30 13:13:50 -04:00
Pierre-Yves David
b9ebcea85e histedit: remove now unused 'constraints' related code
Now that the one action that need different logic handle that using inheritance
and overriding, we can remove that code.
2016-08-26 21:06:31 +02:00
Pierre-Yves David
d2bccef0ce histedt: use inheritance to override the constraints in 'base'
All actions but one actually have the same constraints when it comes to validate
the 'action.node' value. So we actually just add this code to a method that can
be overwritten in the one action where it matters.

The now unused 'contraints' related enum and class attribute will be cleaned up
in the next changeset.
2016-08-26 21:00:33 +02:00
Pierre-Yves David
e83d8435c9 histedit: move constraint verification to the 'action.verify' method
Action has a method dedicated to verifying its validity. So we move code
related to constrains into that method. This requires a bit more context to the
'verify' method in the same fashion we were passing the 'prev' argument.

This is an extra step before we can simplify the constraint handling code
further.
2016-08-26 20:54:52 +02:00
Pierre-Yves David
c056fb41dc histedit: directly use node in 'verifyactions'
It does not seem useful to convert to hex: it is an extra step and they are
longer strings. So we stick to node for the logic. We only convert to short hex
for error when needed. As a nice side effect this remove the explicit constant
usage in'[12:]'. This will also help moving the code around later as we just
have to access action.node.
2016-08-26 20:54:32 +02:00
Pierre-Yves David
58fa162d21 histedit: temporarily shorten name of 'constraints' variable
An upcoming changeset will make the line where this variable is used
slightly too long. Other later changesets will clean that up further and makes
the variable unnecessary, so this is only temporary and it does seems useful to
put anything more complicate in place.
2016-08-26 20:42:18 +02:00
Pierre-Yves David
5dfe266b33 histedit: drop the 'nodetoverify' local variable
We can just use 'action.node'.
2016-08-26 20:38:37 +02:00
Pierre-Yves David
f113c210a5 histedit: make 'constraints' a class attribute instead of a method
There does not seem to be a reason for this to be a method. So we initialise
the class attribute once and for all at creation time and drop the instance
method.
2016-08-26 20:34:58 +02:00
Pierre-Yves David
d390c8d401 histedit: drop the 'nodetoverify' method
That method is just returning self.node and is never overridden. We just use
the attribute directly instead and get rid of the method.

This is the beginning of series to simplify and unify verification of constraints
for actions.
2016-08-26 20:31:33 +02:00
timeless
faab59b629 rebase: properly calculate total commits to rebase (issue5347)
Before this, predecessor commits were being included in the count
2016-08-26 00:16:51 +00:00
Pierre-Yves David
816a66763b journal: rename on disk files to 'namejournal'
The 'journal' naming is already used by the transaction journal. Having an
unrelated group of file with such a close naming is confusing and error prone.
We rename the file used by the 'journal' extension to use 'namejournal' as the
extension track the location of various 'names'.
2016-08-24 03:59:19 +02:00
Augie Fackler
4e1c384d0a extensions: change magic "shipped with hg" string
I've caught multiple extensions in the wild lying about being
'internal', so it's time to move the goalposts on people. Goalpost
moving will continue until third party extensions stop trying to
defeat the system.
2016-08-23 11:26:08 -04:00
Hannes Oldenburg
f878dbe267 histedit: use samefile function from cmdutil
Replace usage of inefficient samefile function in collapse with a call to
cmdutil.samefile().
2016-08-21 08:03:22 +00:00
Augie Fackler
cb268cbd2f merge with stable 2016-08-15 12:26:02 -04:00
Mateusz Kwapich
f5353fe47b journal: use the dirstate parentchange callbacks
Instead of hacking into dirstate internals let's use the callbacks
to be notified about wd parent change.
2016-08-09 09:15:46 -07:00
Pierre-Yves David
0029412d76 journal: take wlock for writting the 'shared' file
As we did for the shared extension itself, we add some locking around the write
of the 'shared' file.
2016-08-08 18:05:10 +02:00
Pierre-Yves David
62e206c945 mq: take wlock when 'qqueue' is doing write operations
Apparently when this command was added, the locking was forgotten. No code
changes beside the indentation from the locking context.
2016-08-07 17:00:45 +02:00
Yuya Nishihara
84f406e3b9 extdiff: isolate path variable of saved command to independent paragraph
Otherwise, the whole paragraph wouldn't be translated.
2016-07-27 21:44:49 +09:00
Yuya Nishihara
22ee04a3ca extdiff: export __doc__ of saved command for translation 2016-07-27 21:42:24 +09:00
Yuya Nishihara
fe246a4d88 extdiff: refactor closure of saved diff command as a top-level class
This allows us to collect __doc__ for translation.
2016-07-27 21:40:42 +09:00
Yuya Nishihara
7c8b72638d journal: use fm.formatdate() to pass date tuple in appropriate type (BC) 2016-07-31 17:11:48 +09:00
Yuya Nishihara
431f6e2124 journal: use fm.formatlist() to pass hashes in appropriate type (BC) 2016-07-31 16:56:26 +09:00
Yuya Nishihara
df734a45ca journal: use fm.hexfunc() to get full hash in JSON/template output (BC)
We generally do that.
2016-07-31 16:38:16 +09:00
Henning Schild
9ed7d6b8f2 patch: remove unused git parameter from patch.diffstat()
Since 5997ebdd67f0 the parameter is not used anymore.
2016-11-12 13:36:17 +01:00
Jun Wu
216e95e106 convert: migrate to util.iterfile 2016-11-14 23:17:15 +00:00
Augie Fackler
a6fae4a4f2 color: avoid shadowing a variable inside a list comprehension 2016-11-10 16:32:51 -05:00
Kostia Balytskyi
20f84ae643 shelve: move shelve-finishing logic to a separate function
With future obs-based shelve, finishing shelve will be different
from just aborting a transaction and I would like to keep both
variants of this functionality in a separate function.
2016-11-10 03:15:41 -08:00
Kostia Balytskyi
082c8bc2de shelve: move unknown files handling to a separate function
This change has nothing to do with future obsshelve introduction,
it is done just for readability purposes.
2016-11-10 03:20:28 -08:00
Kostia Balytskyi
0796e063c2 shelve: move actual created commit shelving to a separate function
Currently, this code does not have any branching, it just bundles
a commit and saves a patch file. Later, obsolescence-based shelve
will be added, so this code will also create some obsmarkers and
will be one of the few places where obsshelve will be different
from traditional shelve.
2016-11-10 03:07:20 -08:00
Kostia Balytskyi
78a4c1c0bd shelve: move 'nothing changed' messaging to a separate function
This has nothing to do with the future obsshelve implementation, I just
thought that moving this messaging to a separate function will improve
shelve code readability.
2016-11-10 03:33:01 -08:00
Kostia Balytskyi
739f37c1cd shelve: move commitfunc creation to a separate function
Special commitfuncs are created as closures at least twice in shelve's
code and one time special commitfunc is used within another closure.
They all serve very specific purposes like temporarily tweak some
configuration or enable editor, etc. This is not immediately important
to someone reading shelve code, so I think moving this logic to a separate
function is a good idea.
2016-11-10 03:26:31 -08:00
Kostia Balytskyi
406f14ba4a shelve: move mutableancestors to not be a closure
There's no value in it being a closure and everyone who tries to read
the outer function code will be distracted by it. IMO moving it out
significantly improves readability, especially given how clear it is
what mutableancestors function does from its name.
2016-11-10 03:24:07 -08:00
Kostia Balytskyi
3f100ab127 shelve: move shelve name generation to a separate function
This has nothing to do with future obsshelve introduction, done just
for readability purposes.
2016-11-10 03:22:55 -08:00
Kostia Balytskyi
96bd77e21a shelve: move possible shelve file extensions to a single place
This and a couple of following patches are a preparation to
implementing obsolescense-enabled shelve which was discussed
on a Sprint. If this refactoring is not done, shelve is going
to look even more hackish than now.

This particular commit introduces a slight behavior change. Previously,
if only .hg/shelve/name.patch file exists, but .hg/name.hg does not,
'hg shelve -d name' would fail saying "shelve not found". Now deletion
will only fail if .patch file does not exist (since .patch is used
as an indicator of an existing shelve). Other shelve files being absent
are skipped silently to accommodate for future introduction of obs-based
shelve, which will mean that for some shelves .hg and .patch files exist,
while for others .hg and .oshelve.
2016-11-10 03:07:20 -08:00
Durham Goode
52b8095f37 manifest: remove last uses of repo.manifest
Now that all the functionality has been moved to manifestlog/manifestrevlog/etc,
we can finally change all the uses of repo.manifest to use the new versions. A
future diff will then delete repo.manifest.

One additional change in this commit is to change repo.manifestlog to be a
@storecache property instead of @property. This is required by some uses of
repo.manifest require that it be settable (contrib/perf.py and the static http
server). We can't do this in a prior change because we can't use @storecache on
this until repo.manifest is no longer used anywhere.
2016-11-10 02:13:19 -08:00
Durham Goode
64058b3c19 manifest: remove usages of manifest.read
Now that the two manifestctx implementations have working read() functions,
let's remove the existing uses of manifest.read and drop the function.
2016-11-10 02:13:19 -08:00
Xidorn Quan
e164cf9b26 color: show mode warning based on ui.formatted
ui.interactive is only for input and ui.formatted is for output.
2016-11-11 13:06:05 +11:00
Mads Kiilerich
38cb771268 spelling: fixes of non-dictionary words 2016-10-17 23:16:55 +02:00
Christian Ebert
bfdeb77b45 keyword: handle filectx _customcmp
Suggested by Yuya Nishihara:
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-October/089461.html

Related to issue5364.
2016-10-17 17:42:46 +02:00
Pierre-Yves David
1a69a24d99 color: add the ability to display configured style to 'debugcolor'
The 'hg debugcolor' command gains a '--style' flag to display all the configured
labels and their styles. This have many benefits:

 * discovering documented label,
 * checking consistency between label's style,
 * showing the actual style of a label.
2016-11-03 15:17:02 +01:00
Pierre-Yves David
a87b2dcecc color: sort output of 'debugcolor'
The previous ordering were provided by the set. The new output is more stable
and rational. In addition we have some logic to keep the '_background' version
together to help readability.
2016-11-03 15:15:47 +01:00
Pierre-Yves David
d254535be6 color: extract color and effect display from 'debugcolor'
We are about to introduce a second mode for 'hg debugcolor' that would list the
known label and their configuration, so we split the code related to color and
effect out of the main function.
2016-11-03 14:48:47 +01:00
Pierre-Yves David
9bb3c03012 color: restore _style global after debugcolor ran
Before this change, running 'debugcolor' would destroy all color style for the
rest of the process life. We now properly backup and restore the variable
content. Using a global variable is sketchy in general and could probably be
removed. However, this is a quest for another adventure.
2016-11-03 14:29:19 +01:00
Pierre-Yves David
0551e941c2 color: add basic documentation to 'debugcolor'
This does not hurt.
2016-11-03 14:12:32 +01:00
timeless
ae4cf4bf09 rebase: check for conflicts before continuing
When there are unresolved merge conflicts, there is no reason
to make the user wait for rebase to process all of the
already rebased commits just to complain that it cannot do
anything. Abort early.
2016-11-02 18:59:29 +00:00
timeless
0deb5c6d90 rebase: rename merge to mergemod 2016-11-02 18:56:07 +00:00
Mads Kiilerich
d18a73f120 largefiles: clarify variable name holding file mode
A follow-up to 9ce3ccc6ef9c.

'st' sounds like the whole stat result while 'mode' is a better name for the
actual file mode.
2016-10-18 16:45:39 +02:00
Yuya Nishihara
db11160c56 histedit: use ui.fin to read commands from stdin
stdin is wrapped by channeledinput in command-server session.
2016-03-18 17:15:06 -07:00
Yuya Nishihara
3ea0560e2b convert: have debugsvnlog obtain standard streams from ui
This will help porting to Python 3, where sys.stdin/out/err are unfortunately
unicode streams so we can't use them directly.
2015-10-03 14:34:56 +09:00
Yuya Nishihara
3f27064dab convert: remove superfluous setbinary() calls from debugsvnlog
0f20f68c768c made standard streams set to binary mode globally.
2015-10-03 14:29:13 +09:00
timeless
85999ce49e patchbomb: use single quotes around command hint
Windows command lines use double quotes to quote arguments with spaces.
This change is in a series to unify around using single quotes around
commands, and double quotes around interior arguments.

This changeset is taken on stable for consistency with similar update done
before the freeze.
See dc90bb772edc, 675a0be03493, 518b94d8f911 and 149a699cfd98.
2016-04-14 15:15:49 +00:00
Pulkit Goyal
e613a4c10d py3: make factotum use absolute_import
check-code complains for using urllib2 so that too was fixed.
2016-04-17 02:29:33 +05:30
Pulkit Goyal
d623f99ed3 py3: make extdiff use absolute_import 2016-04-17 02:15:05 +05:30
Pulkit Goyal
e8c7dbca1d py3: make eol use absolute_import 2016-04-17 02:10:55 +05:30
Pulkit Goyal
570e0beb47 py3: make color use absolute_import 2016-04-17 00:53:56 +05:30
timeless
0dd163b523 fetch: use single quotes around command hint
Windows command lines use double quotes to quote arguments with spaces.
This change is in a series to unify around using single quotes around
commands, and double quotes around interior arguments.
2016-04-14 15:20:11 +00:00
Yuya Nishihara
b427a832a6 notify: do not load style file if template is specified (BC)
This patch makes sure that either "tmpl" or "mapfile" is exclusively set,
which is the same behavior as common log-like templates and formatter outputs.

See the previous patch for why.
2016-04-04 22:50:50 +09:00
Yuya Nishihara
59e8edaa91 bugzilla: do not load style file if template is specified (BC)
This prepares for the API change to support template aliases. I'm going to
extract a factory function of templater that reads a map file:

  # original
  templater(mapfile, ..., cache, ...)
  # new
  templater.frommapfile(mapfile, ...)  # read mapfile to build cache/map
  templater(..., cache, ...)           # use specified cache (= map elements)

This will make it clear to isolate stock styles (i.e. map files) from user
aliases. Template aliases should be applied to command arguments and templates
in hgrc, but not to map files. Otherwise, our stock styles and web templates
could be modified unintentionally.

This patch makes sure that either "tmpl" or "mapfile" is exclusively set. It's
theoretically a behavior change, since you could put new keywords in template
by defining them in a map file before:

  # mapfile
  foo = "{rev}"
  # hgrc
  [bugzilla]
  style = mapfile
  template = {foo}

But the old behavior would be a bug because bugzilla.template is documented
as "overrides style if specified". Also, common log-like templates and
formatter doesn't allow using mapfile-keywords in a separate template. So
I decided to make a BC.

Since there was no test for the bugzilla extension, this adds new test that
covers style/template output.
2016-04-04 22:48:34 +09:00
timeless
2778e2894f patchbomb: fix public-is-missing hint
Without this, there is no space between a hash and the -r preceding the next
line in the use hg push hint
2016-04-14 14:26:37 +00:00
Martijn Pieters
7d4b1c457a logtoprocess: new experimental extension
This extension lets you direct specific ui.log() information to shell
commands, spawned in the background. This can be used to, say, capture
timings, commandfailure tracebacks, etc., making the output available
to other command-line tools.
2016-04-05 17:39:59 +01:00
Mads Kiilerich
274ba69e53 convert: keep converted hg parents that are outside convert.hg.revs (BC)
Before, when converting revisions without also including their already
converted parents in convert.hg.revs, the parents would no longer be parents.

That seems unfortunate and we dare to assume that nobody ever wants that.

Instead, preserve parents that are outside the current convert range but
already have been converted.

The parents returned in getcommit() are unconditionally converted, so we
introduce a separate optparents with optional parents.
2016-04-13 00:16:21 +02:00
timeless
109fcbc79e pycompat: switch to util.urlreq/util.urlerr for py3 compat 2016-04-06 23:22:12 +00:00
Mads Kiilerich
069bac6a3e largefiles: introduce push --lfrev to control which revisions are pushed
The default of pushing all largefiles referenced in outgoing revisions is safe,
but also expensive and sometimes not what is needed. We thus introduce a
--lfrev option, similar to what pull already has.

By specifying an empty set of revisions (or null), it is possible to get lazy
(and insecure!) pushes of revisions without referenced largefiles, similar to
how pull works.
2016-03-27 13:00:28 -07:00
Mads Kiilerich
66a29f6996 largefiles: don't access repo.changelog directly in getlfilestoupload
Make it possible to pass both nodes and revisions to getlfilestoupload.
2016-04-13 01:45:45 +02:00
Mads Kiilerich
940d175900 localrepo: refactor prepushoutgoinghook to take a pushop
prepushoutgoinghook was introduced in 8dfcd476a7f7 and largefiles is the only
in-tree use of it. Refactor it to be more useful for other use cases in
largefiles.
2016-04-13 01:09:11 +02:00
Oleg Afanasyev
2f8e102f8e shelve: refactor directory name into constant
Shelve directory name extracted into constant to avoid typos/duplication.
2016-04-08 23:33:28 -07:00
timeless
f77cdcd3b1 pycompat: switch to util.stringio for py3 compat 2016-04-10 20:55:37 +00:00
Julien Cristau
3e185dc2e6 convert: kill dead code
gitread is unused with the new commandline-based code.
2016-04-04 15:39:13 +02:00
Julien Cristau
dd250f1d5d convert: don't ignore errors from git diff-tree 2016-04-04 15:38:48 +02:00
timeless
78639f500c children: use double quotes for arguments
You can't use single quotes in cmd.exe. See f4369d3e818c.
2016-01-06 17:18:18 +00:00
timeless
897045e273 largefiles: use double quotes for arguments
You can't use single quotes in cmd.exe. See f4369d3e818c.
2016-01-12 09:30:39 +00:00
Jun Wu
c59ce363ab chgserver: change random state after fork
Before this patch, extensions expecting a different random state per command
will break since the chg request handler will inherit a same random state
from the parent daemon process.

This patch addresses the issue by calling random.seed() after fork.
2016-04-04 01:59:57 +01:00
Jun Wu
abecf92520 chgserver: use relative path at socket.bind
Before this patch, if the server address is long, the server will fail to
listen and throw the error:

  socket.error: AF_UNIX path too long

It is because AF_UNIX path usually has a very short length limit (107 chars on
common platforms, see sys/un.h).

This patch addresses the issue by using relative path instead. Therefore the
directory length does not matter. It helps run tests with chg using a long
$TMPDIR.
2016-04-04 03:17:59 +01:00
Jun Wu
c99168df8c chgserver: move args copying logic to the correct place
A previous patch moved it to an incorrect place. Since dispatch._earlygetopt
has side effects on args, we need to move it to the place before _earlygetopt.
2016-04-04 01:10:51 +01:00
liscju
bb92aaa17c largefiles: replace invocation of os.path module by vfs in reposetup.py
This commit is part of bigger effort described in 'Windows UTF-8' plan.
2016-03-19 15:31:13 +01:00
liscju
7b0ac0d003 largefiles: replace invocation of os.path module by vfs in overrides.py
This commit is part of bigger effort described in 'Windows UTF-8' plan.
It is not changing all invocations but the ones where change is
obviously correct and doesn't require complicated changes.
2016-03-19 14:50:40 +01:00
Pierre-Yves David
6fceb4873e record: deprecate the extension
The feature has been moved into core behind the -i flag. We can safely
deprecated the extension and point people at the --interactive flag in core.
2016-03-28 12:50:56 -07:00
FUJIWARA Katsunori
a35dfb0209 keyword: use templatefilter to mark a function as template filter
This patch also adds test for filter 'svnisodate' and 'svnutcdate' for
safety, because there is no test using them, yet.
2016-03-30 02:10:44 +09:00
Laurent Charignon
374c190d53 rebase: fix crash when rebase aborts while rebasing obsolete revisions
Before this patch, rebase --continue would crash when trying to resume a rebase
of obsolete revisions whose successors were in the destination.
This patch adds logic to recompute the mapping when rebase is resumed. This
patch also adds a test that showcased the crash before the code change.
2016-03-29 11:50:41 -07:00
Laurent Charignon
b39e6cb3ff rebase: refactor of error handling code path for rebaseskipobsolete
This patch extracts the error handling code path to go in a separate function.
In the next patch we will able to reuse this logic and avoid duplicated code.
2016-03-29 11:49:45 -07:00
Martin von Zweigbergk
a993a6ecbd convert: delete unused imports in git.py
As reported by pyflakes
2016-03-29 10:49:33 -07:00
Matt Mackall
4a96519522 merge with stable 2016-03-29 12:29:00 -05:00
Martin von Zweigbergk
4cc86f7b27 bundle: move writebundle() from changegroup.py to bundle2.py (API)
writebundle() writes a bundle2 bundle or a plain changegroup1. Imagine
away the "2" in "bundle2.py" for a moment and this change should makes
sense. The bundle wraps the changegroup, so it makes sense that it
knows about it. Another sign that this is correct is that the delayed
import of bundle2 in changegroup goes away.

I'll leave it for another time to remove the "2" in "bundle2.py"
(alternatively, extract a new bundle.py from it).
2016-03-28 14:41:29 -07:00
Mateusz Kwapich
843a151296 convert: rewrite gitpipe to use common.commandline (SEC)
CVE-2016-3069 (4/5)
2016-03-22 17:05:11 -07:00
Mateusz Kwapich
e02db5f882 convert: dead code removal - old git calling functions (SEC)
CVE-2016-3069 (3/5)
2016-03-22 17:05:11 -07:00
Mateusz Kwapich
98120175fb convert: rewrite calls to Git to use the new shelling mechanism (SEC)
CVE-2016-3069 (2/5)

One test output changed because we were ignoring git return code in numcommits
before.
2016-03-22 17:05:11 -07:00
Mateusz Kwapich
8103d3a484 convert: add new, non-clowny interface for shelling out to git (SEC)
CVE-2016-3069 (1/5)

To avoid shell injection and for the sake of simplicity let's use the
common.commandline for calling git.
2016-03-22 17:05:11 -07:00
timeless
45450b6576 ui: add prompt argument to write (issue5154) (API)
When code like filemerge._iprompt calls ui.prompt, it expects
the user to see the output in addition to getting the prompt.

Other code such as histedit may call ui.pushbuffer, but its
goal is not to interfere with prompts, so this commit adds
an optional prompt flag to ui.write and has _readline
include that argument.

ui.promptchoice calls ui.prompt which calls ui._readline.

This commit also updates hgext.color.write.
2016-03-25 21:51:00 +00:00
Yuya Nishihara
f0125a308f templater: do not abuse SyntaxError to report errors in template map file
SyntaxError is the class representing syntax errors in Python code. We should
use a dedicated exception class for our needs. With this change, unnecessary
re-wrapping of SyntaxError can be eliminated.
2016-03-26 18:01:04 +09:00
Pierre-Yves David
a74c6e1e14 mq: restrict generated patch name to 75 characters (issue5117)
Super long first line in description lead to very long file name that
windows is unhappy about. We restrict the name to 75 char to avoid the
issue.

75 seems fine and leave some extra room for '__#' suffix in case of conflict.

I does not seems worthwhile to add a dedicated config option to configure the
length. It can be done in the future if there is an actual user demand for it.
2016-03-09 22:21:08 +00:00
FUJIWARA Katsunori
4a0bc54a73 doc: remove deprecated option from synopsis of command help
Before this patch, deprecated options below are used in synopsis of
command help, even though they aren't listed up as available options
by default. These might confuse readers.

  - -n (no-op, now) of strip
  - -a/--active of branches
  - -f/--force of merge
2016-03-01 03:28:46 +09:00
Yuya Nishihara
61b45241f5 zeroconf: forward all arguments passed to ui.configitems() wrapper
cf6cc5344afa added 'ignoresub' argument to ui.configitems(), but zeroconf
wrapper wasn't updated. It caused the following crash:

  Traceback (most recent call last):
    File "bin/hg", line 43, in <module>
      mercurial.dispatch.run()
    File "lib/python/mercurial/dispatch.py", line 54, in run
      sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
    File "lib/python/mercurial/dispatch.py", line 120, in dispatch
      ret = _runcatch(req)
    File "lib/python/mercurial/dispatch.py", line 191, in _runcatch
      return _dispatch(req)
    File "lib/python/mercurial/dispatch.py", line 924, in _dispatch
      cmdpats, cmdoptions)
    File "lib/python/mercurial/dispatch.py", line 681, in runcommand
      ret = _runcommand(ui, options, cmd, d)
    File "lib/python/mercurial/extensions.py", line 195, in closure
      return func(*(args + a), **kw)
    File "lib/python/hgext/zeroconf/__init__.py", line 180, in cleanupafterdispatch
      return orig(ui, options, cmd, cmdfunc)
    File "lib/python/mercurial/dispatch.py", line 1055, in _runcommand
      return checkargs()
    File "lib/python/mercurial/dispatch.py", line 1015, in checkargs
      return cmdfunc()
    File "lib/python/mercurial/dispatch.py", line 921, in <lambda>
      d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
    File "lib/python/mercurial/util.py", line 991, in check
      return func(*args, **kwargs)
    File "lib/python/mercurial/commands.py", line 5405, in paths
      pathitems = sorted(ui.paths.iteritems())
    File "lib/python/mercurial/util.py", line 723, in __get__
      result = self.func(obj)
    File "lib/python/mercurial/ui.py", line 619, in paths
      return paths(self)
    File "lib/python/mercurial/ui.py", line 1099, in __init__
      for name, loc in ui.configitems('paths', ignoresub=True):
    File "lib/python/mercurial/extensions.py", line 195, in closure
      return func(*(args + a), **kw)
  TypeError: configitems() got an unexpected keyword argument 'ignoresub'

We have no test coverage for zeroconf, so I've added a minimal test that
could reproduce this problem.
2016-02-10 22:53:17 +09:00
timeless
2c0eb26137 rebase: update working directory when aborting (issue5084) 2016-02-05 01:56:46 +00:00
Siddharth Agarwal
69360ef583 rebase: don't preserve most extra fields
This backs out changeset 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:23:31 -08:00
Siddharth Agarwal
d6d688266e rebase: backout changeset 9b23739c41de
This is a dependency for a future backout of 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:24:47 -08:00
Siddharth Agarwal
82b2cbc2ee rebase: backout changeset 9fd8e3a61d6a
This is a dependency for a future backout of 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:23:52 -08:00
Wagner Bruna
de70b03c22 histedit: fix typo in documentation 2016-02-03 11:01:11 -02:00
Martijn Pieters
9c233476de rebase: better way to detect non-detaching revisions (issue5044)
Rather than look for the lowest revision, see if the rebase state is tracking
the parents of this revision. Otherwise we can't handle multiple revisions in
one rebase that includes a merge revision.

Fixes issue5044.
2016-02-01 15:41:43 +00:00
FUJIWARA Katsunori
4c1f8febc6 doc: use correct indentation for enumeration
This creates hg.1.html as expected.
2016-02-01 22:14:06 +09:00
FUJIWARA Katsunori
c6d9f4c401 doc: use correct cross reference in help documentation
This patch fixes problems below:

  - ":hg:" role should be followed by not '"' but '`'
  - there is a help topic not "default-push" but "config.default-push"
2016-02-01 22:13:57 +09:00
FUJIWARA Katsunori
6a03d4f576 doc: prevent literal text block from being treated as non-literal one
This creates hg.1.html as expected.
2016-02-01 22:06:35 +09:00
FUJIWARA Katsunori
901d78d859 doc: prevent non-literal text block from being treated as literal one
This creates hg.1.html as expected.
2016-02-01 22:06:35 +09:00
FUJIWARA Katsunori
a189f9751b histedit: show correct hash ID at verification error
node.short() on 'ha' in verifyactions() causes broken hash ID, because
it is initialized with node.hex()-ed node value.
2016-02-01 20:29:20 +09:00
Matt Harbison
6d46368119 largefiles: prevent committing a missing largefile
Previously, if the largefile was deleted at the time of a commit, the standin
was silently not updated and its current state (possibly garbage) was recorded.
The test makes it look like this is somewhat of an edge case, but the same thing
happens when an `hg revert` followed by `rm` changes the standin.

Aside from the second invocation of this in lfutil.updatestandinsbymatch()
(which is what triggers this test case), the three other uses are guarded by
dirstate checks for added or modified, or an existence check in the filesystem.
So aborting in lfutil.updatestandins() should be safe, and will avoid silent
skips in the future if this is used elsewhere.
2016-01-24 00:10:19 -05:00
Matt Harbison
49d08bc58e largefiles: report the missing file count after a commit that does nothing
This is the same warning that is printed for normal files.
2016-01-23 23:32:49 -05:00
Matt Harbison
9906cb44b6 largefiles: fix an explicit largefile commit after a remove (issue4969)
The change in 6fce9a02f069 to handle a normal -> largefile switch was too
aggressive in preserving the original matcher names.  If a largefile is
explicitly provided by the user, but only the standin exists in dirstate, then
only the standin can be committed.

There's still maybe an issue when the largefile is deleted outside of Mercurial:

  $ rm large
  $ hg ci -m "oops" large
  large: The system cannot find the file specified
  nothing changed
  [1]
2016-01-23 20:51:17 -05:00
Yuya Nishihara
f591623eb5 dispatch: extract function that tests command attributes
This function will host the compatibility layer for old third-party commands.
See the next patch for details.
2016-03-14 00:14:43 +09:00
Jun Wu
2cf6b295a8 chgserver: drop bundle.mainreporoot config
Before this patch, although chgserver drops repo object by setting it to None,
there is another side effect loading a repo: setting bundle.mainreporoot.

This patch explicitly sets it to empty to undo the side effect. It will make
chg pass test-strip.t.
2016-03-20 15:11:34 -07:00
Yuya Nishihara
14aaf6f3a9 chgserver: drop old hack to recreate ui on HGPLAIN change
It's been superseded by config/env hash. A log message is simplified as we no
longer need a diff of environment variables. Also, _loadnewui() is changed to
require args since it can't copy old --config values without args.
2016-03-20 10:44:15 -07:00
Jun Wu
7aa59d1e65 chgserver: use global ui instead of repo ui for dispatch.request.ui
Before this patch, chgserver will use repo ui as dispatch.request.ui, while
req.ui is designed to be global ui without repo config.

Passing repo ui as dispatch.request.ui leads to repo.ui being incorrect, which
can lead to unwanted results. For example, if the repo config has [extensions],
it could affect which localrepository.featuresetupfuncs get executed and the
repo may have an incorrect list of supported requirements.

This patch changes _renewui to return both global ui and repo ui. The global
ui is passed to req.ui, and the repo ui is used to calculate confighash. It
will make chg pass test-largefiles-misc.t and test-requires.t, which are both
related to repo requirements.
2016-03-17 18:32:10 +00:00
Mateusz Kwapich
36f23adcb5 histedit: add a hint about enabled dropmissing to histedit edit comment
Adds a hint to histedit comment reminding user about enabled dropmissing.
This will make the enabled dropmissing more visible. The example comment:

# Edit history between 5abd0a5c28d1 and b54649a8a63f
#
# Commits are listed from least to most recent
#
# You can reorder changesets by reordering the lines
#
# Commands:
#
#  e, edit = use commit, but stop for amending
#  m, mess = edit commit message without changing commit content
#  p, pick = use commit
#  b, base = checkout changeset and apply further changesets from there
#  d, drop = remove commit from history
#  f, fold = use commit, but combine it with the one above
#  r, roll = like fold, but discard this commit's description
#
# Deleting a changeset from the list will DISCARD it from the edited history!
2016-03-19 11:39:13 -07:00
Jun Wu
f40efd689b chgserver: use old ui.system if fout is not stdout or needs to be captured
Before this patch, chgui will override the system method, forwarding every
process execution to the client so sessions and process groups can work as
expected. But the chg client will just use stdout, if ui.fout is not stdout or
if the output is set to be captured to safe._buffers, the client will not
behave correctly.

This can happen especially with code prepending "remote:". For example, bundle2
uses ui.pushbuffer, and sshpeer sets fout to ferr. We may have trouble with
interactive commands in the fout set to ferr case but if it really bites us, we
can always send file descriptors to the client.

This patch adds a check to detect the above situations and fallback to the old
ui.system if so. It will make chg happy with test-bundle2-exchange.t,
test-phases-exchange.t, test-ssh-bundle1.t and test-ssh.t.
2016-03-17 18:27:48 +00:00
Mads Kiilerich
6d22385d0b largefiles: add some docstrings 2016-03-19 08:28:24 -07:00
Mads Kiilerich
cdb1fa386c largefiles: drop partial support for not having a user cache
9f1a3c7b4a28 introduced support for not having a "global" user cache.
In the rare cases where the environment didn't provide the location of the
current home directory, the usercachepath function could return None.
That functionality has since bitrotten and several code paths did not correctly
check for usercachepath returning None:

  $ HOME= XDG_CACHE_HOME= hg up --config extensions.largefiles=
  getting changed largefiles
  abort: unknown largefiles usercache location

Dropping the partial support for it is thus not really a backward compatibility
breaking change.

Thus: consistently fail early if the usercache location is unknown.

It is relevant to be able to control where the largefiles are stored and how
they propagate, but that should probably be done differently. The dysfunctional
code just gets in the way.
2016-03-19 08:27:54 -07:00
Mads Kiilerich
afcb680fd7 largefiles: refactor usercachepath - extract user cache path function
It is convenient to have the user cache location explicitly.
2016-03-19 08:23:55 -07:00
liscju
22355da162 shelve: adds restoring newly created branch (issue5048) (BC)
Before this patch shelve never preserved branch information,
so after applying unshelve branch was the same as it was
on working copy no matter in which branch shelve took place.

This patch makes bare shelving(with no files specified, without
interactive,include and exclude option) remembers information if
the working directory was on newly created branch ,in other words
working directory was on different branch than its first parent.
In this situation unshelving restores branch information to the working
directory.
2016-02-10 02:23:27 +01:00
liscju
eefc583bbc shelve: make non bare shelve not saving branch information in bundle
This patch prepares for restoring newly created branch only on
bare shelve later because information about new-branch will be
preserved only when shelve was bare and working copy branch
was different than branch of its parent. In other case information
about new-branch will be gone, so unshelve will not recognise that
shelve was made on new-branch and it will not restore branch
information from the bundle to the working directory.
2016-03-07 22:58:11 +01:00
liscju
251de74ab8 shelve: preserve newly created branch on non-bare shelve in wctx (BC)
Before this patch current branch in working context wasnt preserved
after shelve, this patch makes it restore after update.
2016-03-12 18:36:31 +01:00
liscju
802a1dd151 largefiles: replace invocation of os.path module by vfs in lfutil.py
Replaces invocations os.path functions to methods in vfs. Unfortunately
(in my view) this makes code less readable, because instead of using
clear variable names with path it needs to replace them with vfs(..).
I need guidance how to make such transition look more readable.

For example in this patch there is example with few places with
wvfs.join(standindir), standindir before this patch was absolute
path, in this it is changed to relative because it is used also
in expression wvfs.join(standindir, pat).
2016-03-14 20:20:22 +01:00
liscju
4648b42bff largefiles: replace invocation of os.path module by vfs in lfcommands.py 2016-03-13 23:16:44 +01:00
Jun Wu
cbbb576b1c pager: skip uisetup if chg is detected
chg has its own pager implementation that it wants to skip pager's uisetup.
It is currently done by redirecting stdout to /dev/null, which has unintended
side effects. This patch makes pager aware of chg and skip uisetup directly
from pager. We may want to merge chg and pager's pager implementation to
make this unnecessary in the future.
2016-03-14 15:03:19 +00:00
Jun Wu
60655f3e3b chgserver: add an explicit gc to trigger __del__
SocketServer.ForkingMixIn uses os._exit which will skip all cleanup handlers.
We want to run __del__ to make things like transactions, {ssh,http}peer,
atomictempfile, dirstateguard, etc. work.

This patch adds a "gc.collect()" to trigger __del__. It is helpful for chg
to pass some test cases in test-devel-warnings.t.
2016-03-14 23:08:03 +00:00
Jun Wu
d487d6ed63 blackbox: do not assume self._bb{vfs,repo,fp} are set in blackboxui.__init__
It's possible for the blackboxui code to do a "del self._bbvfs", then ui.copy()
or similar attempt will fail. It will also fail when constructing a blackboxui
from a non-blackbox ui.
This patch fixes the issue by not assuming any _bb* attr is set.
2016-03-15 10:36:02 +00:00
Jun Wu
745b527cb7 histedit: do not close stdin
Closing stdin is unexpected by chgserver and is not a good idea generally.
This patch refactors related code a bit and make sure stdin is not closed.
It will make chg much happier on test-histedit*.t.
2016-03-15 00:42:33 +00:00
FUJIWARA Katsunori
1d2fb0ab99 hgext: use templatekeyword to mark a function as template keyword
This patch replaces registration of template keyword function in
bundled extensions by registrar.templatekeyword decorator all at once.
2016-03-13 05:17:06 +09:00
Jun Wu
b50f59de5d chgserver: do not keep repo object
The current chgserver design is to use one server to handle multiple repos
which has same [extensions] config. Previously the client uses --cwd / to
avoid creating a repo object. Now we need to set repo to None before we
have code to make "serve" command norepo when it's chg.
2016-03-16 11:57:09 +00:00
Jun Wu
6193936a7f chgserver: invalidate the server if extensions fail to load
Previously, if extensions fail to load, chg server will just keep working
without those extensions. It will print a warning message but only if a new
server starts.

This patch invalidates the server if any extension failed to load, but still
serve the client (hopefully just) once. It will help chg pass some test cases
of test-bad-extension.t.
2016-03-12 04:24:11 +00:00
Jun Wu
80fd75af3b chgserver: add an explicit "reconnect" instruction to validate
In some rare cases (next patch), we may want validate to do "unlink" without
forcing the client reconnect. This patch addes a new "reconnect" instruction
and makes "unlink" not to reconnect by default.
2016-03-14 13:48:33 +00:00
Augie Fackler
b569044317 fsmonitor: flag msc_stdint as no-check-code
I'd rather not modify code that we're vendoring, so I'm just marking
it this way.
2016-03-14 21:15:59 -04:00
Sune Foldager
1e39bee49b fsmonitor: use custom stdint.h file when compiling with Visual C
Visual C/C++ 9, which Python 2.7 is compatible with, doesn't have C99
support and thus doesn't contain a stdint.h file.

This changeset adds a custom version of stdint.h, created specifically
for Visual C, and uses it when building with that compiler.
2016-03-14 17:53:47 +01:00
Mateusz Kwapich
812fb817e3 histedit: have dropmissing abort on empty plan
We noticed that many users have the intuition of laving the editor empty when
they want to abort the operation. The fact that dropmissing allows user to
delete all edited commits is not intuitive even for users that asked for it.

Let's prevent people from this footgun.
2016-03-13 16:46:49 -07:00
Jun Wu
3303b6aab4 chgserver: handle ParseError during validate
Currently the validate command in chgserver expects config can be loaded
without issues but the config can be broken and chg will print a stacktrace
instead of the parsing error, if a chg server is already running.

This patch adds a handler for ParseError in validate and a new instruction
"exit" to make the client exit without abortmsg. A test is also added to make
sure it will behave as expected.
2016-03-14 12:52:35 +00:00
Jun Wu
efff39b548 chgserver: resolve relative path before sending via system channel
The chgserver may have a different cwd from the client because of the side
effect of "--cwd" and other possible os.chdir done by extensions. Therefore
relative paths can be misunderstood by the client.

This patch solves it by expanding relative cwd path to absolute one before
sending them via the 'S' channel. It can help chg to pass a testcase in
test-alias.t later.
2016-03-14 11:23:04 +00:00
Yuya Nishihara
025ddf17ef cmdserver: write early exception to 'e' channel in 'unix' mode
In 'unix' mode, the server is typically detached from the console. Therefore
a client couldn't see the exception that occurred while instantiating the
server object.

This patch tries to catch the early error and send it to 'e' channel even if
the server isn't instantiated yet. This means the error may be sent before the
initial hello message. So it's up to the client implementation whether to
handle the early error message or error out as protocol violation.

The error handling code is also copied to chgserver.py. I'll factor out them
later if we manage to get chg passes the test suite.
2016-03-12 22:03:30 +09:00
Martin von Zweigbergk
4da3e7135f zeroconf: remove leftover camelcase identifier
00820e3ad90f (zeroconf: remove camelcase in identifiers, 2016-03-01)
forgot one occurrence of "numAuthorities", which makes test-paths.t
fail for me. I don't even know what zeroconf is, but this patch seems
obviously correct and it fixes the failing test case.
2016-03-11 15:40:58 -08:00
Yuya Nishihara
88535fc17d chgserver: remove outdated comment about setvbuf()
I've replaced setvbuf() by fdopen() before merging chg into the core, so
this comment is wrong.

https://bitbucket.org/yuja/chg/commits/5c24e72bc447
2016-02-27 21:17:37 +09:00
timeless
c63b17c586 transplant: use absolute_import 2016-03-01 04:53:43 +00:00
timeless
1e52ec82b3 transplant: switch to using nodemod for hex+short 2016-03-11 16:07:22 +00:00
timeless
4f987db82a convert: bzr use absolute_import 2016-03-02 16:32:52 +00:00
Jun Wu
b98b0254ad chgserver: include [extdiff] in confighash
extdiff's uisetup will register new commands. If we do not include it in
confighash, changes to [extdiff] will not get new commands registered.
This patch adds extdiff to confighash and makes it possible for chg to pass
test-extdiff.t.
2016-03-11 13:00:20 +00:00
Anton Shestakov
adaa0d801e patchbomb: specify unit for ui.progress when sending emails 2016-03-11 22:30:43 +08:00
Anton Shestakov
a65379c3ff churn: specify unit for ui.progress when analyzing revisions 2016-03-11 22:30:29 +08:00
Anton Shestakov
67f0dab5d3 convert: specify unit for ui.progress when scanning paths 2016-03-11 22:30:04 +08:00
Anton Shestakov
5b22fe48fb convert: specify unit for ui.progress when operating on files 2016-03-11 22:29:51 +08:00
Anton Shestakov
f67064214c largefiles: use revisions as a ui.progress unit
Using plural form is consistent with other progress units, and "1 out of 5
revisions" sounds more correct. Also, tests don't show this, but if you have
'speed' item in progress.format config, it shows e.g. '100 revisions/sec',
which also seems better.
2016-03-11 22:26:06 +08:00
Anton Shestakov
a30859be56 largefiles: specify unit for ui.progress when operating on files
Also make it available for translation. It could already be translated, because
it's used as a unit in archival.py and subrepo.py, for example.
2016-03-11 22:21:43 +08:00
FUJIWARA Katsunori
08147e9705 convert: fix "stdlib import follows local import" problem in transport
Before this patch, import-checker reports error below for importing
subversion python binding libraries.

    stdlib import "svn.*" follows local import: mercurial
2016-03-11 21:55:44 +09:00
FUJIWARA Katsunori
8afa478806 convert: fix relative import of stdlib module in subversion
Before this patch, import-checker reports "relative import of stdlib
module" error for importing Pool and SubversionException from svn.core
in subversion.py.

To fix this relative import of stdlib module, this patch adds prefix
'svn.core.' to Pool and SubversionException in source.

These 'svn.core.' relative accessing shouldn't cause performance
impact, because there are much more code paths accessing to
'svn.core.' relative properties.

BTW, in transport.py, this error is avoided by assignment below.

    SubversionException = svn.core.SubversionException

But this can't be used in subversion.py case, because:

  - such assignment in indented code block causes "don't use camelcase
    in identifiers" error of check-code.py

  - but it should be placed in indented block, because svn is None at
    failure of importing subversion python binding libraries (=
    examination of 'svn' is needed)
2016-03-11 21:55:44 +09:00
FUJIWARA Katsunori
b75e95ce01 convert: make subversion import transport locally
Introducing "absolute_import" feature in previous patch caused failure
of importing local module "transport".
2016-03-11 21:55:44 +09:00
Christian Ebert
131615fd5b keyword: compact writing of temporary kwdemo hgrc 2016-03-11 08:27:11 +00:00
Jun Wu
bac9bcbc56 chg: remove manual reload logic
chgserver now validates and reloads configs automatically. Manually reloading
is no longer necessary. Besides, we are deprecating pid files since the server
will periodically check its ownership of the socket file and exit if it does
not own the socket file any longer, which works more reliable than a pid file.
This patch removes the SIGHUP reload logic from both chg server and client.
2016-03-10 00:12:33 +00:00
Pierre-Yves David
cc59112ca7 hgext: officially turn 'hgext' into a namespace package
Actually since Python 2.3, there is some way to turn top level package into
"namespace package" so that multiple subpackage installed in different part of
the path can still be imported transparently. This feature was previously
thought (at least by myself) to be only provided by some setuptool black magic.

Turning hgext into such namespace package allows third extensions to install
themselves inside the "hgext" namespace package to avoid polluting the global
python module namespace. They will now be able to do so without making it a pain
to use a Mercurial "installed" in a different way/location than these
extensions.

The only constrains is that the extension ship a 'hgext/__init__.py' containing
the same call to 'pkgutil.extend_path' and nothing else. This seems realistic.

The main question that remains is: should we introduce a dedicated namespace for
third party extension (hgext3rd?) to make a clearer distinction between what is
officially supported and what is not? If so, this will be introduced in a follow
up patch.
2016-02-27 12:56:26 +01:00
Matt Mackall
6d2484af42 merge with stable 2016-03-11 15:24:27 -06:00
Martijn Pieters
b1494940de fsmonitor: hook up state-enter, state-leave signals
Keeping the codebase in sync with upstream:

Watchman 4.4 introduced an advanced settling feature that allows publishing
tools to notify subscribing tools of the boundaries for important filesystem
operations.

https://facebook.github.io/watchman/docs/cmd/subscribe.html#advanced-settling
has more information about how this feature works.

This diff connects a signal that we're calling `hg.update` to the mercurial
update function so that mercurial can indirectly notify tools (such as IDEs or
build machinery) when it is changing the working copy.  This will allow those
tools to pause their normal actions as the files are changing and defer them
until the end of the operation.

In addition to sending the enter/leave signals for the state, we are able to
publish useful metadata along the same channel.  In this case we are passing
the following pieces of information:

1. destination revision hash
2. An estimate of the distance between the current state and the target state
3. A success indicator.
4. Whether it is a partial update

The distance is estimate may be useful to tools that wish to change their
strategy after the update has complete.  For example, a large update may be
efficient to deal with by walking some internal state in the subscriber rather
than feeding every individual file notification through its normal (small)
delta mechanism.

We estimate the distance by comparing the repository revision number.  In some
cases we cannot come up with a number so we report 0.  This is ok; we're
offering this for informational purposes only and don't guarantee its accuracy.

The success indicator is only really meaningful when we generate the
state-leave notification; it indicates the overall success of the update.
2016-03-10 16:04:09 +00:00
liscju
24726136ad largefiles: add abstract methods in remotestore class
Methods _put, _get, _stat were used in remotestore class as
abstract expecting that subclass would implement them. This
commit makes this fact explicit.
2016-03-10 10:56:02 +01:00
Augie Fackler
f277693a68 largefiles: use iterbatch instead of batch
This actually makes the code a little cleaner to read.
2016-03-02 13:13:05 -05:00
Martijn Pieters
34a3e2eb62 fsmonitor: new experimental extension
Extension to plug into a Watchman daemon, speeding up hg status calls by
relying on OS events to tell us what files have changed.

Originally developed at https://bitbucket.org/facebook/hgwatchman
2016-03-03 14:29:19 +00:00
Martijn Pieters
64a4b2e8cf fsmonitor: dependencies for new experimental extension
In preparation for the filesystem monitor extension, include the pywatchman
library. The fbmonitor extension relies on this library to communicate with
the Watchman service. The library is BSD licensed and is taken from
https://github.com/facebook/watchman/tree/master/python.

This package has not been updated to mercurial code standards.
2016-03-02 16:25:12 +00:00
Kostia Balytskyi
69abdd68e4 rebase: turn rebaseskipobsolete on by default
Consider the following use case. User has a set of commits he wants to rebase
onto some destination. Some of the commits in the set are already rebased
and their new versions are now among the ancestors of destination. Traditional
rebase behavior would make the rebase and effectively try to apply older
versions of these commits on top of newer versions, like this:

    a` --> b --> a`

(where both 'a`' and 'a``' are rebased versions of 'a')

This is not desired since 'b' might have made changes to 'a`' which can now
result in merge conflicts. We can avoid these merge conflicts since we know
that 'a``' is an older version of 'a`', so we don't even need to put it on top
of 'b'. Rebaseskipobsolete allows us to do exactly that.

Another undesired effect of a pure rebase is that now 'a`' and 'a``' are both
successors to 'a' which is a divergence. We don't want that and not rebasing
'a' the second time allows to avoid it.

This was not enabled by default initially because we wanted to have some more
experience with it. After months of painless usages in multiple places, we are
confident enough to turn it on my default.
2016-03-09 08:08:27 -08:00
timeless
7846832020 zeroconf: replace reduce+add with itertools.chain 2016-03-01 10:18:47 +00:00
timeless
a2c7933e41 zeroconf: replace has_key with in 2016-03-01 10:22:10 +00:00
timeless
a36c36a4d9 zeroconf: compare singleton using is 2016-03-01 09:59:58 +00:00
timeless
9c4fb14309 zeroconf: remove camelcase in identifiers 2016-03-01 09:57:45 +00:00
timeless
2194aed867 win32mbcs: use absolute_import 2016-03-02 21:50:35 +00:00
timeless
78f32a823b notify: use absolute_import 2016-03-02 21:48:08 +00:00
timeless
3d3cc1c01c patchbomb: use absolute_import 2016-03-02 21:42:42 +00:00
timeless
0d9e787fe4 convert: __init__ use absolute_import 2016-03-02 16:34:43 +00:00
timeless
798be7b824 convert: cvs use absolute_import 2016-03-02 16:41:35 +00:00
timeless
2ac9193926 convert: transport use absolute_import 2016-03-02 16:37:50 +00:00
timeless
4bcfa639ac convert: bzr use absolute_import 2016-03-02 16:32:52 +00:00
timeless
d982b75f31 convert: common use absolute_import 2016-03-02 16:26:35 +00:00
timeless
d9aed31d36 convert: convcmd use absolute_import 2016-03-02 16:23:28 +00:00
timeless
d35bed319b convert: subversion use absolute_import 2016-03-02 16:13:05 +00:00
timeless
57b0b61ecb blackbox: guard against recursion from dirty check 2016-03-08 20:34:59 +00:00
liscju
5a50693a7e shelve: changes getting opts values by get method
When shelve is used by another extension that doesn't
provide all necessary values in opts shelve raises
KeyError exception. This patch fixes this by getting
values from opts dictionary with get method.
2016-03-09 08:21:57 +01:00
liscju
7a7ee3b559 histedit: adds hint how to reorder changesets at editor (issue3766) 2016-03-08 21:59:06 +01:00
FUJIWARA Katsunori
60e9ee2742 revset: replace extpredicate by revsetpredicate of registrar
This patch consists of changes below (these can't be applied
separately).

  - replace revset.extpredicate by registrar.revsetpredicate in
    extensions

  - remove setup() on an instance named as revsetpredicate in
    uisetup()/extsetup() of each extensions

    registrar.revsetpredicate doesn't have setup() API.

  - put new entry for revsetpredicate into extraloaders in dispatch

    This causes implicit loading predicate functions at loading
    extension.

    This loading mechanism requires that an extension has an instance
    named as revsetpredicate, and this is reason why
    largefiles/__init__.py is also changed in this patch.

Before this patch, test-revset.t tests that all decorated revset
predicates are loaded by explicit setup() at once ("all or nothing").

Now, test-revset.t tests that any revset predicate isn't loaded at
failure of loading extension, because loading itself is executed by
dispatch and it can't be controlled on extension side.
2016-03-08 23:04:53 +09:00
timeless
8f60984480 purge: use absolute_import 2016-03-02 21:39:55 +00:00
timeless
9df52ee9f1 record: use absolute_import 2016-03-02 21:38:32 +00:00
timeless
37728f6a24 relink: use absolute_import 2016-03-02 21:36:14 +00:00
timeless
bf3fcbb8c7 schemas: use absolute_import 2016-03-02 21:33:55 +00:00
timeless
067d78e42f shelve: use absolute_import 2016-03-02 21:30:51 +00:00
timeless
fe1b5c51ca strip: use absolute_import 2016-03-02 21:26:36 +00:00
timeless
09414997c3 rebase: restore help for rebase w/o args (issue5059)
Restoring documentation accidentally removed in 0feae227228d.
2016-01-22 20:32:47 +00:00
Martin von Zweigbergk
c28812c552 shelve: use cg3 for treemanifests
Similar to previous change, this teaches shelve to pick the right
changegroup version for repos that use treemanifests.
2016-01-19 15:37:07 -08:00
timeless
8d9186074f shelve: lowercase flag description
The help for --unknown is the *only* command that started with a capital letter
2016-01-21 00:20:19 +00:00
Mads Kiilerich
e251ec4f82 mq: check for reserved patch name with qimport -r (issue5033)
Fix regression from fd27c5170cac.

Catching aborts might not be pretty but it works and is a small change.
2016-01-19 06:00:59 +01:00
Mads Kiilerich
68f8e91ce2 mq: refactor makepatchname into class method 2016-01-19 06:00:30 +01:00
Gregory Szorc
e2e4daeff4 zeroconf: access repo on hgweb_mod properly (issue5036)
hgweb_mod.hgweb.repo disappeared in 4d6522c4ac11 (hg: establish
a cache for localrepository instances) and the code for accessing repo
instances from hgweb was later refactored to go through a cache-aware
context manager.

Adapt zeroconf to access the repo instance via the new API.
2016-01-17 20:37:29 -08:00
Simon Farnsworth
bbec8fe980 shelve: permit shelves to contain unknown files
If an emergency comes in while you're in the middle of an experimental
change, it can be useful to shelve not just files hg already tracks but
also your unknown files while you handle the emergency. This is
especially true if you have hooks intended to prevent you from
forgetting to add new code before you push.

Teach "hg shelve" to optionally shelve unknown files, not just tracked
files. This is functionally similar to --addremove, but with two
differences:

 1) Deleted files are not removed.
 2) Files added during shelve creation are tracked in extra so that they
    can be forgotten by "hg unshelve".

When unshelving, we take care to only forget files if they've been
created during the unshelve operation; if you add a file that's being
tracked in a shelve as an unknown file, it should not become unknown
again when the shelve is unshelved.
2016-01-14 10:03:31 -08:00
Mads Kiilerich
86e0c59b98 largefiles: actions will now always have a file - drop check 2016-01-17 19:29:27 +01:00
Mads Kiilerich
ac2e1602ce largefiles: make prompt order deterministic
c23a6f1bb59b introduced iteration of a set. Make it stable.
2016-01-17 19:29:27 +01:00
Mads Kiilerich
76651c0e10 largefiles: fix commit of missing largefiles
92117e4f6f8d improved merging of standin files referencing missing largefiles.
It did however not test or fix commits of such merges; it would abort.

To fix that, change copytostore to skip and warn about missing largefiles
with a message similar the one for failing get from remote filestores. (It
would perhaps in both cases be better to emit a more helpful warning like
"warning: standin file for large1 references 58e24f733a which can't be found in
the local store".)

To test this, make sure commit doesn't find the "missing" largefile in the global
usercache. For further testing, verify that update and status works as expected
after this.

This will also effectively backout 159c82dd6523.
2016-01-17 17:23:32 +01:00
Simon Farnsworth
1d446c79cb shelve: move commitfunc closer to use site
Supporting shelving of unknown files needs this code motion.

No functional changes.
2016-01-14 12:52:59 -08:00
Gregory Szorc
bdc9fb8c76 clonebundles: improve BUNDLESPEC documentation
Before the existence of `hg debugbundle --spec`, the process for
defining the BUNDLESPEC value in manifests was not very clear and not
trivial to automate, especially in the case of stream clone bundles.

This patch adds documentation to note the existence of
`hg debugbundle --spec`. We drop the reference to stream clone
requirements handling because it is now redundant with
`hg debugbundle --spec`. While we are here, we further reinforce the
importance of defining BUNDLESPEC.
2016-01-14 22:50:55 -08:00
Bryan O'Sullivan
49db6467b8 with: use a context manager for transaction in strip 2016-01-15 13:14:50 -08:00
Bryan O'Sullivan
8c6b71c1ce with: use context manager in _histedit 2016-01-15 13:14:49 -08:00
Bryan O'Sullivan
cc14be3d13 with: use context manager for transaction in rebase 2016-01-15 13:14:48 -08:00
Bryan O'Sullivan
1ac3200b15 with: use context manager for transaction in qimport 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
a9ed8a0db6 with: use context manager for transaction in qfinish 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
4a70f875ef with: use context manager for transaction in mercurial_sink 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
d7d3b75b31 with: use context manager in qrename 2016-01-15 13:14:50 -08:00
Bryan O'Sullivan
2231de2286 with: use context manager in qfinish 2016-01-15 13:14:50 -08:00
Bryan O'Sullivan
496b2e9b09 with: use context manager in largefiles commit 2016-01-15 13:14:50 -08:00
Bryan O'Sullivan
9c8b627124 with: use context manager in unshelveabort 2016-01-15 13:14:50 -08:00
Bryan O'Sullivan
64b55549f8 with: use context manager for wlock in transplant 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
933b3aaee3 with: use context manager for wlock in shelve stripcmd 2016-01-15 13:14:47 -08:00
Bryan O'Sullivan
9ab24eb658 with: use context manager for lock in continue 2016-01-15 13:14:47 -08:00
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