Commit Graph

27722 Commits

Author SHA1 Message Date
Martin von Zweigbergk
fafdf90374 changegroup: remove now-unused 'wasempty' variable and parameter 2016-01-08 21:14:08 -08:00
Martin von Zweigbergk
417363259e treemanifests: set bundle2 part parameter indicating treemanifest
By adding a mandatory 'treemanifest' parameter in the bundle2 part, we
make it possible for the recipient to set repo requirements before the
manifest revlog is accessed.
2016-01-08 21:13:06 -08:00
timeless
81962ef57d docchecker: scan for missing space before :hg: 2016-01-06 20:05:18 +00:00
timeless
762dcd8732 tests: run docchecker in gendoc.t 2016-01-06 19:57:29 +00:00
timeless
aac4aff929 tests: move gendoc.t runrst comment next to runrst 2016-01-06 19:49:53 +00:00
timeless
70bec9473a docchecker: introduce a way to check for poor markup
Specifically, :hg:`foo 'bar baz'` when rendered by `hg help`
results in:

  'hg foo 'bar baz''

... which is hard to read.

We encourage :hg:`foo "bar baz"` instead.
2016-01-06 19:47:14 +00:00
timeless
45b895c57d minirst: change hgrole to use single quotes
We decided to reserve double quotes for arguments to hg because cmd
does not like single quotes, so switch the outer quotes to single
2016-01-12 06:03:36 +00:00
Mathias De Maré
efbe4fff46 dockerrpm: fix CentOS 5 RPMs (issue4977)
The older rpmbuild in CentOS 5 fails if some of the output directories
have not been created yet. This change results in creating those directories.
2016-01-04 21:21:59 +01:00
Matt Mackall
e204b33962 Added signature for changeset e23e171d6b13 2016-01-02 02:04:32 +01:00
Matt Mackall
c18cb85aff merge with i18n 2016-01-02 01:49:18 +01:00
FUJIWARA Katsunori
d7f83ba96c i18n-ja: synchronized with b1a0b5b8828a 2016-01-01 12:21:11 +09:00
Siddharth Agarwal
a6934b01c3 merge: while checking for unknown files don't follow symlinks (issue5027)
Previously, we were using Python's native 'os.path.isfile' method which follows
symlinks. In this case, since we're operating on repo contents, we don't want
to follow symlinks.

There's a behaviour change here, as shown by the second part of the added test.
Consider a symlink 'f' pointing to a file containing 'abc'. If we try and
replace it with a file with contents 'abc', previously we would have let it
though. Now we don't. Although this breaks naive inspection with tools like
'cat' and 'diff', on balance I believe this is the right change.
2015-12-28 22:51:37 -08:00
Yuya Nishihara
f69357a4da push: restore old behavior of default-push (issue5000)
This effectively backs out 163c899d1e46 and f44b0edaab90.

We can't handle "default-push" just like "default:pushurl" because it is a
stand-alone named path. Instead, I have two ideas to work around the issue:

 a. two defaults: getpath(dest, default=('default-push', 'default'))
 b. virtual path: getpath(dest, default=':default')

(a) is conservative approach and will have less trouble, but callers have
to specify they need "default-push" or "default". (b) generates hidden
":default" path from "default" and "default-push", and callers request
":default". This will require some tricks and won't work if there are
conflicting sub-options valid for both "pull" and "push".

I'll take (a) for default branch. This patch should NOT BE MERGED to default
except for tests because it would break handling of "pushurl" sub-option.
2015-12-26 15:18:16 +09:00
Sean Farley
972541224f crecord: stop raising error.Abort if curses is not found (issue5008)
On some servers, python curses support is disabled. This patch not only fixes
that but provides a fallback on other machines (e.g. Windows) when curses is
not found.

The previous code was actually flawed logic and relied on wcurses throwing an
ImportError which demandimport wouldn't throw. So, this patch also fixes that
problem.
2015-12-16 10:39:00 -08:00
Sean Farley
b03ec18822 cmdutil: use crecordmod.checkcurses
Instead of blindly trusting the user's experimental.crecord, we use checkcurses
to abstract that logic so that we can handle the case where python was not
built with curses.
2015-12-15 16:01:45 -08:00
Sean Farley
38fab65a09 crecord: ensure that curses is False if not imported
This provides no functional change but makes the next two patches easier to
review.
2015-12-15 16:00:06 -08:00
Sean Farley
db61c5aa1f crecord: add helper function to determine if we should use curses
To fix issue5008 properly, we need a helper function to determine if curses is
imported and also if the user has enabled the experimental flag.
2015-12-15 15:56:10 -08:00
Sean Farley
e8a52b93c0 crecord: use try/except for import of curses
Not only does this improve fragility with 'if os.name == ...' it will help
future patches enable the behavior to fallback to use plain record when curses
is unavailable (e.g. python compiled without curses support).
2015-12-16 10:33:19 -08: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
Martin von Zweigbergk
0a6dbcd4ad revlog: fix bad indentation (replace tab by space) 2015-12-18 20:54:41 -08:00
Gregory Szorc
2632a8c77a revlog: seek to end of file before writing (issue4943)
Revlogs were recently refactored to open file handles in "a+" and use a
persistent file handle for reading and writing. This drastically
reduced the number of file handles being opened.

Unfortunately, it appears that some versions of Solaris lose the file
offset when performing a write after the handle has been seeked.

The simplest workaround is to seek to EOF on files opened in a+ mode
before writing to them, which is what this patch does.

Ideally, this code would exist in the vfs layer. However, this would
require creating a proxy class for file objects in order to provide a
custom implementation of write(). This would add overhead. Since
revlogs are the only files we open in a+ mode, the one-off workaround
in revlog.py should be sufficient.

This patch appears to have little to no impact on performance on my
Linux machine.
2015-12-17 17:16:02 -08:00
Yuya Nishihara
317fa85948 paths: port to generic templater
Embedded passwords are masked only in plain output because we'll want raw
values in machine-readable format such as JSON. For custom template, we can
add a filter to mask passwords (e.g. "{url|hidepassword}").

path.rawloc field is called as "url" than "path" because we have "pushurl"
sub-option. Also, "name" and "url" are not allowed as sub-options as they
conflict with the field names.
2015-12-13 22:09:57 +09:00
Yuya Nishihara
5c49dab973 paths: merge conditions that select visibility of fields
Truth table (extracted from the original implementation):

  search quiet  name path subopt
  ------ -----  ---- ---- ------
  f      f      T    T    T
  f      T      T    f    f
  T      f      f    T    f
  T      T      f    f    f
2015-12-13 23:01:19 +09:00
Yuya Nishihara
7e97000e2d paths: use single loop for both search=None|pattern cases
This will help porting to the formatter API. This patch adds test for empty
pathitems to make sure "hg paths" never say "not found!".
2015-12-13 22:02:32 +09:00
Yuya Nishihara
a4711dcd63 paths: reorder else clause for readability of subsequent patches
This prepares for porting to the formatter API. Future patches will use a
single loop to handle both search=None|pattern cases because formatter output
should be the same. "pathitems" will be switched instead.
2015-12-13 21:55:57 +09:00
Yuya Nishihara
14e64b757a paths: drop ui.status label from output of "hg paths name"
We just need to not print path if --quiet. ui.status label is unwanted.
2015-12-13 21:54:00 +09:00
Matt Harbison
f079641319 summary: print unstable, bumped and divergent as unconditionally plural
This aligns with the unconditional plural output for the update line contents,
as well as the incoming/outgoing bookmarks line.  It also matches the message
in evolve's summary hook as of 4f83b2d2d20d.  (Though I thought this was removed
recently?)
2016-01-11 21:00:29 -05:00
Gregory Szorc
ddc771a1b2 debugshell: disable demand importer when importing debugger
For reasons I can't explain (but likely have something to do with a
combination of __import__ inferring default values for arguments and
the demand importer mechanism further assuming defaults), the demand
importer isn't playing well with IPython. Without this patch, we get
a failure "ValueError: Attempted relative import in non-package" when
attempting to import "IPython." The stack has numerous demandimport
calls on it and adding "IPython" to the exclude list in demandimport
isn't enough to make the problem go away, which means the issue is
likely somewhere in the bowells of IPython. It's easier to just disable
the demand importer when importing the debugger.
2016-01-11 18:16:38 -08:00
Martin von Zweigbergk
452bda4582 status: change + back out == clean (API)
After backing out a change, so the file contents is equal to a
previous revision of itself, we currently report the status between
the two equal revisions as modified. This is because
context._buildstatus() reports any file whose new nodeid is not equal
to _newnode as modified. That magic nodeid is given only to files
added or modified in the working directory, so any file whose nodeid
has changed between two revisions will be reported as modified.

Fix by simply comparing the file contents for all cases where the
nodeid changed, whether they are in the working copy or committed.

Marking with (API) as it subtly changes the semantics of the method.
2016-01-04 10:13:29 -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
Mike Hommey
ddcf0dbb88 mdiff: don't emit a diff header for empty trivial deltas
An empty trivial delta, coded as (0, 0, 0) makes the delta application
do nothing, but still takes 12 bytes, while skipping it altogether works
as much, without taking any space at all.
2016-01-11 22:00:07 -05:00
Bryan O'Sullivan
9adb9fb244 commands: get rid of empty try/finally block from _dograft
This diff is purely an indentation change to clean up a block that
was kept in place to make 9e5d088542ab easier to read.
2016-01-11 09:49:48 -08:00
Bryan O'Sullivan
eff9c7d54a commands: get rid of empty try/finally block from _dobackout
This diff is purely an indentation change to clean up a block that
was kept in place to make 4645e52058b4 easier to read.
2016-01-11 09:49:47 -08:00
Bryan O'Sullivan
459e92e905 commands: get rid of empty try/finally block from import_
This diff is purely an indentation change to clean up a block that
was kept in place to make 760a55541ca3 easier to read.
2016-01-11 09:49:39 -08:00
Gregory Szorc
054fcca201 streamclone: use context manager for writing files
These are the file writes that have the most to gain from background
I/O. Plug in a context manager so I can design the background I/O
mechanism with context managers in mind.
2016-01-02 15:09:58 -08:00
Gregory Szorc
562be47d7a scmutil: use context managers for file handles
Now that we dropped support for Python 2.4, we are able to use context
managers. Let's replace the try..finally pattern in scmutil.py with
context managers, which close files automatically when the context
manager is exited.

There should be no change in behavior with this patch.

Why convert to context managers if nothing is broken? I'm working on
closing file handles in background threads to improve performance on
Windows. As part of this, I realized there could be some future issues
if the background file closing code isn't designed with context
managers in mind. So, I'd like to switch some code to context managers
so I can design an API that works with context managers.
2016-01-02 15:19:47 -08:00
Gregory Szorc
00047aaef6 statichttprepo: implement __enter__ and __exit__ on httprangeheader
httprangeheader behaves like a file object. Implement __enter__ and
__exit__ so it can be used as a context manager, just like file objects.
2016-01-02 15:33:01 -08:00
Gregory Szorc
d467f4fac0 osutil: implement __enter__ and __exit__ on posixfile
So they can be used as context managers.
2016-01-02 16:41:57 -08:00
Bryan O'Sullivan
e1c353db12 util: introduce ctxmanager, to avoid nested try/finally blocks
This is similar in spirit to contextlib.nested in Python <= 2.6,
but uses an extra level of indirection to avoid its inability to
clean up if an __enter__ method raises an exception.

Why add this mechanism?  It greatly simplifies scoped resource
management, and lets us eliminate several hundred lines of try/finally
blocks.  In many of these cases the "finally" is separated from the
"try" by hundreds of lines of code, which makes the connection
between resource acquisition and disposal difficult to follow.

(The preferred mechanism would be the "multi-with" syntax of 2.7+,
but Mercurial can't move to 2.7 for a while.)

Intended use:

>>> with ctxmanager(lambda: file('foo'), lambda: file('bar')) as c:
>>>    f1, f2 = c()

This will open both foo and bar when c() is invoked, and will close
both upon exit from the block.  If the attempt to open bar raises
an exception, the block will not be entered - but foo will still
be closed.
2016-01-11 15:25:43 -08:00
timeless
16cc66dbc7 hghave: support HGMODULEPOLICY for pure
HGMODULEPOLICY was introduced in 78e8dae3a240
2016-01-11 23:13:34 +00:00
Matt Mackall
bff462ca2a merge with stable 2016-01-11 14:27:12 -06:00
Matt Mackall
85a2438e14 tests: extend check-commit self-tests
This now contains both positive and negative tests for almost all the
check-commit rules.
2016-01-08 12:07:15 -06:00
Matt Mackall
6824529f1e encoding: handle UTF-16 internal limit with fromutf8b (issue5031)
Default builds of Python have a Unicode type that isn't actually full
Unicode but UTF-16, which encodes non-BMP codepoints to a pair of BMP
codepoints with surrogate escaping. Since our UTF-8b hack escaping
uses a plane that overlaps with the UTF-16 escaping system, this gets
extra complicated. In addition, unichr() for codepoints greater than
U+FFFF may not work either.

This changes the code to reuse getutf8char to walk the byte string, so we
only rely on Python for unpacking our U+DCxx characters.
2016-01-07 14:57:57 -06:00