Commit Graph

23975 Commits

Author SHA1 Message Date
Matt Mackall
b907416f7b merge with stable 2015-03-02 01:20:14 -06:00
Matt Mackall
f1585fbf2a Added signature for changeset 8b6d843300a0 2015-03-02 01:06:31 -06:00
Matt Harbison
b740e2a862 test-obsolete: use 'log -T {node}' instead of 'id --debug -i' to lookup hash
I ran into a case when adding a test where there were cryptic hg command line
errors.  I eventually traced it back to 'hg id' printing debug messages before
the hash:

    invalid branchheads cache (served): tip differs <hash>

This method should eliminate any other output except the node.
2015-02-28 01:12:54 -05:00
Matt Mackall
6decf56e3e merge with stable 2015-02-27 17:46:03 -06:00
Martin von Zweigbergk
9bb31557ba manifest: rename 'mf', 'map', and 'mapping' to 'm'
We mostly call manifest variables 'm', so let's use that in
manifest.py too. This makes it clearer that the variables do, in fact,
contain manifestsdict instances and never a plain dict.
2015-02-24 09:08:54 -08:00
Martin von Zweigbergk
4233d16798 manifest: make copy logic local to copy()
The optional arguments to the manfifestdict constructor are only used
by copy(), so assign the fields from that method instead so it's clear
that the arguments are not used for anything else.
2015-02-23 13:41:02 -08:00
Matt Harbison
7c735629be extensions: indicate loaded for an immediately called afterload callback
Otherwise, there's no way to tell between the immediate callback when it is
already loaded, and when the extension is not loaded at all.
2015-02-21 00:40:18 -05:00
Gregory Szorc
bcba93c7f5 tests: add test showing tags cache drops filtered heads (issue4550)
The tags cache can lose .hgtags filenode entries for filtered heads. Add
a test demonstrating this (bad) behavior.
2015-02-24 00:08:04 -08:00
Gregory Szorc
c3c80f0fa5 tags: write tags cache deterministically
An upcoming test verifies content of the .hg/cache/tags file. During
testing, inconsistent output was observed. This is the result of
iterating over a dictionary.

Throw a sorted() around tags entries to ensure .hg/cache/tags is written
deterministically so test output is stable.
2015-02-24 00:06:47 -08:00
Martin von Zweigbergk
07f7ea01b3 subrepo: add tests for change/remove conflicts
There are currently no tests for change/remove conflicts of subrepos,
and it's pretty broken. Add some tests demonstrating some of the
breakages and fix the most obvious one (a KeyError when trying to look
up a subrepo in the wrong context).
2015-02-17 23:20:55 -08:00
Anton Shestakov
b508925735 hgweb: recreate old DOM structure for css in monoblue style
There's a "p.changeset-age span" css block in style-monoblue.css with quite a
bit of rules, including position. They were all unused, since there weren't
matching span element inside the p.changeset-age.

The span was removed in 064b658181dd (as it seemed meaningless at the time?)
and since then relative changeset age text looked weird and broken.

"age" class is used for calculating relative changeset age in javascript: all
content of such element is replaced with human-friendly text (e.g.
"yesterday"). So the new span gets the age class.
2015-02-12 10:38:33 +08:00
Yuya Nishihara
28b8cb187f shellquote: fix missing quotes for empty string
"hg kdiff3 -rREV" did not work because 72640182118e and 295ba4ee1d13 failed
to handle empty argument.
2015-02-11 19:57:07 +09:00
Mads Kiilerich
56207b4242 revisionbranchcache: fall back to slow path if starting readonly (issue4531)
Transitioning to Mercurial versions with revision branch cache could be slow as
long as all operations were readonly (revset queries) and the cache would be
populated but not written back.

Instead, fall back to using the consistently slow path when readonly and the
cache doesn't exist yet. That avoids the overhead of populating the cache
without writing it back.

If not readonly, it will still populate all missing entries initially. That
avoids repeated writing of the cache file with small updates, and it also makes
sure a fully populated cache available for the readonly operations.
2015-02-06 02:52:10 +01:00
FUJIWARA Katsunori
d70128b84b largefiles: access to specific fields only if largefiles enabled (issue4547)
Even if largefiles extension is enabled in a repository, "repo"
object, which isn't "largefiles.reposetup()"-ed, is passed to
overridden functions in the cases below unexpectedly, because
extensions are enabled for each repositories strictly.

  (1) clone without -U:
  (2) pull with -U:
  (3) pull with --rebase:

    combination of "enabled@src", "disabled@dst" and
    "not-required@src" cause this situation.

       largefiles     requirement
    @src     @dst     @src            result
    -------- -------- --------------- --------------------
    enabled  disabled not-required    aborted unexpectedly
                      required        requirement error (intentional)
    -------- -------- --------------- --------------------
    enabled  enabled  *               success
    -------- -------- --------------- --------------------
    disabled enabled  *               success (only for "pull")
    -------- -------- --------------- --------------------
    disabled disabled not-required    success
                      required        requirement error (intentional)
    -------- -------- --------------- --------------------

  (4) update/revert with a subrepo disabling largefiles

In these cases, overridden functions cause accessing to largefiles
specific fields of not "largefiles.reposetup()"-ed "repo" object, and
execution is aborted.

  - (1), (2), (4) cause accessing to "_lfstatuswriters" in
    "getstatuswriter()" invoked via "updatelfiles()"

  - (3) causes accessing to "_lfcommithooks" in "overriderebase()"

For safe accessing to these fields, this patch examines whether passed
"repo" object is "largefiles.reposetup()"-ed or not before accessing
to them.

This patch chooses examining existence of newly introduced
"_largefilesenabled" instead of "_lfcommithooks" and
"_lfstatuswriters" directly, because the former is better name for the
generic "largefiles is enabled in this repo" mark than the latter.

In the future, all other overridden functions should avoid largefiles
specific processing for efficiency, and "_largefilesenabled" is better
also for such purpose.

BTW, "lfstatus" can't be used for such purpose, because some code
paths set it forcibly regardless of existence of it in specified
"repo" object.
2015-02-26 06:03:39 +09:00
Yuya Nishihara
4c5195bbaa templatekw: fix {join(bookmarks, sep)} to always show associated bookmarks
The default joinfmt, "x.values()[0]", can't be used here because it picks
either 'bookmark' or 'current' randomly.

I got wrong result with PYTHONHASHSEED=1 on my amd64 machine.
2015-02-18 22:17:35 +09:00
Yuya Nishihara
80c7f8aa9b templatekw: inline showlist() into showbookmarks()
showlist() is the helper to build _hybrid object from a trivial list. It can't
be applied if each value has more than one items, 'bookmark' and 'current' in
this case.

This change is necessary to fix random failure of "{join(bookmarks, sep)}".
2015-02-18 22:10:17 +09:00
Matt Mackall
055206a473 transaction: disable hardlink backups (issue4546)
Causing troubles, simplest fix.
2015-03-02 00:12:29 -06:00
Matt Mackall
3f5d6ecec7 repoview: invalidate cached changelog if _delayed changes (issue4549)
Starting with b1e85ff3a7fc, when a clone reached the checkout stage,
the cached changelog in the filtered view was still seeing the
_delayed flag, even though the changelog had already been finalized.
2015-03-01 23:20:02 -06:00
Sean Farley
6ef832d911 test: make test-extdiff resilient to */gnubin/echo
My Mac test machine has 'echo' in '/opt/local/libexec/gnubin/echo' since, well,
GNU is not BSD.

Also, I feel it need to be said about using regexes:

Some people, when confronted with a problem, think "I know, I'll use regular
expressions." Now they have two problems.
2015-02-26 10:23:04 -08:00
Yuya Nishihara
be4fae44fb dispatch: work around UnicodeDecodeError caused by SSLError of Python 2.7.9
SSLError of Python 2.7.9 may keep error message in unicode. It will be
wrapped by URLError(reason) at KeepAliveHandler.do_open, so inst.reason can
be a unicode.

https://hg.python.org/cpython/file/v2.7.9/Modules/_ssl.c#l329
2015-02-26 23:30:33 +09:00
FUJIWARA Katsunori
8a439b3cc6 revset: mask specific names for named() predicate
Before this patch, revset predicate "tag()" and "named('tags')" differ
from each other, because the former doesn't include "tip" but the
latter does.

For equivalence, "named('tags')" shouldn't include the revision
corresponded to "tip". But just removing "tip" from the "tags"
namespace causes breaking backward compatibility, even though "tip"
itself is planned to be eliminated, as mentioned below.

    http://selenic.com/pipermail/mercurial-devel/2015-February/066157.html

To mask specific names ("tip" in this case) for "named()" predicate,
this patch introduces "deprecated" into "namespaces", and makes
"named()" predicate examine whether each names are masked by the
namespace, to which they belong.

"named()" will really work correctly after 3.3.1 (see a3c326a7f57a for
detail), and fixing this on STABLE before 3.3.1 can prevent initial
users of "named()" from expecting "named('tags')" to include "tip".

It is reason why this patch is posted for STABLE, even though problem
itself isn't so serious.

This may have to be flagged as "(BC)", if applied on DEFAULT.
2015-02-05 14:45:49 +09:00
Wagner Bruna
af401eafef i18n-pt_BR: synchronized with be4e8b8e43d7 2015-03-01 00:18:43 -03:00
FUJIWARA Katsunori
5a992da389 i18n-ja: synchronized with be4e8b8e43d7 2015-03-01 01:28:05 +09:00
Augie Fackler
69e342baa2 log: fix json-formatted output when file copies are listed (issue4523) 2015-02-02 14:26:47 -05:00
FUJIWARA Katsunori
c3172b4737 revset: get revision number of each node from target namespaces
Before this patch, revset predicate "named()" uses each nodes gotten
from target namespaces directly.

This causes problems below:

  - combination of other predicates doesn't work correctly, because
    they assume that revisions are listed up in number

  - "hg log" doesn't show any revisions for "named()" result, because:

    - "changeset_printer" stores formatted output for each revisions
      into dict with revision number (= ctx.rev()) as a key of them

    - "changeset_printer.flush(rev)" writes stored output for
      the specified revision, but

    - "commands.log" invokes it with the node, gotten from "named()"

  - "hg debugrevspec" shows nodes (= may be binary) directly

Difference between revset predicate "tag()" and "named('tags')" in
tests is fixed in subsequent patch.
2015-02-03 21:56:29 +09:00
Matt Mackall
7bca5d6a44 Added signature for changeset 9eef240bfcd9 2015-02-01 20:21:02 -06:00
Matt Mackall
5aa82231ff merge with i18n 2015-02-01 18:47:04 -06:00
Matt Mackall
b09693fbd8 filectx: use _descendantrev in parents()
This lets us be lazy about linkrev adjustments when tracing history.
2015-02-01 16:33:45 -06:00
Matt Mackall
66f6b10d5f filectx: if we have a _descendantrev, use it to adjust linkrev
This lets us use _adjustlinkrev lazily.
2015-02-01 16:26:35 -06:00
Matt Mackall
ab01fb226c copies: use linkrev for file tracing limit
This lets us lazily evaluate _adjustlinkrev.
2015-02-01 16:25:12 -06:00
Matt Mackall
9b9eada68d filectx: use linkrev to sort ancestors
We're going to make rev() lazily do _adjustlinkrevs, and we don't want
that to happen when we're quickly tracing through file ancestry
without caring about revs (as we do when finding copies).

This takes us back to pre-linkrev-correction behavior, but shouldn't
regress us relative to the last stable release.
2015-02-01 16:23:07 -06:00
FUJIWARA Katsunori
c16c2eca4a i18n-ja: synchronized with d197a07d4a2b 2015-02-01 08:24:08 +09:00
Pierre-Yves David
e94f338ab6 _adjustlinkrev: reuse ancestors set during rename detection (issue4514)
The new linkrev adjustement mechanism makes rename detection very slow, because
each file rewalks the ancestor dag. To mitigate the issue in Mercurial 3.3, we
introduce a simplistic way to share the ancestors computation for the linkrev
validation phase.

We can reuse the ancestors in that case because we do not care about
sub-branching in the ancestors graph.

The cached set will be use to check if the linkrev is valid in the search
context. This is the vast majority of the ancestors usage during copies search
since the uncached one will only be used when linkrev is invalid, which is
hopefully rare.
2015-01-30 16:02:28 +00:00
Pierre-Yves David
a0008f62ee filectx: move _adjustlinkrev to a method
We are going to introduce some wider caching mechanisms during linkrev
adjustment. As there is no specific reason to not be a method and some
reasons to be a method, let's make it a method.
2015-01-30 14:39:03 +00:00
FUJIWARA Katsunori
6a05d7fab8 revset: raise RepoLookupError to make present() predicate continue the query
Before this patch, "bookmark()", "named()" and "tag()" predicates
raise "Abort", when the specified pattern doesn't match against
existing ones.

This prevents "present()" predicate from continuing the query, because
it only catches "RepoLookupError".

This patch raises "RepoLookupError" instead of "Abort", to make
"present()" predicate continue the query, even if "bookmark()",
"named()" or "tag()" in the sub-query of it are aborted.

This patch doesn't contain raising "RepoLookupError" for "re:" pattern
in "tag()", because "tag()" treats it differently from others. Actions
of each predicates at failure of pattern matching can be summarized as
below:

  predicate  "literal:"  "re:"
  ---------- ----------- ------------
  bookmark   abort       abort
  named      abort       abort
  tag        abort       continue (*1)

  branch     abort       continue (*2)
  ---------- ----------- ------------

"tag()" may have to abort in the (*1) case for similarity, but this
change may break backward compatibility of existing revset queries. It
seems to have to be changed on "default" branch (with "BC" ?).

On the other hand, (*2) seems to be reasonable, even though it breaks
similarity, because "branch()" in this case doesn't check exact
existence of branches, but does pick up revisions of which branch
matches against the pattern.

This patch also adds tests for "branch()" to clarify behavior around
"present()" of similar predicates, even though this patch doesn't
change "branch()".
2015-01-31 01:00:50 +09:00
FUJIWARA Katsunori
beb57d53bc templatekw: re-add showtags() to list tags keyword up in online help
Changeset 427a0ac924e4 removed "showtags()" definition for "tags"
template keyword from "templatekw.py", because "namespaces" puts a
helper function for it into template keyword map automatically. This
works correctly from the point of view of templating functionality.

But on the other hand, it removed "tags" template keyword from "hg
help templates" unexpectedly, because online help text is built before
"namespaces" puts a helper function for "tags" into template keyword
map.

This patch is a kind of backing 427a0ac924e4 out, but this implements
"showtags()" with newly introduced "shownames()" instead of originally
used "showlist()".
2015-02-01 09:36:47 +09:00
Matt Harbison
b0c0e689b9 largefiles: don't interfere with logging normal files
The previous code was adding standin files to the matcher's file list when
neither the standin file nor the original existed in the context.  Somehow, this
was confusing the logging code into behaving differently from when the extension
wasn't loaded.

It seems that this was an attempt to support naming a directory that only
contains largefiles, as a test fails if the else clause is dropped entirely.
Therefore, only append the "standin" if it is a directory.  This was found by
running the test suite with --config extensions.largefiles=.

The first added test used to log an additional cset that wasn't logged normally.
The only relation it had to file 'a' is that 'a' was the source of a move, but
it isn't clear why having '.hglf/a' in the list causes this change:

    @@ -47,6 +47,11 @@

     Make sure largefiles doesn't interfere with logging a regular file
       $ hg log a --config extensions.largefiles=
    +  changeset:   3:2ca5ba701980
    +  user:        test
    +  date:        Thu Jan 01 00:00:04 1970 +0000
    +  summary:     d
    +
       changeset:   0:9161b9aeaf16
       user:        test
       date:        Thu Jan 01 00:00:01 1970 +0000

The second added test used to complain about a file not being in the parent
revision:

    @@ -1638,10 +1643,8 @@

     Ensure that largefiles doesn't intefere with following a normal file
       $ hg  --config extensions.largefiles= log -f d -T '{desc}' -G
    -  @  c
    -  |
    -  o  a
    -
    +  abort: cannot follow file not in parent revision: ".hglf/d"
    +  [255]
       $ hg log -f d/a -T '{desc}' -G
       @  c
       |

Note that there is still something fishy with the largefiles code, because when
using a glob pattern like this:

    $ hg log 'glob:sub/*'

the pattern list would contain '.hglf/glob:sub/*'.  None of the tests show this
(this test lives in test-largefiles.t at 1349), it was just something that I
noticed when the code was loaded up with print statements.
2015-01-30 20:44:11 -05:00
Pierre-Yves David
1cc9c00470 discovery: properly exclude locally known but filtered heads
The conditional was a bit too narrow and produced buggy result when a node was
present in both common and heads (because it pleased the discovery) and it was
locally known but filtered.

This resulted in buggy getbundle request and server side crash.
2015-01-30 21:11:02 +00:00
Pierre-Yves David
0616b8f246 test: make test-extdiff resilient to /usr/bin/echo
My test machine has 'echo' in '/usb/bin/echo', #dontaskmewhy.
2015-01-30 21:40:30 +00:00
Pierre-Yves David
35033dc470 obsstore: make the invalid markers check wrap-able
Some evolve user ignored the invalid markers for about two years and still have
some of them in some repository. This lead to plain abort whenever mercurial try
to open such repo. We need reinstall some way to clean this up in the evolve
extension. For this purpose, we need the checker code wrap-able independently.

This is scheduled for stable as this issue is blocking some evolve user.
2015-01-30 18:49:33 +00:00
Mads Kiilerich
dddf142726 convert: replace revision references in messages if they are >= short hashes
Convert will try to find references to revisions in commit messages and replace
them with references to the converted revision. It will take any string that
looks like a hash (and thus also decimal numbers) and look it up in the source
repo. If it finds anything, it will use that in the commit message instead.

It would do that for all hex digit sequences of 6 to 40 characters. That was
usually no problem for small repos where it was unlikely that there would be a
matching 6 'digit' hash prefix. It was also no problem on repos with less than
100000 changesets where numbers with 6 or more digits not would match any
revision number. With more than 100000 revisions random numbers in commit
messages would be replaced with a "random" hash. For example, 'handle 100000
requests' would be changed to to 'handle 9117c6 requests'. Convert could thus
not really be used on real repositories with more than 100000 changesets.

The default hash length shown by Mercurial is 12 'digits'. It is unexpected and
unwanted that convert by default tries to replace revision references that use
less than that amount of 'digits'.

To fix this, don't match strings that are less than the default hash size of 12
characters.
2015-01-30 18:51:20 +01:00
FUJIWARA Katsunori
2ad325e10a merge: mark .hgsubstate as possibly dirty before submerge for consistency
Before this patch, failure of updating subrepos may cause inconsistent
".hgsubstate". For example:

  1. dirstate entry for ".hgsubstate" of the parent repo is filled
     with valid size/date (via "hg state" or so)

  2. "hg update" is invoked at the parent repo

  3. ".hgsubstate" of the parent repo is updated on the filesystem as
     a part of "g"(et) action in "merge.applyupdates"

  4. it is assumed that size/date of ".hgsubstate" on the filesystem
     aren't changed from ones at (1)

     this is not so difficult condition, because just changing hash
     ids (every ids are same in length) in ".hgsubstate" doesn't
     change the file size of it

  5. "subrepo.submerge()" is invoked to update subrepos

  6. failure of updating in one of subrepos raises exception
     (e.g. "untracked file differs")

  7. "hg update" is aborted without updating dirstate of the parent repo

     dirstate entry for ".hgsubstate" still holds size/date at (1)

Then, ".hgsubstate" of the parent repo is treated as "CLEAN"
unexpectedly, because updating ".hgsubstate" at (3) doesn't change
size/date of it on the filesystem: see assumption at (4).

This inconsistent ".hgsubstate" status causes unexpected behavior, for
example:

  - "hg revert" forgets to revert ".hgsubstate"

  - "hg update" misunderstands that (not yet updated) subrepos diverge
    (then, it shows the prompt to confirm user's decision)

To avoid inconsistent ".hgsubstate" status above, this patch marks
".hgsubstate" as possibly dirty before "submerge" invocation.
"normallookup"-ed (= dirty) dirstate should be written out, even if
processing is aborted by failure.

This patch marks ".hgsubstate" as possibly dirty before "submerge",
also when it is removed or merged while merging, for safety. This
should prevent Mercurial from misunderstanding inconsistent
".hgsubstate" as clean.

To satisfy conditions at (1) and (4) above, this patch uses "hg status
--config debug.dirstate.delaywrite=2" (to fill valid size/date into
dirstate) and "touch" (to fix date of the file).
2015-01-30 04:59:05 +09:00
Wagner Bruna
edf02017e9 i18n-pt_BR: synchronized with 7c70060dff84 2015-01-29 10:13:18 -02:00
Pierre-Yves David
3e6abb6494 rebase: ensure rebase revision remains visible (issue4504)
Before this changeset rebase was getting very confused if any revision in the
rebase set became hidden. This was fairly easy to achieve if a rebased revision
was made visible by the working copy location. The rebase process would update
somewhere else and the revision would become hidden.

To work around this issue, we ensure rebased revisions remain visible for the
whole process.

This is a simple change suitable for stable. More subtle usage of unfiltered
repository in rebase may solve this issue more cleanly.
2015-01-27 12:33:56 +00:00
Mads Kiilerich
a59deecf40 extdiff: reintroduce backward compatibility with manual quoting of parameters
b8552020f458 broke things ... and the following cleanups didn't fix all issues.
It didn't work with the diffargs shipped in mergetools.rc with explicit
quoting. Parameters would end up with being quoted twice - especially if they
really needed quoting.

To work around that, look for explicit quotes around the variables that will be
substituted with proper quoting. Also accept an additional prefix so we can
handle both
  --foo='$parent'
and
  '--foo=$parent'

It will however still fail if the user intentionally place the variable inside
a quoted string, as in
  'parent $parent is on the left'
There is currently no good way to handle that, short of knowing exactly which
quoting mechanism will be used.
2015-01-28 02:28:39 +01:00
Mads Kiilerich
b6c0ac9146 mergetools: drop incorrect quoting of diffargs variables
b8552020f458 introduced automatic quoting of diffargs in a not entirely
backwards compatible way. That rendered some of the configuration in
mergetools.rc invalid. It would fail when running extdiff on a single file with
a name that needed quoting.

Before:

  $ hg config merge-tools.meld.diffargs
  -a --label='$plabel1' $parent --label='$clabel' $child
  $ hg --config extdiff.meld= -v --debug meld
  running "/usr/bin/meld -a --label=''sp ace@0'' '.../Z.b7a65a1d2f84/sp ace' --label=''sp ace'' '.../sp ace'" in ...
  meld: error: too many arguments (wanted 0-3, got 4)

After:

  $ hg config merge-tools.meld.diffargs
  -a --label=$plabel1 $parent --label=$clabel $child
  $ hg --config extdiff.meld= -v --debug meld
  running "/usr/bin/meld -a --label='sp ace@0' '.../Z.b7a65a1d2f84/sp ace' --label='sp ace' '.../sp ace'" in ...
(success)
2015-01-28 02:28:38 +01:00
FUJIWARA Katsunori
e42765e252 namespace: introduce logfmt to show l10n-ed messages for hg log correctly
Before this patch, "_()" is used incorrectly for "tag:" and
"bookmark:" fields. "changeset_printer()" looks up keys composed at
runtime, and it prevents "xgettext" command from getting strings to be
translated from source files.

Then, *.po files merged with updated "hg.pot" lose msgids for "tag:"
and "bookmark:".

This patch introduces "logfmt" information into "namespace" to show
l10n-ed messages "hg log" (or "changeset_printer()") correctly.

For similarity to other namespaces, this patch specifies "logfmt" for
"branches" namespace, even though it isn't needed (branch information
is handled in "changeset_printer()" specially).

To find related code paths out easily, this patch adds "i18n: column
positioning ..."  comment to the line composing "logfmt" by default,
even though this line itself doesn't contain any strings to be
translated.
2015-01-28 22:22:59 +09:00
Augie Fackler
4912d4ca49 osutil: fix memory leak of PyBytes of path in statfiles
Spotted with cpychecker.
2015-01-27 10:17:16 -05:00
Durham Goode
cb1fb957a4 revert: move prefetch to after the actions logic
The prefetch logic came before the actual population of the actions collection,
so it was always being passed an empty action list. This fixes it by moving it
to after that logic.

The only consumer of this function at the moment is remotefilelog, and I
verified it works with this change.
2015-01-27 19:52:26 -08:00
Augie Fackler
6930c232d6 diffhelpers: fix botched return statement from e48d70075d8a
Spotted by Sean Farley using clang.
2015-01-28 13:34:20 -05:00