Commit Graph

27722 Commits

Author SHA1 Message Date
timeless
6128260f9d check-commit: sort errors by line number 2016-01-12 08:34:38 +00:00
timeless
f4c0ab7d00 check-commit: try to fix multiline handling
The old code did not understand the difference between the first line of the summary,
and a random line in the summary that happened to include a #, or a
random line in the changes that happened to include it.

7c3798ffdc0c is an example where it fails
2016-01-12 08:50:15 +00:00
timeless
c4f6fb8fc2 check-commit: support REVs as commandline arguments
usage:
* HG_NODE=REV check-commit
* hg export REV | check-commit
* check-commit REV ...
2016-01-07 01:28:59 +00:00
timeless
971508cd4e check-commit: modularize 2016-01-07 00:55:45 +00:00
timeless
149f294053 check-commit: fix summary length regexp 2016-01-07 03:58:40 +00:00
Bryan O'Sullivan
0393e42ac3 util: simplify file I/O functions using context managers 2016-01-12 14:49:35 -08:00
Bryan O'Sullivan
c54f58f09c run-tests: use a context manager for file I/O in TextTestRunner 2016-01-12 14:49:10 -08:00
Bryan O'Sullivan
a2111cb180 bundlerepo: use context manager for file I/O in _writetempbundle 2016-01-12 14:48:27 -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
100ad2a9c4 run-tests: use a context manager for file I/O 2016-01-12 14:29:57 -08:00
Bryan O'Sullivan
ebfc6943c7 largefiles: use util.readfile in overrides 2016-01-12 14:29:34 -08:00
Bryan O'Sullivan
6ed7a94e8f commands: use a context manager for file I/O in debugdiscovery 2016-01-12 14:28:43 -08:00
Bryan O'Sullivan
425505f93a check-seclevel: use a context manager for file I/O 2016-01-12 14:28:16 -08:00
Bryan O'Sullivan
f936f9a539 largefiles: use a context manager in _getfile 2016-01-12 14:27:42 -08:00
Bryan O'Sullivan
a6e4850fe2 util: replace file I/O with readfile 2016-01-12 16:16:19 -08:00
Bryan O'Sullivan
c490d3c96d patchbomb: replace file I/O with util.readfile 2016-01-12 15:57:18 -08:00
Matt Harbison
4fc4388f40 util: adjust hgcmd() to handle frozen Mercurial on OS X
Previously, 'hg serve -d' was trying to exec the bundled python executable,
which failed with:

    Unknown option: --
    usage: python [option] ...
    Try 'python -h'...
    abort: child process failed to start

See the previous patch for details about the content of the various command
variables.  Note that unlike the previous patch here an application bundling
Mercurial could set $HG in the environment to get the correct result, there
isn't anything that a bundling application could do to get the correct result
here.

'hg serve -d' now launches under TortoiseHg, and there is a process listed in
the background, but a client process cannot connect to it for some reason, so
more investigation is needed.
2016-01-10 18:15:39 -05:00
Matt Harbison
c25bbe3998 util: adjust hgexecutable() to handle frozen Mercurial on OS X
sys.executable is "$appbundle/Contents/MacOS/python" when Mercurial is bundled
in a frozen app bundle on OS X, so that isn't appropriate.  It appears that this
was only visible for things launched via util.system(), like external hooks,
where $HG was set wrong.

It appears that Mercurial also uses 'sys.modules['__main__'].__file__' (here)
and 'sys.argv[0]' (in platform.gethgcmd()) to figure out the command to spawn.
In both cases, this points to "$appbundle/Contents/Resources/hg", which invokes
the system python since "/usr/bin/env python" is on the shebang line.  On my
system with a screwed up python install, I get an error importing the os module
if this script is invoked.

We could take the dirname of sys.executable and join 'hg' instead of this if we
want to be paranoid, but py2app boostrap is setting the environment variable
since 0.1.6 (current version is 0.9), so it seems safe and we might as well use
it.
2016-01-10 17:56:08 -05:00
Matt Harbison
38b5ec9395 util: adjust 'datapath' to be correct in a frozen OS X package
Apparently unlike py2exe, py2app copies the Mercurial source tree as-is to a
Contents/Resources subdirectory of an app bundle, and places its binary stub in
Contents/MacOS.  (The Windows install has the 'hgext' and 'mercurial' modules in
'lib/library.zip', while the help and templates subdirectories have been moved
out of the mercurial directory to the root of the installation.  I assume that
the python code living in a zip file is why "py2exe doesn't support __file__".)
Therefore, prior to this change, Mercurial in a frozen app bundle on OS X would
go looking for help *.txt, templates and locale info in Contents/MacOS, where
they don't exist.

There are only a handful of places that test for frozen, and not all of them are
wrong for OS X, so it seems wiser to handle them on a case by case basis, rather
that try to change mainfrozen().  The remaining cases are:

  1) util.hgexecutable() wrongly points to the bundled python executable, and
       affects $HG in util.system() launched processes (e.g. external hooks)
  2) util.hgcmd() wrongly points to the bundled python executable, but it seems
       to only affect 'hg serve -d'
  3) hook._pythonhook() may be OK, since I didn't see anything outrageous when
       printing sys.path from an internal hook.  I'm not sure if this special
       case is needed on OS X though.
  4) sslutil._plainapplepython() is OK, because sys.executable is not
       /usr/bin/python, nor is it in /System/Library/Frameworks
2016-01-10 17:49:01 -05:00
timeless
308696c2c1 help: add --system flag to get help for various platform(s) 2016-01-10 08:03:58 +00:00
timeless
37f93db811 help: split config user settings file by platform 2016-01-10 06:21:40 +00:00
timeless
d05d0d9e2a help: label windows config help 2016-01-10 06:09:10 +00:00
timeless
bbce78ebf9 help: split out unix/plan9 config help 2016-01-10 06:08:41 +00:00
timeless
530505bb62 help: move config default marking to its own line 2016-01-10 05:58:02 +00:00
timeless
ddf5627fa5 help: split config ui.portablefilenames 2016-01-10 05:04:49 +00:00
Matt Harbison
6c73049b2c test-hgignore: add globs for Windows 2016-01-12 22:40:40 -05:00
Matt Mackall
4e3861c902 tests: run check-commit on secret changes too 2016-01-11 11:35:28 -06:00
Augie Fackler
68c57ea46e util: don't capture exception with a name since we don't use it
Spotted by pyflakes.
2016-01-13 14:41:10 -05:00
Martin von Zweigbergk
d9bf44d310 changegroup3: move treemanifest support into _unpackmanifests()
By putting the treemanifest code in _unpackmanifests(),
_addchangegroupfiles() will only be about files again, and we get a
nice symmetry between _packmanifests() and _unpackmanifest(). The
immediate benefit to me is that remotefilelog should not need to be
updated to work with treemanifests. It should also make
server.validate and progress output easier to get right. Probably
bundlerepo too.
2016-01-08 16:12:58 -08:00
Martin von Zweigbergk
87d65b1188 changegroup3: add empty chunk separating directories and files
Remotefilelog overrides changegroup._addchangegroupfiles(), assuming
it is about files, which seems like a natural assumption. However, in
changegroup3, directory manifests are sent in the files section of the
changegroup. These naturally make remotefilelog unhappy.

The fact that the directories are not separated from the files
(although they do come before the files) also makes server.validate
harder to implement. Since we read one chunk at a time from the steam,
once we have found a file (non-directory) entry in the stream, we
would have to push the read data back into the stream, or otherwise
refactor the code. It will be easier if we add an empty chunk after
all directory manifests.

This change adds that empty chunk, although we don't yet take
advantage of it on the reading side. We will soon move the tree
manifest stuff out of _addchangegroupfiles() and into
_unpackmanifests().
2016-01-11 15:10:31 -08:00
Martin von Zweigbergk
63c15f247e changegroup3: introduce experimental.changegroup3 boolean config
In order to give us the freedom to change the changegroup3 format,
let's hide it behind an experimental config. Since it is required by
treemanifests, that will override the cg3 config.
2016-01-12 21:23:45 -08:00
Martin von Zweigbergk
e5bd6473b3 changegroup: hide packermap behind methods
This is to prepare for hiding changegroup3 behind a config option.
2016-01-12 21:01:06 -08:00
Matt Mackall
cfd1f81556 merge with stable 2016-01-13 15:47:37 -06:00
Martin von Zweigbergk
9df2a9ac77 context: check for differing flags a little earlier
This makes it clearer that a unchanged file whose flags have changed
will be reported as a modification. Also test this.
2016-01-12 13:10:31 -08:00
Martin von Zweigbergk
a5a17ed71f context: clarify why we don't compare file contents when nodeid differs
See previous commit for timing information.
2016-01-12 13:09:54 -08:00
Martin von Zweigbergk
a883bc954a status: back out changeset 7e679fd51132
This backs out 7e679fd51132 (status: change + back out == clean (API),
2016-01-04). Although correct, it turned out that it was just too
slow. For example, 'hg status --rev .~1000 --rev .' on the Mozilla
repo went from <1s to >30s on cold disk. So we go back to reporting
reverted changes as modified instead of clean. These are rare anyway,
as suggested by the fact that it had been broken since before
Mercurial 2.0.
2016-01-12 12:43:36 -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
Matt Harbison
c9494f82f5 test-status: stabilize for no-execbit platforms
The preceding #if conditional was the only modification to the file, so the
"reverting file" line in the subsequent revert command was getting dropped.
2016-01-13 00:09:26 -05:00
Siddharth Agarwal
46071bce0e merge: split up checks for unknown and ignored files that differ
In some real-world cases it is preferable to allow overwriting ignored files
while continuing to abort on unknown files. This primarily happens when we're
replacing build artifacts (which are ignored) with checked in files, but
continuing to abort on differing files that aren't ignored.

We're redefining merge.checkunknown to only control the behavior for files
that aren't ignored. That's fine because this config was only very recently
introduced and has not made its way into any Mercurial releases yet.
2016-01-12 18:38:49 -08:00
Siddharth Agarwal
0914e3c659 merge: determine what untracked conflicts cause warns and aborts separately
This is written in a somewhat weird style, but it's designed for code reuse in
an upcoming patch.
2016-01-12 18:17:07 -08:00
Siddharth Agarwal
03971ff0e5 merge: factor out code to get checkunknown config
We're going to reuse this code shortly.
2016-01-12 18:12:35 -08:00
Sean Farley
5e2327758b unionrepo: fix wrong rev being checked in iscensored (issue5024) 2016-01-06 11:01:55 -08:00
Gábor Stefanik
75370c2faf sslutil: fix reversed logic (issue5034) 2016-01-08 16:27:25 +01:00
Mateusz Kwapich
6688b1c845 hooks: add HG_NODE_LAST to txnclose and changegroup hook environments
Sometimes a txnclose or changegroup hook wants to iterate through all
the changesets in transaction: in that situation usually the revset
`$HG_NODE:` is used to select the revisions. Unfortunately this revset
sometimes may contain too many changesets because we don't have the
write lock while the hook runs newer changes may be added to
repository in the meantime.

That's why there is a need for extra variable carrying the information about
the last change in the transaction.
2016-01-05 17:37:59 -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