Commit Graph

21921 Commits

Author SHA1 Message Date
Alexander Becher
8b1b69abc7 graft: add a reference to revsets to the help text (issue3362) 2014-07-28 10:05:17 +02:00
anatoly techtonik
023b57a106 config: allow 'user' in .hgrc ui section (issue3169) 2014-07-26 09:27:11 +03:00
Pierre-Yves David
7ff3cfd076 i18n: add parenthesis in Brazilian translation of the resolve message
Eu falo brasileiro agora. Eu não sou uma batata!
2014-07-26 03:35:42 +02:00
Pierre-Yves David
3efa776f85 resolve: add parenthesis around "no more unresolved files" message
This message may be confused with an error message. Adding parenthesis around it
will make it more recognisable as an informative message.
2014-07-26 03:32:49 +02:00
Matt Mackall
a345c1561e help: mention '-T list' in templater topic 2014-07-25 15:51:42 -05:00
Matt Mackall
4b3c5de9a0 help: drop reference to glog in templates topic 2014-07-25 15:38:26 -05:00
Matt Mackall
f648f507dd templates: re-add template listing support
We used to have --style nosuch to list templates, but --style is now
merged with --template/-T where random strings are acceptable
templates. So we reserve 'list' to allow listing templates.
2014-07-25 15:35:09 -05:00
Yuya Nishihara
e25250d0b5 help: use --template to specify existing style
--style is deprecated since a9017c9ab729 and b6bd707e04af.
2014-07-21 11:44:20 +09:00
Yuya Nishihara
2db6b6d9ea test-status: add test for removed-and-untracked state (BC)
In Mercurial 3.0, "hg status" can list the same file twice if it was removed
but still exists in working directory, i.e. removed by "hg forget":

  $ hg status --rev 0 removed
  R removed
  ? removed

But since 64d05ea3a10f, untracked state, "?", is no longer displayed in this
example.

I think the new behavior is correct since a file should have single state, but
if it is a bug, this patch should be dropped.
2014-07-24 23:39:25 +09:00
Pierre-Yves David
4ab165af6a bundle2: only use callable return as reply handler
When a bundle2 parts generator returns a non callable value, it should not be
used as a reply handler. The changegroup part generator is already having this
case of behavior when there is no changegroup to push. This changeset prevent a
crash for user of the experimentable bundle2 feature.
2014-07-02 16:13:48 +02:00
Nathan Goldbaum
46f5e72040 resolve: report no argument warning using a hint
With this change resolve and revert produce consistent output when run with no
arguments:

$ hg resolve
abort: no files or directories specified
(use --all to remerge all files)

$ hg revert
abort: no files or directories specified
(use --all to revert all files)
2014-07-24 14:29:08 -07:00
Gregory Szorc
27315bd014 revset: optimize baseset.__sub__ (issue4313)
f5a63a5506d2 regressed performance of baseset.__sub__ by introducing
a lazyset. This patch restores that lost performance by eagerly
evaluating baseset.__sub__ if the other set is a baseset.

revsetbenchmark.py results impacted by this change:

revset #6: roots(0::tip)
0) wall 2.923473 comb 2.920000 user 2.920000 sys 0.000000 (best of 4)
1) wall 0.077614 comb 0.080000 user 0.080000 sys 0.000000 (best of 100)

revset #23: roots((0:tip)::)
0) wall 2.875178 comb 2.880000 user 2.880000 sys 0.000000 (best of 4)
1) wall 0.154519 comb 0.150000 user 0.150000 sys 0.000000 (best of 61)

On the author's machine, this slowdown manifested during evaluation of
'roots(%ln::)' in phases.retractboundary after unbundling the Firefox
repository. Using `time hg unbundle firefox.hg` as a benchmark:

Before: 8:00
After:  4:28
Delta: -3:32

For reference, the subset and cs baseset instances impacted by this
change were of lengths 193634 and 193627, respectively.

Explicit test coverage of roots(%ln::), while similar to the existing
roots(0::tip) benchmark, has been added.
2014-07-24 12:12:12 -07:00
Sean Farley
f571686ac2 memctx: substate needs to be {} instead of None
Setting substate to None was an oversight in 5b3c9729fe09 and this patch
corrects it by setting substate to an empty dictionary which matches what
subrepo code expects.
2014-07-16 13:07:39 -05:00
Matt Mackall
97770302de version: don't traceback if no extensions to list (issue4312) 2014-07-23 11:16:22 -05:00
Matt Mackall
8c4b2f4e0d merge with i18n 2014-07-23 10:50:21 -05:00
FUJIWARA Katsunori
8c6b77e441 largefiles: use "normallookup" on "lfdirstate" while reverting
Before this patch, largefiles gotten from revisions other than the
parent of the working directory at "hg revert" become "clean"
unexpectedly in steps below:

    1. "repo.status()" is invoked (for status check before reverting)
      1-1 "dirstate" entry for standinfile SF is "normal"-ed
     (1-2 "lfdirstate" entry of largefile LF (for SF) is "normal"-ed)

    2. "cmdutil.revert()" is invoked
      2-1 standinfile SF is updated in the working directory
      2-2 "dirstate" entry for SF is NOT updated

    3. "lfcommands.updatelfiles()" is invoked (by "overrides.overriderevert()")
      3-1 largefile LF (for SF) is updated in the working directory
      3-2 "dirstate" returns "n" and valid timestamp for SF (by 1-1 and 2-2)
      3-3 "lfdirstate" entry for LF is "normal"-ed
      3-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file (by 3-3)
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 3-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 3-3 and 3-4) as "clean".

When largefiles are reverted, they should be "normallookup"-ed
forcibly.

This patch uses "normallookup" on "lfdirstate" while reverting, by
passing "True" to newly added argument "normallookup".

Forcible "normallookup"-ing is not so expensive, because list of
target largefiles is explicitly specified in this case.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate" (for ASSUMPTION at 3-4)
2014-07-23 00:10:24 +09:00
FUJIWARA Katsunori
f5a07da3f0 largefiles: invoke "normallookup" on "lfdirstate" for merged files
Before this patch, largefiles gotten from "other" revision (with
conflict) at "hg merge" become "clean" unexpectedly in steps below:

    1. "repo.status()" is invoked (for status check before merging)
      1-1 "dirstate" entry for standinfile SF is "normal"-ed
      1-2 "lfdirstate" entry of largefile LF (for SF) is "normal"-ed

    2. "merge.update()" is invoked
      2-1 SF is updated in the working directory
          (ASSUMPTION: user choice "other" at conflict)
      2-2 "dirstate" entry for SF is "merge"-ed

    3. "lfcommands.updatelfiles()" is invoked (by "overrides.hgmerge()")
      3-1 largefile LF (for SF) is updated in the working directory
      3-2 "dirstate" returns "m" for SF (by 2-2)
      3-3 "lfdirstate" entry for LF is left as it is
      3-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file (by 1-2)
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 3-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 1-2 and 3-4) as "clean".

When state of standinfile in "dirstate" is "m", largefile should be
"normallookup"-ed.

This patch invokes "normallookup" on "lfdirstate" for merged files.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate". (for ASSUMPTION at 3-4)
2014-07-23 00:10:24 +09:00
FUJIWARA Katsunori
c24b717f3e largefiles: use "normallookup", if "mtime" of standin is unset
Before this patch, largefiles gotten from "other" revision (without
conflict) at "hg merge" become "clean" unexpectedly in steps below:

    1. "merge.update()" is invoked
      1-1 standinfile SF is updated in the working directory
      1-2 "dirstate" entry for SF is "normallookup"-ed

    2. "lfcommands.updatelfiles()" is invoked (by "overrides.hgmerge()")
      2-1 largefile LF (for SF) is updated in the working directory
      2-2 "dirstate" returns "n" for SF (by 1-2)
      2-3 "lfdirstate" entry for LF is "normal"-ed
      2-4 "lfdirstate" is written into ".hg/largefiles/dirstate", and
          timestamp of LF is stored into "lfdirstate" file
          (ASSUMPTION: timestamp of LF differs from one of "lfdirstate" file)

Then, "hs status" treats LF as "clean", even though LF is updated by
"other" revision (by 2-1), because "lfilesrepo.status()" always treats
"normal"-ed files (by 2-3 and 2-4) as "clean".

When timestamp is not set (= negative value) for standinfile in
"dirstate", largefile should be "normallookup"-ed regardless of
rebasing or not, because "n" state in "dirstate" doesn't ensure
"clean"-ness of a standinfile at that time.

This patch uses "normallookup" instead of "normal", if "mtime" of
standin is unset

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, "lfdirstate" should
be updated with "dirstate" simultaneously while "merge.update"
execution: maybe by hooking "recordupdates"

It is also why this patch (temporarily) uses internal field "_map" of
"dirstate" directly.

This patch uses "[debug] dirstate.delaywrite" feature in the test, to
ensure that timestamp of the largefile gotten from "other" revision is
stored into ".hg/largefiles/dirstate". (for ASSUMPTION at 2-4)

This patch newly adds "test-largefiles-update.t", to avoid increasing
cost to run other tests for largefiles by subsequent patches
(especially, "[debug] dirstate.delaywrite" causes so).
2014-07-22 23:59:34 +09:00
FUJIWARA Katsunori
2fdcc0328a dirstate: delay writing out to ensure timestamp of each entries explicitly
Even though "dirstate.write()" is invoked explicitly after "normal"
invocations, timestamp field of entries may be still "unset" in the
"dirstate" file itself , because "pack_dirstate" drops it when it is
equal to the timestamp of "dirstate" file itself.

This can avoid overlooking modification of files, which are updated at
same time in the second. But on the other hand, this may hide timing
critical problems.

For example, incorrect "normal"-ing (or lack of "normallookup"-ing on
the already "normal"-ed entry) is visible only when:

  - the target file is modified in the working directory at T1, and
  - "dirstate" file is written out at T2 (!= T1)

Otherwise, T1 is dropped by "pack_dirstate" in "dirstate.write()"
invocation, and "unset" is stored into "dirstate" file.

It often fails to reproduce problems from incorrect "normal"-ing by
Mercurial testset, because automated actions in the small repository
almost always causes that T1 and T2 are same.

This patch adds the debug feature to delay writing out to ensure
timestamp of each entries explicitly.

This feature is used to make timing critical "dirstate" problems
reproducable in subsequent patches.
2014-07-22 23:59:30 +09:00
Danek Duvall
151b68d8da tests: cat error messages are different on Solaris 2014-07-21 11:27:24 -07:00
Wagner Bruna
d98e4eed2d i18n-pt_BR: synchronized with 4bd0f3b99c93 2014-07-20 18:08:29 -03:00
Wagner Bruna
00765540ed commands: fix typo in import documentation 2014-07-20 15:06:12 -03:00
Matt Mackall
7c1189ac2d Added signature for changeset 4bd0f3b99c93 2014-07-19 00:11:40 -05:00
Matt Harbison
f0308c64dd revset: avoid a ValueError when 'only()' is given an empty set
This previously died in _revdescendants() taking the min() of the first set to
only(), when it was empty.  An empty second set already worked.  Likewise,
descendants() already handled an empty set.
2014-07-18 19:46:56 -04:00
FUJIWARA Katsunori
f9743bb802 cmdutil: make commit message shown in text editor customizable by template
This patch makes commit message shown in text editor customizable by
template. For example, this can advertise:

  - sample commit messages for routine works,
  - points to call attention before commit,
  - message of the day, and so on

To show commit message correctly even in problematic encoding, this
patch chooses the latter below:

  - replace "buildcommittext" with "buildcommittemplate" completely

  - invoke "buildcommittemplate" only if '[committemplate] changeset'
    is configured explicitly

For example, if multibyte character ending with backslash (0x5c) is
followed by ASCII character 'n' in the customized template, sequence
of backslash and 'n' is treated as line-feed unexpectedly (and
multibyte character is broken, too).

This corruption occurs in 'decode("string-escape")' while parsing
template string.
2014-07-15 23:34:13 +09:00
Matt Mackall
b221e35cf4 commiteditor: refactor default extramsg 2014-07-18 23:15:28 -05:00
Angel Ezquerra
38433239a4 filemerge: add internal:tagmerge merge tool
Add a new internal:tagmerge merge tool which implements an automatic merge
algorithm for mercurial's tag files

The tagmerge algorithm is able to resolve most merge conflicts that
currently would trigger a .hgtags merge conflict. The only case that
it does not (and cannot) handle is that in which two tags point to
different revisions on each merge parent _and_ their corresponding tag
histories have the same rank (i.e. the same length). In all other
cases the merge algorithm will choose the revision belonging to the
parent with the highest ranked tag history. The merged tag history is
the combination of both tag histories (special care is taken to try to
combine common tag histories where possible).

The algorithm also handles cases in which tags have been manually
removed from the .hgtags file and other similar corner cases.

In addition to actually merging the tags from two parents, taking into
account the base, the algorithm also tries to minimize the difference
between the merged tag file and the first parent's tag file (i.e. it
tries to make the merged tag order as as similar as possible to the
first parent's tag file order).

The algorithm works as follows:
1. read the tags from p1, p2 and the base
    - when reading the p1 tags, also get the line numbers associated to each
      tag node (these will be used to sort the merged tags in a way that
      minimizes the diff to p1). Ignore the file numbers when reading p2 and
      the base
2. recover the "lost tags" (i.e. those that are found in the base but not on p1
   or p2) and add them back to p1 and/or p2
    - at this point the only tags that are on p1 but not on p2 are those new
      tags that were introduced in p1. Same thing for the tags that are on p2
      but not on p2
3. take all tags that are only on p1 or only on p2 (but not on the base)
    - Note that these are the tags that were introduced between base and p1 and
      between base and p2, possibly on separate clones
4. for each tag found both on p1 and p2 perform the following merge algorithm:
    - the tags conflict if their tag "histories" have the same "rank" (i.e.
      length) _AND_ the last (current) tag is _NOT_ the same
    - for non conflicting tags:
        - choose which are the high and the low ranking nodes
            - the high ranking list of nodes is the one that is longer.
              In case of draw favor p1
            - the merged node list is made of 3 parts:
                - first the nodes that are common to the beginning of both the
                  low and the high ranking nodes
                - second the non common low ranking nodes
                - finally the non common high ranking nodes (with the last one
                  being the merged tag node)
            - note that this is equivalent to putting the whole low ranking node
              list first, followed by the non common high ranking nodes
    - note that during the merge we keep the "node line numbers", which will
      be used when writing the merged tags to the tag file
5. write the merged tags taking into account to their positions in the first
   parent (i.e. try to keep the relative ordering of the nodes that come
   from p1). This minimizes the diff between the merged and the p1 tag files
   This is done by using the following algorithm
    - group the nodes for a given tag that must be written next to each other
        - A: nodes that come from consecutive lines on p1
        - B: nodes that come from p2 (i.e. whose associated line number is None)
             and are next to one of the a nodes in A
        - each group is associated with a line number coming from p1
    - generate a "tag block" for each of the groups
        - a tag block is a set of consecutive "node tag" lines belonging to the
          same tag and which will be written next to each other on the merged
          tags file
    - sort the "tag blocks" according to their associated number line
        - put blocks whose nodes come all from p2 first
    - write the tag blocks in the sorted order

Notes:
- A few tests have been added to test-tag.t. These tests are very specific to
the new internal:tagmerge tool, so perhaps they should be moved to their own
test file.
- The merge algorithm was discussed in a thread on the mercurial mailing list.
In http://markmail.org/message/anqaxldup4tmgyrx a slightly different algorithm
was suggested. In it the p1 and p2 tags would have been interleaved instead of
put one before the other. It would be possible to implement that but my tests
suggest that the merge result would be more confusing and harder to understand.
2014-06-26 01:20:25 +02:00
Matt Mackall
dcb326f0e5 filemerge: use non-minimal conflict marker regions (BC)
As extensively detailed by Pierre-Yves[1], simplemerge's minimal
markers can result in hopeless confusion for many common merges. As it
happens, we accidentally inherited this behavior when we borrowed
simplemerge from bzr; it is not the behavior used by RCS's merge(1),

Since merge(1) (and not bzr) is what we aim to emulate when emulating
RCS's merge markers, we simply turn this feature off. This brings us
in line with the behavior of CVS, SVN, and Git as a bonus.

(NB: using conflict markers with Mercurial is discouraged.)

[1] http://markmail.org/message/wj5mh3lc46czlvld

convert glob tessa
2014-07-18 21:49:52 -05:00
Sean Farley
2c7a940b62 memctx: add note about p2 2014-06-17 20:55:06 -07:00
Sean Farley
f810468c76 memfilectx: add remove and write methods
Similar to the previous patch for workingfilectx, this patch will allow
abstracting localrepo.remove / write method to refactor working directory code
but instead operate on files in memory.
2014-07-25 20:20:26 -05:00
Sean Farley
a94ef7041a workingfilectx: add remove and write methods
This patch will allow abstracting localrepo.remove / write method to refactor
working directory code.
2014-07-02 14:01:01 -05:00
Sean Farley
2909941bb0 memctx: create a filectxfn if it is not callable
This will allow future patches to construct a memctx based on another context
or any other store-type object.
2014-07-25 19:36:01 -05:00
Augie Fackler
4cfa282888 test-patchbomb.t: work around Python change d579866d6419 (issue4188)
Python 2.7.7 and later (as well as some ubuntu/debian packages of
2.7.6) include a fix that makes the email module more pedantically
correct for MIME boundaries, but this breaks our tests. We work around
this by filtering the output of any 'hg email' invocations in the test
that produce MIME messages.
2014-08-07 11:39:19 -04:00
Pierre-Yves David
5f2b50474c phase: add a transaction argument to retractboundary
We now pass a transaction option to this phase movement function. The
object is currently not used by the function, but it will be in the
future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.
2014-08-05 23:52:21 -07:00
Pierre-Yves David
a9275323db phase: add a transaction argument to advanceboundary
We now pass a transaction option to this phase movement function. The object
is currently not used by the function, but it will be in the future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.

The retractboundary function remains to be upgraded.
2014-08-06 01:54:19 -07:00
Pierre-Yves David
aaed9a0813 pull: pre-filter remote phases before moving local ones
We were relying on the phase internals to filter out redundant phase
information from remove. However as we plan to integrate phase
movement inside the transaction, we want to avoid useless transaction
creation on no-op pulls.

Therefore we filter out all the information that already matches the current
repository state. This will let us create a transaction only when there is
actual phase movement needed.
2014-08-06 00:54:37 -07:00
Pierre-Yves David
3a3f88b337 test-check-commit-hg.t: automatically test all 'draft() and ::.' changesets
We introduce a test-check-commit-hg.t file that will happily run the
check-commit file on all draft changeset under the working directory.

This should help newcomers to catch up with the rules. (And will helps old timer
from time to time).
2014-08-06 01:40:51 -07:00
Matt Mackall
7cba48bf37 whitespace: nuke triple blank lines in **.py 2014-08-07 14:58:12 -05:00
Matt Mackall
c16790ef08 check-commit: spot growing whitespace
We discourage PEP-8-style double blank lines, spot them creeping in.
2014-08-07 14:57:20 -05:00
Jordi Gutiérrez Hermoso
465e05be10 strip: remove -b/--backup codepaths
cset 21b4faf3787e has removed this option. This commit just tidies the
code that was associated to it. It also fixes the internal calls to
the strip() function.

Before this change, any function that thought it would want as a final
safety to keep a partial backup bundle (bundling changes not linearly
related to the current change being stripped), had to explicitly pass
a backup="strip" option. With this change, these backups are always
kept in case of an exception and always removed if there is no
exception. Only full backups can be specified with backup=True or no
full backups with backup=False.
2014-07-24 15:06:08 -04:00
Jordi Gutiérrez Hermoso
0ee68cc094 simplemerge: remove dead code
The following functions in simplemerge are dead code. I reran "make
test-merge*" after this change, and it passed. Looks like cruft that
we've been carrying since we nabbed this code from bzr.
2014-08-07 12:51:45 -04:00
Sean Farley
a9b7ae9555 basectx: add missing, merge, and branch args to dirty method
This fixes a discrepency for basectx and classes that inherit from it. Now
callers can pass these arguments to any context without an exception being
raised.
2014-06-17 20:26:51 -07:00
Sean Farley
760faddb4c basefilectx: move isexec and islink from memfilectx
This will be used in the future for creating memctx objects from other
store-type objects, such as a patch store or even another context.
2014-07-25 20:11:47 -05:00
Matt Mackall
a2b42e253a tests: fix pyflakes test whitespace breakage 2014-08-06 12:16:58 -05:00
Pierre-Yves David
4d38b093fd pushkey: wrap pushkey phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:54:58 -07:00
Pierre-Yves David
322ec1b757 push: wrap local phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:54:15 -07:00
Pierre-Yves David
f2b6946a89 phase: wrap hg phases phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:50:53 -07:00
Pierre-Yves David
7a1c469474 mq: wrap qimport phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:50:07 -07:00
Pierre-Yves David
6f74d76989 mq: wrap qfinish phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:48:51 -07:00
Matt Mackall
241d2dc08e tests: change some #ifs to #requires 2014-08-06 11:53:08 -05:00