Commit Graph

30485 Commits

Author SHA1 Message Date
Yuya Nishihara
1ee0acbf35 commit: update test to actually modify template text
We have a check for unmodified commit message (introduced by 86ed6abe3c2a),
which should be enabled for the "--- >8 ---" magic but currently not.
2017-01-06 22:44:39 +09:00
Jun Wu
d337e8bfd0 pager: wrap ui._runpager
As discussed at [1], ui._runpager will be the new low-level API accepting a
pager command to actually run the pager. And ui.pager is the high-level API
which reads config directly from self.

This change is necessary for chgserver to override _runpager cleanly.

[1]: www.mercurial-scm.org/pipermail/mercurial-devel/2016-December/091656.html
2016-12-26 00:25:44 +00:00
Denis Laxalde
6dab59dff8 summary: use ui.label and join to write evolution troubles
Follow-up on da7b2bf5ad52 to avoid a convoluted loop.
2017-01-07 12:24:15 +01:00
Denis Laxalde
ea885ed1d6 log: drop unnecessary ui.note label from "trouble: " line
Follow-up on 38b8a4a2230c and 3f2425cfd46f.
2017-01-07 12:07:56 +01:00
Denis Laxalde
20d1dad252 revset: add a followlines(file, fromline, toline[, rev]) revset
This revset returns the history of a range of lines (fromline, toline) of a
file starting from `rev` or the current working directory.

Added tests in test-annotate.t which already contains a reasonably complex
repository.
2017-01-04 16:47:49 +01:00
Denis Laxalde
7092fa95d8 context: add a blockancestors(fctx, fromline, toline) function
This yields ancestors of `fctx` by only keeping changesets touching the file
within specified linerange = (fromline, toline).

Matching revisions are found by inspecting the result of `mdiff.allblocks()`,
filtered by `mdiff.blocksinrange()`, to find out if there are blocks of type
"!" within specified line range.

If, at some iteration, an ancestor with an empty line range is encountered,
the algorithm stops as it means that the considered block of lines actually
has been introduced in the revision of this iteration. Otherwise, we finally
yield the initial revision of the file as the block originates from it.

When a merge changeset is encountered during ancestors lookup, we consider
there's a diff in the current line range as long as there is a diff between
the merge changeset and at least one of its parents (in the current line
range).
2016-12-28 23:03:37 +01:00
Denis Laxalde
dc8e8fcbf9 mdiff: add a "blocksinrange" function to filter diff blocks by line range
The function filters diff blocks as generated by mdiff.allblock function based
on whether they are contained in a given line range based on the "b-side" of
blocks.
2017-01-03 18:15:58 +01:00
Jun Wu
3ca85be38e run-tests: unset CHGDEBUG
With CHGDEBUG, chg outputs much more stuff and the test could fail running
with --chg. So unset the environment variable.
2017-01-06 16:19:41 +00:00
Denis Laxalde
5e3ca8d1ab summary: add evolution "troubles" information to summary output
Extend the "parent: " lines in summary with the list of evolution "troubles"
in parentheses, when the parent is troubled.
2017-01-06 14:35:22 +01:00
Denis Laxalde
8ebbb5679b summary: use the same labels as log command in "parent: " line
Re-use the cmdutil._changesetlabels function introduced in c400c86d547f to
have consistent labels between the "changeset: " line in log command and the
"parent: " line in summary.
2017-01-06 14:34:34 +01:00
Denis Laxalde
b2aed04403 templates: display evolution "troubles" in command line style 2017-01-06 13:50:52 +01:00
Denis Laxalde
0c89f1cb3e templatekw: add a "troubles" template keyword
The "troubles" template keyword returns a list of evolution troubles.
It is EXPERIMENTAL, as anything else related to changeset evolution.

Test it in test-obsolete.t which has troubled changesets.
2017-01-06 13:50:16 +01:00
Denis Laxalde
1bc2883779 test: test "trouble: " line in log output with multiple troubles
Follow-up on 38b8a4a2230c.
2017-01-06 15:48:22 +01:00
Denis Laxalde
627f47db5c cmdutil: add missing "i18n" comment about "trouble: " line
Follow-up on 38b8a4a2230c per late review.
2017-01-06 12:36:21 +01:00
Valters Vingolds
ec79496a8a rebase: use repo.vfs.exists in 'hg summary' hook 2017-01-06 09:58:41 +01:00
Gregory Szorc
05ec82c913 hgweb: link to raw-file on annotation page (BC)
Every other template has the "raw" link load "raw-file." However,
fileannotate.tmpl's "raw" link loads "raw-annotate." This feels
inconsistent and wrong.

As far as I can tell, linking to the "raw annotate" view has occurred
since 2006.
2016-12-28 15:48:17 -07:00
Martin von Zweigbergk
e1f0ba8ef9 repair: combine two loops over changelog revisions
This just saves a few lines.
2017-01-04 10:35:04 -08:00
Martin von Zweigbergk
92d0334538 repair: speed up stripping of many roots
repair.strip() expects a set of root revisions to strip. It then
builds the full set of descedants by walking the descandants of
each. It is rare that more than a few roots get passed in, but if that
happens, it will wastefully walk the changelog for each root. So let's
just walk it once.

I noticed this because the narrowhg extension was passing not only
roots, but all the commits to strip. When there were tens of thousands
of commits to strip, this resulted in quadratic behavior with that
extension.
2017-01-04 10:07:12 -08:00
Anton Shestakov
62425d536d make: remove targets for building packages for ubuntu wily (end of life)
Ubuntu 15.10 (Wily Werewolf) came out on October 22, 2015 and reached end of
life on July 28, 2016 [1]. Users were encouraged to upgrade to 16.04 (Xenial).

PPA doesn't allow new uploads targeting 15.10 anymore.

[1]: https://wiki.ubuntu.com/Releases
2017-01-06 09:56:40 +08:00
Sean Farley
7f456ac7c6 config: add docs for ignoring all text below in the editor
This is an example of how to use the new skip-from-there string for ignoring the
diff in a commit message.
2017-01-04 22:32:42 -06:00
Sean Farley
52b92c45af cmdutil: add special string that ignores rest of text
Similar to git, we add a special string:

  HG: ------------------------ >8 ------------------------

that means anything below it is ignored in a commit message.

This is helpful for integrating with third-party tools that display the
2016-12-31 15:36:36 -06:00
Yuya Nishihara
a7a60a2e43 revset: drop TODO comment about sorting issue of fullreposet
The bootstrapping issue was addressed at the parsing phase and we expect
that fullreposet.__and__() fully complies to the smartset API, in which
'self & other' should return a result set in self's order. See also
ab938e7ae803.
2016-05-14 20:52:44 +09:00
Yuya Nishihara
2fa6a1e65e revset: document wdir() as an experimental function
Let's resurrect the docstring since our help module can detect the EXPERIMENTAL
tag and display it only if -v is specified.

This patch updates the test added by bbdfa2d5aaa2 since wdir() is now
documented.
2017-01-05 22:53:42 +09:00
Yuya Nishihara
ec99971228 revset: categorize wdir() as very fast function
The cost of wdir() should be identical to or cheaper than _intlist().
2016-08-20 17:50:23 +09:00
Yuya Nishihara
14fa3ba925 revset: make children() not look at p2 if null (issue5439)
Unlike p1 = null, p2 = null denotes the revision has only one parent, which
shouldn't be considered a child of the null revision. This was spotted while
fixing the issue4682 and rediscovered as issue5439.
2015-05-23 11:04:11 +09:00
Gregory Szorc
e72b99afbe setup: pass named argument to setup_zstd
The next release from upstream adds another named argument to this
function. Specify arguments by name so there is no ambiguity about
which argument is being passed.
2017-01-04 19:17:44 -08:00
Augie Fackler
067ebafd12 merge with stable 2017-01-04 14:52:59 -05:00
Kevin Bullock
0739fd0985 Added signature for changeset 3b19e7c09571 2017-01-04 10:51:37 -06:00
Denis Laxalde
d53254ecde templates-default: factor out definition of changeset labels
This is redundant for normal and debug mode and prepares extension of this
list that should effect both modes.
2017-01-03 13:25:29 +01:00
FUJIWARA Katsunori
09901b0e62 i18n-ja: synchronized with ba32670f6070 2016-12-31 17:19:09 +09:00
Yuya Nishihara
c175ab72eb posix: make poll() restart on interruption by signal (issue5452)
select() is a notable example of syscalls which may fail with EINTR. If we
had a SIGWINCH handler installed, ssh would crash when the terminal window
was resized. This patch fixes the problem.
2016-12-22 23:14:13 +09:00
Yuya Nishihara
3379250232 demandimport: do not raise ImportError for unknown item in fromlist
This is the behavior of the default __import__() function, which doesn't
validate the existence of the fromlist items. Later on, the missing attribute
is detected while processing the import statement.

https://hg.python.org/cpython/file/v2.7.13/Python/import.c#l2575

The comtypes library relies on this (maybe) undocumented behavior, and we
got a bug report to TortoiseHg, sigh.

https://bitbucket.org/tortoisehg/thg/issues/4647/

The test added at 0be19b069edf verifies the behavior of the import statement,
so this patch only adds the test of __import__() function and works around
CPython/PyPy difference.
2016-12-19 22:46:00 +09:00
Anton Shestakov
dc9f869036 hgweb: add missing slash to file log url in rss style 2016-12-08 23:59:36 +08:00
Kevin Bullock
4cdf2cb0d1 Added signature for changeset 6c3b7e698555 2016-12-01 14:13:28 -06:00
Wagner Bruna
8125fda43a i18n-pt_BR: synchronized with bb96c28331a8 2016-11-25 07:39:02 -02:00
Mads Kiilerich
9c5f48e630 shelve: add missing space in help text
The change is trivial and unlikely to have been translated so we update
translation files too.
2016-11-14 22:43:25 +01:00
FUJIWARA Katsunori
367ebf8ba3 scmutil: ignore EPERM at os.utime, which avoids ambiguity at closing
According to POSIX specification, just having group write access to a
file causes EPERM at invocation of os.utime() with an explicit time
information (e.g. working on the repository shared by group access
permission).

To ignore EPERM at closing file object in such case, this patch makes
checkambigatclosing._checkambig() use filestat.avoidambig() introduced
by previous patch.

Some functions below imply this code path at truncation of an existing
(= might be owned by another user) file.

  - strip() in repair.py, introduced by 4d0a08431b6f
  - _playback() in transaction.py, introduced by 48fe04792102

This is a variant of issue5418.
2016-11-13 06:12:22 +09:00
FUJIWARA Katsunori
11742ce806 vfs: ignore EPERM at os.utime, which avoids ambiguity at renaming (issue5418)
According to POSIX specification, just having group write access to a
file causes EPERM at invocation of os.utime() with an explicit time
information (e.g. working on the repository shared by group access
permission).

To ignore EPERM at renaming in such case, this patch makes
vfs.rename() use filestat.avoidambig() introduced by previous patch.
2016-11-13 06:11:56 +09:00
FUJIWARA Katsunori
64644e300c util: add utility function to skip avoiding file stat ambiguity if EPERM
Now, advancing stat.st_mtime by os.utime() is used to avoid file stat
ambiguity. But according to POSIX specification, utime(2) with an
explicit time information is permitted only for a process with:

  - the effective user ID equal to the user ID of the file, or
  - appropriate privileges

  http://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html

Therefore, just having group write access to a file causes EPERM at
applying os.utime() on it (e.g. working on the repository shared by
group access permission).

This patch adds class filestat utility function avoidamgig() to avoid
file stat ambiguity but skip it if EPERM.

It is reasonable to always ignore EPERM, because utime(2) causes EPERM
only in the case described above (EACCES is used only for utime(2)
with NULL).
2016-11-13 06:06:23 +09:00
Gregory Szorc
085fa86140 hgweb: cache fctx.parents() in annotate command (issue5414)
43e3fb1c484e introduced a call to fctx.parents() for each line in
annotate output. This function call isn't cheap, as it requires
linkrev adjustment.

Since multiple lines in annotate output tend to belong to the same
file revision, a cache of fctx.parents() lookups for each input
should be effective in the common case. So we implement one.

Since the cache has to precompute parents so an aborted generator
doesn't leave an incomplete cache, we could just return a list.
However, we preserve the generator for backwards compatibility.

The effect of this change when requesting /annotate/96ca0ecdcfa/
browser/locales/en-US/chrome/browser/downloads/downloads.dtd on
the mozilla-aurora repo is significant:

p1(43e3fb1c484e)  5.5s
43e3fb1c484e:    66.3s
this patch:      10.8s

We're still slower than before. But only by ~2x instead of ~12x.

On the tip revisions of layout/base/nsCSSFrameConstructor.cpp file in
the mozilla-unified repo, time went from 12.5s to 14.5s and back to
12.5s. I'm not sure why the mozilla-aurora repo is so slow.

Looking at the code of basefilectx.parents(), there is room for
further improvements. Notably, we still perform redundant calls to
filelog.renamed() and basefilectx._parentfilectx(). And
basefilectx.annotate() also makes similar calls, so there is potential
for object reuse. However, introducing caches here are not appropriate
for the stable branch.
2016-11-05 09:38:07 -07:00
Augie Fackler
95a87ffb9b Added signature for changeset 9506ee30a64d 2016-11-01 14:12:39 -04:00
Kevin Bullock
e51456912a merge with i18n 2016-11-01 13:03:42 -05:00
Nathan Goldbaum
cd41ee4190 tag: clarify warning about making a tag on a branch head
Currently the warning is ambiguous about whether the new tag (possibly specified
via --rev) is being added on a branch head or whether the working directory is
based on a branch head. Clarify the error message to eliminate this ambiguity.
2016-10-31 17:12:32 -05:00
FUJIWARA Katsunori
33379270bf contrib: check reference to old selenic.com domain
Now, all URL in Mercurial source tree should refer mercurial-scm.org
domain instead of selenic.com.

*.po files are ignored in this patch, because they might contain
msgid/msgstr coming from old source files.

This ignorance seems safe enough, because such msgstr should be
ignored at runtime, because:

  - msgid corresponded to it should be invalid, or
  - msgstr itself should be marked as fuzzy at synchronized to recent hg.pot

If any additional examination for *.po files is needed in the future,
let i18n/check-translation.py achieve such examination.

BTW, some binary files (e.g. *.png) are meaningless for checking
reference to old domain in this patch, but aren't ignored like as *.po
files, because excluding multiple suffixes is difficult for regexp
matching.
2016-11-01 20:39:37 +09:00
FUJIWARA Katsunori
9616956afd check-code: discard filtering result of previous check for independence
Before this patch, check-code.py applies filtering on the file
content, to which filtering of previous check is already applied.

This might hide issues, which should be detected by a subsequent check
in "checks" list.

Fortunately, this problem hasn't appeared, because there is no
overlapping of filename matching (examined in the order below).

  1. *.py or *.cgi
  2. test-* (not *.t suffix)
  3. *.c or *.h
  4. *.t
  5. *.txt
  6. *.tmpl

For example, adding a test, which wants to examine raw comment text in
*.py files, at the end of current "checks" list doesn't work as
expected, because a filter for *.py files normalizes comment text in
them.

Putting such test at the beginning of "checks" list also resolves this
problem, but such dependence on the order decreases maintainability of
check-code.py itself.

This patch discards filtering result of previous check at the
beginning of each checks, for independence of each checks.
2016-11-01 20:39:36 +09:00
FUJIWARA Katsunori
38ad72f729 help: replace selenic.com by mercurial-scm.org in man pages
Source code repository and mailing list services have been already
migrated to mercurial-scm.org domain.
2016-11-01 20:39:36 +09:00
FUJIWARA Katsunori
15640c5749 help: replace selenic.com by mercurial-scm.org in command examples
Source code repository service of Mercurial itself has been already
migrated to mercurial-scm.org domain.
2016-11-01 20:39:35 +09:00
Yuya Nishihara
26d053eede hghave: fix 'rmcwd' to ensure temporary directory is removed
On platforms where cwd can't be removed, it should try rmdir() after chdir
to the original cwd.
2016-11-01 21:14:33 +09:00
FUJIWARA Katsunori
01dbfe3b9d i18n-ja: synchronized with 7b9e11755707 2016-11-01 04:27:41 +09:00
Mads Kiilerich
40ab99f130 httppeer: make __del__ access to self.urlopener more safe
Some errors could in some cases show unfortunate scary and confusing warnings
from the httppeer delstructors:

  abort: nodename nor servname provided, or not known
  Exception AttributeError: "'httpspeer' object has no attribute 'urlopener'" in <bound method httpspeer.__del__ of <mercurial.httppeer.httpspeer object at 0x106e1f5d0>> ignored```

To mute that, take 8bdb0bb8e209 to the next level and use getattr in __del__.
2016-10-31 13:43:48 +01:00