Commit Graph

20638 Commits

Author SHA1 Message Date
Julien Cristau
e78105c48a dispatch: take --hidden from individual commands into account
The command server would otherwise ignore that option, since the repo
object is only created once.
2014-01-27 10:57:20 +01:00
FUJIWARA Katsunori
870ab22a06 doc: fix mistake about matching against directories in "pattern.txt"
This fixes mistake of documentation about matching against directories
in "pattern.txt" introduced by b99923dc748f.

".hgignore" treats specified "glob:" pattern as same as one specified
for "-X" option: it can match against directories, too.

For reference, extra regexp string appended to specified pattern for
each types are listed below: see also "match.match()" and
"match._regex()" for detail.

  ============= ========== ===============
  type          cmdline    -I/-X
  ============= ========== ===============
  glob/relglob  '$'        '(?:/|$)'
  path/relpath  '(?:/|$)'  '(?:/|$)'
  re/relre      (none)     (none)
  ============= ========== ===============

Appending '$' means that the specified pattern should match against
only files.
2014-01-30 15:03:36 +09:00
FUJIWARA Katsunori
0b98e91e90 dispatch: make "_checkshellalias()" invoke "findcmd()" with "strict=True"
Before this patch, shell alias may be executed by abbreviated command
name unexpectedly, even if abbreviated command name matches also
against the command provided by extension.

For example, "rebate" shell alias is executed by "hg reba", even if
rebase extension (= "rebase" command) is enabled. In this case, "hg
reba" should be aborted because of command name ambiguity.

This patch makes "_checkshellalias()" invoke "cmdutil.findcmd()"
always with "strict=True" (default value).

If abbreviated command name matches against only one shell alias even
after loading extensions, such shell alias will be executed via
"_parse()".

This patch doesn't remove "_checkshellalias()" invocation itself,
because it may prevent shell alias from loading extensions uselessly.
2014-01-29 23:47:54 +09:00
Matt Mackall
c738b36ce1 rebase: abort cleanly when we encounter a damaged rebasestate (issue4155) 2014-01-30 13:56:56 -06:00
FUJIWARA Katsunori
26f147d151 i18n-ja: change phrasing for "or" 2014-01-30 17:09:13 +09:00
FUJIWARA Katsunori
14b2d2b8ec i18n-ja: fix some quoting problems for space character usage 2014-01-29 22:14:41 +09:00
FUJIWARA Katsunori
6441520dfe i18n-ja: synchronized with 3ff21233db0b 2014-01-29 21:38:10 +09:00
Simon Heimberg
044892facc i18n: fix non-matching 1st line indentations
When generating documentation, indentation must match for getting the same
view for translated messages. Often an output is generated anyway, but it
can look different. When a syntactically wrong indentation change is done,
runrst will fail (this is detected by test-gendoc.t).

Fix the simple places. When translation knowledge is necessary, the entry is
marked as fuzzy (and therefore skipped when generating translations). A
translator can fix it later.
2014-01-22 16:47:05 +01:00
Simon Heimberg
c6c6a2dd92 i18n: fix some non matching quotation marks in translations
A test for this is in preparation.
2014-01-22 16:35:10 +01:00
Simon Heimberg
889e04cd3a i18n: do not translate rst syntax .. note::
.. note:: is rst syntax which must not be translated. Fix this in the
translations.

This is not the first time this happens, so there should be a note for the
translator. A later patch will change the generation of the po files to
write this automatically.
A test in i18n/check-translation.py could help as well.
2014-01-22 16:34:36 +01:00
Leonardo Bueno Postacchini
b270594f22 i18n-pt_BR: synchronized with f908b17c97cc 2014-01-27 16:34:00 -02:00
Simon Heimberg
77e680884d i18n-de: updated po file with 3d9f67cfdcaf
Do this in a separate patch for easier reviewing of the translation patch.
2014-01-22 16:32:53 +01:00
Simon Heimberg
0c637f44ed i18n-de: remove locations
Strip the locations by running msgcat [1] as the wiki [2] tells to do. Do
this in a separate patch for getting a smaller one when updating from hg.pot.

[1] msgcat --no-location -o de.po de.po
[2] mercurial.selenic.com/wiki/TranslatingMercurial#Updating_a_Translation
2014-01-22 16:32:52 +01:00
Chris Jerdonek
0a2a1314d9 parsers: fail fast if Python has wrong minor version (issue4110)
This change causes an informative ImportError to be raised when importing
the parsers extension module if the minor version of the currently-running
Python interpreter doesn't match that of the Python used when compiling
the extension module.

This change also exposes a parsers.versionerrortext constant in the
C implementation of the module.  Its presence can be used to determine
whether this behavior is present in a version of the module.  The value
of the constant is the leading text of the ImportError raised and is set
to "Python minor version mismatch".

Here is an example of what the new error looks like:

  Traceback (most recent call last):
    File "test.py", line 1, in <module>
      import mercurial.parsers
  ImportError: Python minor version mismatch: The Mercurial extension
  modules were compiled with Python 2.7.6, but Mercurial is currently using
  Python with sys.hexversion=33883888: Python 2.5.6
  (r256:88840, Nov 18 2012, 05:37:10)
  [GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))]
   at: /opt/local/Library/Frameworks/Python.framework/Versions/2.5/Resources/
    Python.app/Contents/MacOS/Python

The reason for raising an error in this scenario is that Python's C API
is known not to be compatible from minor version to minor version, even
if sys.api_version is the same.  See for example this Python bug report
about incompatibilities between 2.5 and 2.6+:

  http://bugs.python.org/issue8118

These incompatibilities can cause Mercurial to break in mysterious,
unforeseen ways.  For example, when Mercurial compiled with Python 2.7 was
run with 2.5, the following crash occurred when running "hg status":

  http://bz.selenic.com/show_bug.cgi?id=4110

After this crash was fixed, running with Python 2.5 no longer crashes, but
the following puzzling behavior still occurs:

    $ hg status
      ...
      File ".../mercurial/changelog.py", line 123, in __init__
        revlog.revlog.__init__(self, opener, "00changelog.i")
      File ".../mercurial/revlog.py", line 251, in __init__
        d = self._io.parseindex(i, self._inline)
      File ".../mercurial/revlog.py", line 158, in parseindex
        index, cache = parsers.parse_index2(data, inline)
    TypeError: data is not a string

which can be reproduced more simply with:

    import mercurial.parsers as parsers
    parsers.parse_index2("", True)

Both the crash and the TypeError occurred because the Python C API's
PyString_Check() returns the wrong value when the C header files from
Python 2.7 are run with Python 2.5.  This is an example of an
incompatibility of the sort mentioned in the Python bug report above.

Failing fast with an informative error message results in a better user
experience in cases like the above.  The information in the ImportError
also simplifies troubleshooting for those on Mercurial mailing lists, the
bug tracker, etc.

This patch only adds the version check to parsers.c, which is sufficient
to affect command-line commands like "hg status" and "hg summary".
An idea for a future improvement is to move the version-checking C code
to a more central location, and have it run when importing all
Mercurial extension modules and not just parsers.c.
2013-12-04 20:38:27 -08:00
Matt Mackall
521c4ac54d debuginstall: change showing to checking for consistency and future checking 2014-03-14 16:00:11 -05:00
Chris Jerdonek
53c61a10f1 debuginstall: add Python information to debuginstall output (issue4128)
This change adds to the output of "hg debuginstall" information about the
Python being used by Mercurial.  It adds both the path to the Python
executable (i.e. the value of sys.executable) and the version of Python
(specifically the major, minor, and micro versions).

Below is an example of what the output looks like after this change.
The marked lines are the new output lines:

    $ hg debuginstall
    checking encoding (UTF-8)...
 -->showing Python executable (/Users/chris/.virtualenvs/default/bin/python)
 -->showing Python version (2.7.6)
    checking Python lib (/Users/chris/.virtualenvs/default/lib/python2.7)...
    checking installed modules (/Users/chris/mercurial)...
    checking templates (/Users/chris/mercurial/templates)...
    checking commit editor...
    checking username...
    no problems detected

Note that we use the word "showing" without an ellipsis for the new lines
because, unlike the other lines (except for "Python lib" which will be
adjusted in a subsequent commit), no check follows the display of this
information.
2013-12-31 00:37:16 -08:00
Pierre-Yves David
74abf98daf revset: add documentation and comment for _generatorset
(clean up some old irrelevant comment in the process)
2014-03-14 10:57:04 -07:00
Pierre-Yves David
170d61865e revset: add some documentation for lazyset 2014-03-14 10:55:03 -07:00
Lucas Moscovicz
6f3e54ea87 revset: added documentation and comment for spanset class 2014-03-14 10:59:51 -07:00
Lucas Moscovicz
ef95629110 revset: extend sorting tests 2014-03-11 17:25:53 -07:00
Matt Mackall
f0045fa1e0 merge with crew 2014-03-14 13:12:45 -05:00
Lucas Moscovicz
432476d8c0 revset: changed smartset methods to return ordered addsets
Now when adding two structures that are ordered, they are wrapped into an
_addset and they get added lazily while keeping the order.
2014-03-11 17:25:53 -07:00
Lucas Moscovicz
dd9f8534d9 revset: added isascending and isdescending methods to _addset
This methods are intended to duck-type baseset, so we will still have _addset
as a private class but now we can return it without wrapping it into an
orderedlazyset or a lazyset.

These were the last methods to add for smartset compatibility.
2014-03-14 10:24:09 -07:00
Lucas Moscovicz
c5a9f97171 revset: added __add__ method to _addset
This method is intended to duck-type baseset, so we will still have _addset as a
private class but we will be able to return it without wrapping it into an
orderedlazyset or a lazyset.
2014-03-14 10:23:54 -07:00
Lucas Moscovicz
a79e6ad5a0 revset: added __sub__ mehtod to _addset
This method is intended to duck-type baseset, so we will still have _addset as a
private class but now will be able to return it without wrapping it into an
orderedlazyset or a lazyset.
2014-03-14 10:22:51 -07:00
Lucas Moscovicz
02e069f77d revset: added __and__ method to _addset
This method is intended to duck-type baseset, so we will still have _addset as a
private class but  we will be able to return it without wrapping it into an
orderedlazyset or a lazyset.
2014-03-14 10:22:29 -07:00
Lucas Moscovicz
73a28cdab8 revset: added ascending and descending methods to _addset
This methods are intended to duck-type baseset, so we will still have _addset
as a private class but will be able return it without wrapping it into an
orderedlazyset or a lazyset.
2014-03-14 10:21:56 -07:00
Lucas Moscovicz
e603775f94 revset: added filter method to _addset
This method is intended to duck-type baseset, so we will still have _addset
as a private class but we will be able return it without wrapping it into an
orderedlazyset or a lazyset.
2014-03-13 19:12:36 -07:00
Lucas Moscovicz
8adde22fdb revset: added comments to all methods needed to duck-type from baseset
All this methods are required to duck-type for any class that works as a smart
set.
2014-03-14 09:18:14 -07:00
Lucas Moscovicz
23a1573060 revset: use more explicit argument names for baseset methods
Use other instead of x and condition instead of l
2014-03-14 10:10:18 -07:00
Lucas Moscovicz
1e32ffe0b9 revset: added isascending and isdescending methods to smartset classes
This methods state if the class is sorted in an ascending or descending order

We need this to implement methods based on order on smartset classes in order
to be able to create new objects with a given order.

We cannot just rely on a simple boolean since unordered set are neither
ascending nor descending.
2014-03-11 17:09:23 -07:00
Lucas Moscovicz
8004a27cbf revset: added sort method in addset
We need this method to duck-type generatorset since this class is not going to
be used outside revset.py and we don't need to duck-type baseset.

This sort method will only do something when the addset is not already sorted
or is not sorted in the way we want it to be.
2014-03-11 17:03:43 -07:00
Lucas Moscovicz
62c7bb9117 revset: added reverse method to addset
This method is needed to duck type generatorset.
2014-03-13 18:57:30 -07:00
Lucas Moscovicz
e5f79a44be revset: changed _iterator() method on addset to work with a given order
If the two collections are in ascending order, yield their values in an
ordered way by iterating both at the same time and picking the values to
yield.
2014-03-13 13:29:04 -07:00
Lucas Moscovicz
f2b80f803a revset: changed _iterator() in addset to use the generated list when available
Now when all the elements have been generated, the iterator will just use the
generated list instead of going through all the elements again.
2014-03-13 14:51:04 -07:00
Lucas Moscovicz
1a5e79571b revset: added cached generated list to addset
This way when all the values have been generated the list can be sorted
without having to generate them all again.
2014-03-11 16:59:42 -07:00
Lucas Moscovicz
67d42c8519 revset: changed sort method to use native sort implementation of smartsets
When sort is done by revision or reversed revision number it can just call
sort on the set and doesn't have to iterate it all over again.
2014-03-13 17:15:21 -07:00
Lucas Moscovicz
6da2a5ca22 revset: fixed sorting issue with spanset
When a spanset was being sorted it didn't take into account it's current
state (ascending or descending) and it reversed itself everytime the reverse
parameter was True.

This is not yet used but it will be as soon as the sort revset is changed to
directly use the structures sort method.
2014-03-13 17:16:58 -07:00
Lucas Moscovicz
f3f67eb57f tests: added tests to test sort revset
This tests are intended to test sort in many different cases where it could
fail when using the new structures
2014-03-13 17:20:03 -07:00
Lucas Moscovicz
edbf51ad8f revset: added __nonzero__ method to spanset class
Implemented it in a lazy way, just look for the first non-filtered revision
and return True if there's any revision at all.
2014-03-14 09:07:59 -07:00
Lucas Moscovicz
04e9ab0a9b revset: optimized sort method in lazyset class
We are taking advantage of the smartset classes sort method when it exists and
converting the set to a baseset otherwise.
2014-03-06 09:41:47 -08:00
Durham Goode
f906635299 revset: improve head revset performance
Previously the head() revset would iterate over every item in the subset and
check if it was a head.  Since the subset is often the entire repo, this was
slow on large repos. Now we iterate over each item in the head list and check if
it's in the subset, which results in much less work.

hg log -r 'head()' on a large repo:
Before: 0.95s
After: 0.28s
2014-03-13 13:47:21 -07:00
Lucas Moscovicz
36702af6f9 revset: added ascending attribute to addset class
In case both collections are in an ascending/descending order then we will be
able to iterate them lazily while keeping the order.
2014-03-11 16:52:15 -07:00
Lucas Moscovicz
7da57d658a revset: added set method to addset to duck type generatorset
Since this class is only going to be used inside revset.py (it does not duck
type baseset) it needs to duck type only a few more methods for the next
patches.
2014-03-10 10:49:04 -07:00
Matt Mackall
471d2893a7 merge with default 2014-03-13 15:00:34 -05:00
Matt Mackall
064d711c69 revsets: backout f497f83593d8 due to performance regressions 2014-03-13 14:34:32 -05:00
Matt Mackall
b93e6d4112 merge with stable 2014-03-13 12:05:08 -05:00
Lucas Moscovicz
efb319fb76 revset: made addset a private class
This class is not supposed to be used outside revset.py since it only
wraps content that is used by baseset typed classes.

It only gets created by revset operations or private methods.
2014-03-12 17:20:26 -07:00
Lucas Moscovicz
a50567190d revset: made descgeneratorset a private class
This class is not supposed to be used outside revset.py since it only
wraps content that is used by baseset typed classes.

It only gets created by revset operations or private methods.
2014-03-12 17:19:46 -07:00
Lucas Moscovicz
e6b1cc49b9 revset: made ascgeneratorset a private class
This class is not supposed to be used outside revset.py since it only
wraps content that is used by baseset typed classes.

It only gets created by revset operations or private methods.
2014-03-12 17:18:54 -07:00