Commit Graph

25699 Commits

Author SHA1 Message Date
Yuya Nishihara
a85993b95a revset: port parsing rule of old-style ranges from scmutil.revrange()
The old-style parser will be removed soon.
2015-07-18 23:30:17 +09:00
Yuya Nishihara
137f249748 debugrevspec: pass lookup function to visualize fallback mechanism
The next patch will move the exceptional parsing of old-style ranges
to revset.tokenize(). This patch will allow us to see the result tree.

Note that the parsing result of '-a-b-c-' is incorrect at this changeset.
It will be fixed soon.
2015-07-18 23:02:18 +09:00
Anton Shestakov
73dce8b9d6 highlight: exit early on textual and unknown files (issue3005)
When highlight extension encountered files that pygments didn't recognize, it
used to fall back to text lexer. Also, pygments uses TextLexer for .txt files.
This lexer is noop by design.

On bigger files, however, doing the noop highlighting resulted in noticeable
extra CPU work and memory usage: to show a 1 MB text file, hgweb required about
0.7s more (on top of ~3.8s, Q8400) and consumed about 100 MB of RAM more (on
top of ~150 MB).

Let's just exit the function when it's clear that nothing will be highlighted.

Due to how this pygmentize function works (it modifies the template in-place),
we can just return from it and everything else will work as if highlight
extension wasn't enabled.
2015-08-02 19:18:35 +08:00
Pierre-Yves David
a2cfbc8b70 histedit: extract a simpler function to process replacement on abort
The process replacement is building a full mapping to allow moving bookmarks and
creating obsolescence marker. We do not need the full logic for abort so we
extract it. It will be useful as abort is missing some data about the
replacement and can crash when third party extensions push it a bit too far.
2015-08-03 14:16:51 -07:00
Pierre-Yves David
d41570d94c merge with stable 2015-08-03 14:05:42 -07:00
Pierre-Yves David
6b2961e47a histedit: backout 3e883e7ec57b
The faulty changeset use obsolescence marker to roll the repository back on
--abort. This is a problematic approach because --abort should be as close as an
actually transaction rollback as possible stripping all created data from the
repository (cf `hg rebase --abort` stripping all created changesets). Instead
3e883e7ec57b made all content created during the aborted histedit still
available in the repository adding obsolescence marker to make them hidden. This
will cause trouble to evolution user as a re-run of the same histedit (with
success) will likely result in the very same node to be "recreated" while
obsolescence marker would be in place for them. And canceling an obsoletion is
still a fairly complicated process.

This also rollback using obsmarkers instead of strip to clean up temporary node
on successful histedit run because the two change were not split in separated
changeset. Rolling that part back does not have significant consequence a will
have to be resubmitted independently
2015-07-31 15:11:07 -07:00
Matt Mackall
2721e01d73 Added signature for changeset 99a2ae70688b 2015-07-31 11:56:28 -05:00
Matt Mackall
d585ecbe64 i18n: fix unclosed inline span in pt_BR
This was causing test-gendoc.t to complain:

WARNING: Inline interpreted text or phrase reference start-string
without end-string.
2015-07-31 10:49:15 -05:00
Matt Mackall
43b8b00309 merge with i18n 2015-07-31 10:26:57 -05:00
FUJIWARA Katsunori
895418cefb i18n-ja: synchronized with bcb4578674eb 2015-07-31 18:39:48 +09:00
Wagner Bruna
1a4e90ed7e i18n-pt_BR: synchronized with 6aaad589ef8a 2015-07-29 11:37:36 -03:00
Matt Harbison
e8c6c3b443 dirstate: ensure mv source is marked deleted when walking icasefs (issue4760)
Previously, importing a case-only rename patch on a case insensitive filesystem
caused the original file to be marked as '!' in status.  The source was being
forgotten properly in patch.workingbackend.close(), but the call it makes to
scmutil.marktouched() then put the file back into the 'n' state (but it was
still missing from the filesystem).

The cause of this was scmutil._interestingfiles() would walk dirstate,
and since dirstate was able to lstat() the old file via the new name,
was treating this as a forgotten file, not a removed file.
scmutil.marktouched() re-adds forgotten files, so dirstate got out of
sync with the filesystem.

This could be handled with less code in the "kind == regkind or kind
== lnkkind" branch of dirstate._walkexplicit(), but this avoids
filesystem accesses unless case collisions occur. _discoverpath() is
used instead of normalize(), since the dirstate case is given first
precedence, and the old file is still in it. What matters is the
actual case in the filesystem.
2015-07-27 21:27:24 -04:00
Matt Harbison
eea8aa5335 extdiff: allow modifications in subrepos to be copied back
This check was a legacy bit from when the file data was being fetched manually
with 'ctx[wfn]', but archive() does that now.  2032c5b369f5 seems to indicate
that this avoided a problem where a merge adds a file to another branch, and
that test still passes.

Unfortunately, I don't see a way to create a test that modifies the file in the
temporary directory before the command exits.

I wonder if the os.lstat() call needs to be wrapped in an exception handler for
the case where archive didn't create a file because the file didn't exist in
that revision.  But I wasn't able to trigger a problem without it on a real
repository.
2015-07-27 17:39:09 -04:00
Yuya Nishihara
445c9fa91e ignore: fix path concatenation of .hgignore on Windows
Since 862fc5f60fef, .hgignore is ignored on Windows because a pat may have
a drive letter, but pathutil.join is posixpath.join.

  "z:\foo\bar/z:\foo\bar\.hgignore"

Instead, this patch uses os.path.join() and util.localpath() to process both
parts as file-system paths.

Maybe we can remove os.path.join() at dirstate._ignore because 'include:' is
resolved relative to repo root? It was introduced by 29ce78e5f35c.
2015-07-27 22:14:40 +09:00
Wagner Bruna
f6ce8ccc47 repair: fix typo in warning message 2015-07-26 09:28:52 -03:00
Anton Shestakov
e2a7644272 monoblue: link to branches on summary page
"Tags" and "Bookmarks" sections on this page already have the similar links,
and so does the "Branches" on summary page in gitweb, so let's do the same in
monoblue.
2015-07-26 18:05:10 +08:00
Anton Shestakov
4547637785 monoblue: fix branches link on help topics page 2015-07-26 17:18:42 +08:00
Anton Shestakov
2bbb11440f hgweb: show ages in repos' Last modified column in monoblue and gitweb
Index page, which shows the list of available repositories, has a column where
the last modification date for each repo is shown. paper, coal and spartan
already show the dates in relative format (e.g. "2 weeks ago"), because these
styles have the required process_dates() js function call in their footer
templates, which are included on every page. But monoblue and gitweb styles
have more things in the footer templates, such as repo name and its atom/rss
links, so they don't include the footer on index page (as this page doesn't
have a single repo context).

Let's call process_dates() without including the footer.
2015-07-26 00:11:23 +08:00
Durham Goode
677efb706e ignore: fix include: rules depending on current directory (issue4759)
When reading pattern files, we just call open(path), which is relative to the
current directory.  Let's fix this by resolving the paths before attempting to
read the file.
2015-07-24 16:44:52 -07:00
Durham Goode
c9da9870f4 test: move ignore test run into a subdirectory
Previously the hgignore test just called hg init in the test directory. A future
patch needs to test hgignore stuff from outside of the repo, so let's move the
entire test repo into a subdirectory.
2015-07-24 16:43:21 -07:00
Eugene Baranov
322848b810 convert: when converting from Perforce use original local encoding by default
On Windows Perforce command line client uses default system locale to encode
output. Using 'latin_1' causes locale-specific characters to be replaced with
question marks. With this patch we will use default locale by default whilst
allowing to specify it explicity with 'convert.p4.encoding' config option.

This is a potentially breaking change for any scripts relying on output treated
as in 'latin_1' encoding.

Also because hgext.convert.convcmd overwrites detected default system locale
with UTF-8 we had to introduce an import cycle in hgext.convert.p4 to retrieve
originally detected encoding from hgext.convert.convcmd.
2015-07-22 16:57:11 +01:00
Eugene Baranov
29b28e8371 convert: when getting file from Perforce concatenate data at the end
As it turned out, even when getting relatively small files, concatenating
string data every time when new chunk is received is very inefficient.
Maintaining a string list of data chunks and concatenating everything in one go
at the end seems much more efficient - in my testing it made getting 40 MB file
7 times faster, whilst converting of a particularly big changelist with some big
files went down from 20 hours to 3 hours.
2015-07-30 00:58:05 +01:00
Martin von Zweigbergk
6ea2f0a8d1 exchange: fix dead assignment
The assignment of the value from bundle2.processbundle() to 'r' is
unused. It is currently the same as its third argument (if given), and
since that argument may eventually go away (according to the method's
docstring), let's reassign the return value to 'op' instead to better
prepare for that.
2015-07-20 13:39:25 -07:00
Martin von Zweigbergk
2b14caf707 exchange: s/phase/bookmark/ in _pushb2bookmarks() 2015-07-20 13:35:19 -07:00
Siddharth Agarwal
20e8951b71 test-bookmarks.t: avoid nested repo
This is (a) pretty unnecessary and (b) breaks tests for the third-party
hgwatchman extension, which doesn't support nested repos.
2015-08-02 21:56:38 -07:00
Yuya Nishihara
f08cad7728 revlog: remove unused shaoffset constants
Call sites were removed at 1299f0c14572, "revlog: remove lazy index".
2015-08-02 12:16:19 +09:00
Yuya Nishihara
28a45149e9 revlog: correct comment about size of v0 index format 2015-08-02 01:14:11 +09:00
Gregory Szorc
db719a7a87 help: scripting help topic
There are a lot of non-human consumers of Mercurial. And the challenges
and considerations for machines consuming Mercurial is significantly
different from what humans face.

I think there are enough special considerations around how machines
consume Mercurial that a dedicated help topic is warranted. I concede
the audience for this topic is probably small compared to the general
audience. However, lots of normal Mercurial users do things like create
one-off shell scripts for common workflows that I think this is useful
enough to be in the install (as opposed to, say, a wiki page - which
most users will likely never find).

This text is by no means perfect. But you have to start somewhere. I
think I did cover the important parts, though.
2015-07-18 17:10:28 -07:00
Matt Harbison
5dece5b905 convert: document convert.hg.startrev 2015-07-29 21:31:56 -04:00
FUJIWARA Katsunori
2fb0db56cb transplant: restore dirstate correctly at unexpected failure
Before this patch, transplant can't restore dirstate as expected at
failure other than one while patching. This causes:

  - unexpected file status

  - dirstate refers already rollback-ed parent
    (only at failure of transplanting the 2nd or later revision)

To restore dirstate correctly also at unexpected failure, this patch
encloses scope of store lock and transaction by 'dirstateguard'.

This is temporary fixing for stable branch. See
DirstateTransactionPlan wiki page for detail about the future plan to
treat dirstate consistently around scope boundary of transaction.

    https://mercurial.selenic.com/wiki/DirstateTransactionPlan

This patch also adds 'if lock' examination for safety
'lock.release()', because creating 'dirstateguard' object may fail
unexpectedly (e.g. IOError for saving dirstate).

BTW, in the test script, putting section header '[extensions]' into
'.hg/hgrc' is needed to fix incomplete disabling 'abort' extension at
d0d06f4ca862.
2015-07-30 06:22:09 +09:00
FUJIWARA Katsunori
4865b28d1a localrepo: make journal.dirstate contain in-memory changes before transaction
Before this patch, in-memory dirstate changes aren't written out at
opening transaction, even though 'journal.dirstate' is created
directly from '.hg/dirstate'.

Therefore, subsequent 'hg rollback' uses incomplete 'undo.dirstate' to
restore dirstate, if dirstate is changed and isn't written out before
opening transaction.

In cases below, the condition "dirstate is changed and isn't written
out before opening transaction" isn't satisfied and this problem
doesn't appear:

  - "wlock scope" and "transaction scope" are almost equivalent

    e.g. 'commit --amend', 'import' and so on

  - dirstate changes are written out before opening transaction

    e.g. 'rebase' (via 'dirstateguard') and 'commit -A' (by separated
    wlock scopes)

On the other hand, 'backout' may satisfy the condition above.

To make 'journal.dirstate' contain in-memory changes before opening
transaction, this patch explicitly invokes 'dirstate.write()' in
'localrepository.transaction()'.

'dirstate.write()' is placed before not "writing journal files out"
but "invoking pretxnopen hooks" for visibility of dirstate changes to
external hook processes.

BTW, in the test script, 'touch -t 200001010000' and 'hg status' are
invoked to make file 'c' surely clean in dirstate, because "clean but
unsure" files indirectly cause 'dirstate.write()' at 'repo.status()'
in 'repo.commit()' (see e1d123a2ee1f for detail) and prevents from
certainly reproducing the issue.
2015-07-30 06:16:12 +09:00
Anton Shestakov
00364f383f monoblue: show relative age of bookmarks
In 064b658181dd, age calculation was made dynamic (i.e. in javascript), but for
some reason bookmarkentry template in monoblue/map got a wrong class. It
resulted in /summary and /bookmarks pages always showing exact dates for
bookmarks, no age calculation was performed. Let's fix this by using "age"
class that is already used in branchentry and tagentry templates in the same
map file.

As usual, the exact date for such elements is still available in title
attribute, so it shows in a tooltip on hover.
2015-07-13 13:13:17 +08:00
Anton Shestakov
403857c028 highlight: produce correct markup when there's a blank line just before EOF
Due to how the colorized output from pygments was stripped of <pre> elements,
when there was an empty line at the end of a file, highlight extension produced
an incorrect markup (no closing tags from the fileline/annotateline template).
It wasn't usually noticeable, because browsers were smart enough to see where
the missing tags should've been, but in monoblue style it resulted in the last
line having twice the normal height.

Instead of awkwardly trying to strip outer <pre></pre> tags, let's make the
formatter with nowrap=True, which should do what we need in pygments since at
least 0.5 (2006-10-30).

Example from monoblue style:

Before:

    <div class="source">

<div style="font-family:monospace" class="parity0">
<pre><a class="linenr" href="#l1" id="l1">     1</a> </pre>
</div>
<div style="font-family:monospace" class="parity1">
<pre><a class="linenr" href="#l2" id="l2">     2</a>
    </div>

Now:

    <div class="source">

<div style="font-family:monospace" class="parity0">
<pre><a class="linenr" href="#l1" id="l1">     1</a> </pre>
</div>
<div style="font-family:monospace" class="parity1">
<pre><a class="linenr" href="#l2" id="l2">     2</a> </pre>
</div>
    </div>

(Notice the missing </pre></div> now in place)
2015-07-22 10:19:17 +08:00
Matt Harbison
1fb45c7e46 test-check-config: convert directory separators to '/' for MSYS
The output of the files command uses native separator.  MSYS then seems to drop
the '\' on Windows when invoking python:

 --- c:/Users/Matt/Projects/hg/tests/test-check-config-hg.t
 +++ c:/Users/Matt/Projects/hg/tests/test-check-config-hg.t.err
 @@ -6,22 +6,10 @@

    $ hg files "set:(**.py or **.txt) - tests/**" |
    >   xargs python contrib/check-config.py  Traceback (most recent call last):
      File "contrib/check-config.py", line 93, in <module>
        sys.exit(main(sys.argv[1:]))
      File "contrib/check-config.py", line 24, in main
        for l in open(f):
    IOError: [Errno 2] No such file or directory: 'contriball-revsets.txt'
    [123]
2015-07-20 23:33:57 -04:00
Matt Harbison
3e67d17d81 test-subrepo: fix globs for Windows
It looks like these changes originated with 23b60798c736.  I'm not sure that it
was intentional, but is seems harmless enough for an error message.
2015-07-20 22:48:42 -04:00
Matt Harbison
9af3be2f3b test-clone: fix globs for Windows 2015-07-20 22:44:53 -04:00
Danek Duvall
256c943981 tests: diff -r on Solaris emits "Common subdirectories:"
When using the -r option to Solaris diff, any directores that compare
identically are mentioned in the output.  We don't really care about these
directories for the purposes of this test, so ignore them.
2015-07-20 15:42:39 -07:00
Danek Duvall
ccade6afcc tests: work around differing hunk headers between GNU and Solaris diff
The hunk headers specifying what lines the hunk apply to differ.  They're
irrelevant to the test, so just eliminate them from the output.
2015-07-20 15:39:15 -07:00
Danek Duvall
6c0991c070 tests: use egrep with regular expression branches for compatibility
GNU grep allows you to use "a\|b" in a regular expression to match either
"a" or "b", but at least Solaris grep does not; only egrep allows for that.
And egrep considers "a+" to be "a{1,}" instead of an "a" and a literal plus
sign, so escape that as well.
2015-07-20 15:33:20 -07:00
Yuya Nishihara
b789a2d6b1 parsers: silence warning of implicit integer conversion issued by clang
"-Wshorten-64-to-32" is enabled by default on Mac OS X. Because "len" should
be represented in 32bit integer, this patch simply cast ssize_t to int.
2015-07-20 23:38:56 +09:00
Yuya Nishihara
d7d0977d82 tests: disable test of buffer overflow in parsers.c if --pure
It fails with AttributeError and there's no benefit to make it runnable
with pure Python code.
2015-07-19 15:27:28 +09:00
Pascal Quantin
6d8e263df2 win32: update Inno Setup script after the changes done in f8c357b94e74 2015-07-19 18:11:18 +02:00
Matt Mackall
7dd8e80201 Added signature for changeset 1ae362552d62 2015-07-18 17:33:59 -05:00
Matt Mackall
9630b6a23f tests: add a check-config pass 2015-06-26 18:45:29 -05:00
Matt Mackall
cb0d66d090 hgweb: document web.certificates option 2015-07-18 14:18:31 -05:00
Matt Mackall
108d56f661 shelve: make maxbackup doc check-config friendly 2015-07-18 14:17:46 -05:00
Matt Mackall
43de6c5585 share: make option docs more check-config friendly 2015-07-18 14:17:17 -05:00
Matt Mackall
e6644982a8 perf: mark experimental option presleep 2015-07-18 14:16:36 -05:00
Matt Mackall
39dd2c2b5a check-config: don't continue prematurely
The early check for section headers like ^``foo`` was missing actual
options like ^``foo.bar``.
2015-07-18 14:16:07 -05:00
Matt Mackall
af90fd51ba subrepo: mark internal-only option 2015-06-25 17:57:26 -05:00