Commit Graph

20555 Commits

Author SHA1 Message Date
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
FUJIWARA Katsunori
70f9f39f84 commit: create new amend changeset as secret correctly for "--secret" option
Before this patch, "hg commit --amend --secret" doesn't create new
amend changeset as secret, even though the internal function
"commitfunc()" passed to "cmdutil.amend()" make "phases.new-commit"
configuration as "secret" temporarily.

"cmdutil.amend()" uses specified "commitfunc" only for temporary amend
commit, and creates the final amend commit changeset by
"localrepository.commitctx()" directly with memctx.

This patch creates new amend changeset as secret correctly for
"--secret" option, by changing "phases.new-commit" configuration
temporarily before "localrepository.commitctx()".
2014-03-13 19:48:41 +09: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
Lucas Moscovicz
7e33d4c691 revset: made generatorset a private class
This class are 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:07:38 -07:00
Cristian Zamfir
c85ed151ff hg log: solves bug regarding hg log -r 0:null (issue4039)
'hg log -r 0:null' was showing only one changeset(the '-1' one) instead of the first two changesets.
2014-03-12 10:26:48 +02:00
FUJIWARA Katsunori
d28789bf48 templater: make strings in template expressions be "string-escape"-ed correctly
Changeset 83ff877959a6 (released with 2.8.1) fixed "recursively
evaluate string literals as templates" problem (issue4102) by moving
the location of "string-escape"-ing from "tokenizer()" to
"compiletemplate()".

But some parts in template expressions below are not processed by
"compiletemplate()", and it may cause unexpected result.

  - 'expr' of 'if(expr, then, else)'
  - 'expr's of 'ifeq(expr, expr, then, else)'
  - 'sep' of 'join(list, sep)'
  - 'text' and 'style' of 'rstdoc(text, style)'
  - 'text' and 'chars' of 'strip(text, chars)'
  - 'pat' and 'repl' of 'sub(pat, repl, expr)'

For example, '\n' of "{join(extras, '\n')}" is not "string-escape"-ed
and treated as a literal '\n'. This breaks "Display the contents of
the 'extra' field, one per line" example in "hg help templates".

Just "string-escape"-ing on each parts above may not work correctly,
because inside expression of nested ones already applies
"string-escape" on string literals. For example:

  - "{join(files, '\n')}" doesn't return "string-escape"-ed string, but
  - "{join(files, if(branch, '\n', '\n'))}" does

To fix this problem, this patch does:

  - introduce "rawstring" token and "runrawstring" method to handle
    strings not to be "string-escape"-ed correctly, and

  - make "runstring" method return "string-escape"-ed string, and
    delay "string-escape"-ing until evaluation

This patch invokes "compiletemplate()" with "strtoken=exp[0]" in
"gettemplate()", because "exp[1]" is not yet evaluated. This code path
is tested via mapping ("expr % '{template}'").

In the other hand, this patch invokes it with "strtoken='rawstring'"
in "_evalifliteral()", because "t" is the result of "arg" evaluation
and it should be "string-escape"-ed if "arg" is "string" expression.

This patch doesn't test "string-escape"-ing on 'expr' of 'if(expr,
then, else)', because it doesn't affect the result.
2014-03-10 01:01:43 +09:00
FUJIWARA Katsunori
f3e5f1e6c1 templater: apply "stringify()" on sub expression to get string correctly
Templating syntax allows nested expression to be specified as parts
below, but they are evaluated as a generator and don't work correctly.

  - 'sep' of 'join(list, sep)'
  - 'text' and 'chars' of 'strip(text, chars)'

In the former case, 'sep' returns expected string only for the first
separation, and empty one for the second or later, because the
generator has only one element.

In the latter case, templating is aborted by exception, because the
generator doesn't have 'strip()' method (as 'text') and can't be
passed as the argument to 'str.strip()' (as 'chars').

This patch applies "stringify()" on these sub expression to get string
correctly.
2014-03-10 01:01:43 +09:00
FUJIWARA Katsunori
7a7d1bc22c templater: avoid recursive evaluation of string literals completely
Changeset c84f81c3e120 (released with 2.8.1) fixed "recursively
evaluate string literals as templates" problem (issue4103) by
introducing "_evalifliteral()".

But some parts in template expressions below are still processed by
the combination of "compiletemplate()" and "runtemplate()", and may
cause same problem unexpectedly.

  - 'init' and 'hang' of 'fill(text, width, init, hang)'
  - 'expr' of 'sub(pat, repl, expr)'
  - 'label' of 'label(label, expr)'

This patch processes them by "_evalifliteral()" instead of the
combination of "compiletemplate()" and "runtemplate()" to avoid
recursive evaluation of string literals completely.
2014-03-10 01:01:42 +09:00
Lucas Moscovicz
81e72f8395 cmdutil: changed walkchangerevs to use spanset instead of baseset
Using a spanset takes almost no memory at all. A baseset builds the entire
list in memory and is much slower for methods like __contains__.
2014-03-05 18:49:47 -08:00
Yuya Nishihara
6edf7b4a6a phase: say "Returns 0" instead of "Return 0" like other command help 2014-03-03 15:50:45 +09:00
anuraggoel
2e25e2e790 paper: overlapping of section title on help pages (issue4051)
Now there will be no overlap lines between various section title
on help pages. http://selenic.com/repo/hg/help/config
2014-03-03 23:37:59 +05:30
Matt Mackall
ab34056fed Added signature for changeset c6d901b5cf89 2014-03-01 15:22:49 -06:00
Mads Kiilerich
6c40916e6d merge: audit the right destination file when merging with dir rename 2014-03-01 18:09:39 +01:00
Pierre-Yves David
3eab08d896 resolve: use "other" changeset from merge state (issue4163)
We can use the "other" data from the recorded merge state instead of inferring
what the other could be from working copy parent. This will allow resolve to
fulfil its duty even when the second parent have been dropped.

Most direct benefit is fixing a regression in backout.
2014-02-25 18:45:01 -08:00
Pierre-Yves David
f2a2751552 merge: add "other" file node in the merge state file
This data is mostly redundant with the "other" changeset node (+ other changeset
file path). However, more data never hurt.

The old format do not store it so this require some dancing to add and remove it
on demand.
2014-02-25 18:54:47 -08:00
Pierre-Yves David
49ce770140 merge: infer the "other" changeset when falling back to v1 format
When we have to fallback to the old version of the file, we infer the
"other" from current working directory parent. The same way it is currently done
in the resolve command. This is know to have shortcoming… but we cannot do
better from the data contained in the old file format. This is actually the
motivation to add this new file format.
2014-02-27 14:14:57 -08:00
Pierre-Yves David
15afb2ca0c merge: record the "other" node in merge state
We need to record the merge we were merging with. This solve multiple
bug with resolve when dropping the second parent after a merge. This
happen a lot when doing special merge (overriding the ancestor).
Backout, shelve, rebase, etc. can takes advantage of it.

This changeset just add the information in the merge state. We'll use it in the
resolve process in a later changeset.
2014-02-25 18:42:11 -08:00
Pierre-Yves David
b5e943e8cb merge: introduce new format for the state file
This new format will allow us to address common bugs while doing special merge
(graft, backout, rebase…) and record user choice during conflict resolution.

The format is open so we can add more record for future usage.

This file still store hexified version of node to help human willing to debug
it by hand. The overhead or oversize are not expected be an issue.

The old format is still used. It will be written to disk along side the newer
format. And at parse time we detect if the data from old version of the
mergestate are different from the one in the new version file. If its the same,
both have most likely be written at the same time and you can trust the extra
data from the new file. If it differs, the old file have been written by an
older version of mercurial that did not knew about the new file. In that case we
use the content of the old file.
2014-02-25 18:37:06 -08:00
Pierre-Yves David
01a482bed9 merge: change the merge state serialisation to use a record based logic
The format of the file is unchanged. But we are preparing a new file with a new
format that would be record based. So we change all the read/write logic to
handle a list of record until a very low level. This will allow simple plugging
of the new format in the current code.
2014-02-27 12:59:41 -08:00
Pierre-Yves David
2438827558 merge: move merge state file path into a constant
We are about to change the format. Having the file path in a single place make
it easier to update the filename for the new version.
2014-02-25 17:14:49 -08:00
anuraggoel
d215557c0e coal: hgweb style adds extra blank line in file view (issue4136)
Now hgweb style='coal' adds no extra blank in file view.
2014-02-27 22:56:42 +05:30
Piotr Klecha
0968676adc pull: close peer repo on completion (issue2491) (issue2797)
When pulling changes from a compressed bundle Mercurial first uncompresses it
to a temporary file in .hg directory. This file will not be deleted unless
the bundlerepo (other) is explicitly closed.

This is similar to cleanup that occurs after incoming.
2014-02-25 21:26:25 +01:00
Paul Boddie
202d2d5cf4 hgweb: ensure isdirectory is None for repositories, replacing any True value
Until now, repositories did not provide any value for isdirectory in rows
produced for the index output, and thus isdirectory was generally evaluated as
None for each index entry representing a repository.

However, directories (visible when viewed with the descend and collapse
settings enabled) did provide a value of True and this value appeared to
persist in subsequent rows processed by the templater, causing isdirectory
tests in templates to produce incorrect results for index entries appearing
after directories.

This patch asserts the None value for repositories, thus erasing any such
persistent True values.
2014-02-27 00:24:06 +01:00
anuraggoel
08543b09f1 purge: avoid duplicate output for --print (issue4092)
Now "hg purge -p" commands avoids printiing duplication of filenames.

Second patch is the test coverage of first patch which tells that '-p'
does not depend on whether ui.verbose is configured or not,that means it
is independent of '-v'.
2014-02-25 06:30:21 +05:30
Matt Mackall
8bd1eb5dcb merge with i18n 2014-02-24 18:48:48 -06:00
Lucas Moscovicz
2c2b32444e revset: added sort methods to generatorsets
Method needed to propagate sort calls amongst lazy structures.
The generated list (stored in the object) is sorted.

If the generated list did not contain all elements from the generator, we
take care of that before sorting the list.
2014-02-24 16:36:17 -08:00
FUJIWARA Katsunori
ca6fba30d7 i18n-ja: synchronized with ab338a276a26 2014-02-23 18:03:47 +09:00
Danek Duvall
7e62057404 pathencode: eliminate signed integer warnings
Compiling mercurial with the Sun Studio compiler gives seven copies of the
following warning on pathencode.c:

    line 533: warning: initializer will be sign-extended: -1

Using explicit unsigned literals silences it.
2014-02-19 13:11:24 -08:00
Yuya Nishihara
6852c0bb11 verify: do not prevent verify repository containing hidden changesets
Since afe2bc876c89, repo.cancopy() cannot be used to check if the repo is
a bundlerepository.

repo.url() should always have "scheme:", so it isn't necessary to parse
by util.url().
2014-02-19 22:19:45 +09:00
Yuya Nishihara
cdb5aade4f hgweb: make sure sys module is loaded prior to reload hack
If sys is still a demandmod, reload(sys) fails with "TypeError: reload()
argument must be module".
2014-02-19 21:16:43 +09:00
Wagner Bruna
b0248dcfdb i18n-pt_BR: synchronized with 78794a4dc37f 2014-02-16 09:04:49 -03:00
Yuya Nishihara
c857975766 rebase: do not try to reactivate deleted divergent bookmark
If the currently active bookmark is divergent one, it may be resolved during
rebase.  Trying to activate it will raise "KeyError: 'W@diverge'".
2014-02-15 16:19:19 +09:00
Thomas Arendsen Hein
a22586ff6f help: new SHA-1 fingerprint of hg.intevation.org in hostfingerprints example
The certificate was updated in February 2014.
You can verify the certificate by using the Root CA certificate downloadable
from https://ssl.intevation.de/
The intermediate CA is sent by https://hg.intevation.org/
2014-02-13 13:05:09 +01:00
Brodie Rao
fc55ccd1ef hooks: only disable/re-enable demandimport when it's already enabled
This fixes an issue introduced in 818c8992811a where, when disabling
demandimport while running hooks, it's inadvertently re-enabled even when
it was never enabled in the first place.

This doesn't affect normal command line usage of Mercurial; it only matters
when Mercurial is run with demandimport intentionally disabled.
2014-02-10 14:51:06 -08:00
Mads Kiilerich
4aef593d5a merge: don't overwrite file untracked after remove, abort with 'untracked files'
Merge could overwrite untracked files and cause data loss.

Instead we now handle the 'local side removed file and has untracked file
instead' case as the 'other side added file that local has untracked' case:

  FILE: untracked file exists
  abort: untracked files in working directory differ from files in requested revision

It could perhaps make sense to create .orig files when overwriting, either
instead of aborting or when overwriting anyway because of force ... but for now
we stay consistent with similar cases.
2014-02-10 00:43:54 +01:00
Matt Mackall
fd6c6f9614 hgweb: hack around mimetypes encoding thinko (issue4160)
A correct patch for this has existed in Python's BTS for 3 years
(http://bugs.python.org/issue9291), so waiting for it to be fixed
upstream is probably not a viable strategy. Instead, we add this
horrible hack to workaround the issue in existing copies of Python
2.4-2.7.
2014-02-05 17:23:35 -06:00
Augie Fackler
5c9b7fcbc6 fix_bytesmod: use the "from mercurial" form of the import to avoid breaking httpclient
Without this patch, 2to3's rewrites to httpclient cause it to fail to
import. With this patch, it's probably hopelessly broken, but at least
won't block forward progress on non-http2 functionality on Python 3.
2014-02-04 18:33:25 -05:00
Augie Fackler
30760aaf72 killdaemons: drop superfluous L suffix from constant
As far as I'm aware PEP 237[0] means this suffix is superfluous even
on Python 2.4, and we can just drop it, which makes this code happy on
Python 3.

0: http://legacy.python.org/dev/peps/pep-0237/
2014-03-10 17:52:42 -04:00
Augie Fackler
2029c18034 setup.py: fix 2.4 breakage in 77ab0abb 2014-03-12 18:28:57 -04:00
Siddharth Agarwal
228773d706 hg: note that islocal only accepts paths pointing to repos
hg.islocal doesn't work for paths pointing to non-repos, such as patch files.
2014-02-03 14:36:20 -08:00
Siddharth Agarwal
cfe3861321 hg.openpath: use url.islocal to tell if the path is local (issue3624)
Previously we used hg.islocal, which doesn't work for paths pointing to
non-repos, such as patch files.
2014-02-03 14:53:44 -08:00