Commit Graph

8842 Commits

Author SHA1 Message Date
Pierre-Yves David
e5b26a2e94 bundle2: disable ouput capture unless we use http (issue4613 issue4615)
The current bundle2 processing was capturing all output. This is nice as it
provide better meta data about what output what, but this was changing two
things:

1) adding a prefix "remote: " to "other" output during local push (issue4613)
2) local and ssh push does not provide real time output anymore (issue4615)

As we are unsure about what form should be used in (1) and how to solve (2) we
disable output capture in this two cases. Output capture can be forced using an
experimental option.
2015-04-28 17:38:02 -07:00
Matt Harbison
1df2171ff6 subrepo: propagate the --hidden option to hg subrepositories
With many commands accepting a '-S' or an explicit path to trigger recursing
into subrepos, it seems that --hidden needs to be propagated too.
Unfortunately, many of the subrepo layer methods discard the options map, so
passing the option along explicitly isn't currently an option.  It also isn't
clear if other filtered views need to be propagated, so changing all of those
commands may be insufficient anyway.

The specific jam I got into was amending an ancestor of qbase in a subrepo, and
then evolving.  The patch ended up being hidden, and outgoing said it would only
push one unrelated commit.  But push aborted with an 'unknown revision' that I
traced back to the patch.  (Odd it didn't say 'filtered revision'.)  A push with
--hidden worked from the subrepo, but that wasn't possible from the parent repo
before this.

Since the underlying problem doesn't actually require a subrepo, there's
probably more to investigate here in the discovery area.  Yes, evolve + mq is
not exactly sane, but I don't know what is seeing the hidden revision.

In lieu of creating a test for the above situation (evolving mq should probably
be blocked), the test here is a marginally useful case where --hidden is needed
in a subrepo: cat'ing a file in a hidden revision.  Without this change, cat
aborts with:

  $ hg --hidden cat subrepo/a
  skipping missing subrepository: subrepo
  [1]
2015-02-03 15:01:43 -05:00
Matt Harbison
d85501c01b subrepo: don't pass the outer repo's --rev or --branch to subrepo incoming()
When passing a --rev, 'hg incoming -S' previously suffered from the same output
truncation or abort that was fixed for 'hg outgoing -S' in the previous patch,
for the same reasons.

Unlike push, subrepos are currently only pulled when the outer repo is updated,
not when the outer repo is pulled.  That makes matching 'hg pull' behavior
impossible.  Listing all incoming csets in the subrepo seems like the most
useful behavior, and is consistent with 'hg outgoing -S'.
2015-04-27 21:34:23 -04:00
Matt Harbison
87ea927ca1 subrepo: don't pass the outer repo's --rev or --branch to subrepo outgoing()
The previous behavior didn't reflect what would actually be pushed- push will
ignore --rev and --branch in the subrepo and push everything.  Therefore,
'push -r {rev}' would not list everything, unless {rev} was also the revision of
the subrepo's tip.  Worse, if a hash was passed in, the command would abort
because that hash would either not be in the outer repo or not in the subrepo.
2015-04-27 21:15:25 -04:00
Laurent Charignon
18e5516b11 shelve: make the interactive mode experimental
While fixing issue4304: "record: allow editing new files" we introduced
changes in record/crecord. These changes need to be matched with changes in any
command using record. Shelve is one of these commands and the changes have
not been made for this release. Therefore, shelve -i should be an experimental
feature for this release.
2015-04-27 15:36:10 -07:00
Siddharth Agarwal
222edc51db help: also hide options marked EXPERIMENTAL
Similar to DEPRECATED, add a way to indicate that options are EXPERIMENTAL.
2015-04-27 15:12:41 -07:00
Laurent Charignon
a76105b65c record: fix adding new file with record from within a subdir (issue4626)
In my latest change on record (edit newly added file), I forgot the
repo.wjoin() so that record was not computing the paths properly to delete
the backups and was crashing.
2015-04-27 14:02:49 -07:00
Matt Mackall
cc085ed36a tests: fix backslashes in test-casefolding 2015-04-27 16:24:43 -05:00
Matt Harbison
30dc79b90c test-commit-interactive: stablize output for no-execbit platforms 2015-04-26 15:13:13 -04:00
Matt Harbison
a3c34e558c test-bundle2-exchange: make hooks compatible with Windows
The cmd.exe process doesn't fail the hook when "; false" is appended, and its
echo command prints out the quote characters.
2015-04-26 15:10:09 -04:00
Matt Harbison
8ed0a9ea81 subrepo: don't write .hgsubstate lines with empty subrepo state (issue4622)
The '' that is used to represent the state of a not-yet-committed
subrepo cannot be written to the file, because the code that parses
the file splits on ' ' and expects two parts.

Given that the .hgsubstate file is automatically rewritten on commit, it seems
a little strange that the file is written out during a merge.
2015-04-24 23:23:55 -04:00
Matt Harbison
83f972bb8d revert: restore the ability to revert across case only renames (issue4481)
This regressed in 39be809de631, in what looks like an unrelated change.

It seems sufficient to pass 'ignoremissing=True', but the restored try/except
has been there for six years since 3f24f7324cd8, so this seems safer for now.
Note that renaming directories in the filename doesn't appear to work- not sure
if this would end up throwing a different type of error when that is fixed.
2015-04-25 23:54:31 -04:00
Jordi Gutiérrez Hermoso
772b5e72a2 template-phases: do not show description or summary if empty
This is a copy of 942d64e0a1ee, but applied to the phases template,
which is itself almost a copy of the default template.

Perhaps we should rewrite these templates to use the %include syntax
afforded by config files. This change seems a bit too big for stable,
though.
2015-04-24 14:52:12 -04:00
Jordi Gutiérrez Hermoso
103a0c6840 test-command-template: add a short description of a temporary snippet
This snippet was introduced by 942d64e0a1ee. Its purpose seems a bit
obscure without historical context.
2015-04-24 14:17:14 -04:00
Pierre-Yves David
1dc90191f8 bundle2: also save output when error happens during part processing
Until this changeset, we were only able to save output if an error happened
during the 'transaction.close()' phase. If the 'processbundle' call raised an
exception, the 'bundleoperation' object was never returned, so the reply bundle
was never accessible and no output could be salvaged. We introduce a quick (but
not very elegant) fix to gain access to any reply created during the processing.

This conclude this output related series. We should hopefully be able client-side to see the
whole server output, in a proper order.

The code is now complex enough that a refactoring of it would make sense on
default.
2015-04-23 16:36:18 +01:00
Pierre-Yves David
ae773fc61e bundle2: capture output issue during transaction close
We were capturing all output issue during bundle2 processing, and all output
issue during transaction rollback in case of failure. However, the output issue
during transaction commit was still roaming the land freely. It is now put back
in line.

This let the user see output from 'pretxnclose' and 'txnclose' (and related) in
the right order.
2015-04-23 14:54:45 +01:00
Pierre-Yves David
1e8ec29191 bundle2: also capture hook output during processing
External hook used to directly write on stdout and stderr. As a result their
output was not captured by the bundle2 processing. This resulted in confusing
out of order output on the client side. We are now capturing hooks output in
this context.
2015-04-23 17:03:58 +01:00
Pierre-Yves David
47985fc815 bundle2: capture transaction rollback message output (issue4614)
The output from the transaction rollback was not included into the reply bundle.
It was eventually caught by the usual 'unbundle' output capture and sent to the
client but the result was out of order on the client side. We now capture the
output for the transaction release and transmit it the same way as all other
output.

We should probably rethink the whole output capture things but this would not be
appropriate for stable.

The is still multiple cases were output failed to be properly capture, they will
be fixed in later changesets.
2015-04-23 14:20:36 +01:00
Laurent Charignon
6fc9e8be66 record: edit patch of newly added files (issue4304)
I tried to fix this issue in the past and had to revert the fix. This is a
second attempt without the regression we found with the first one.

record defines special headers (of file) as headers whose hunk are not shown
to the user for editing, they are used to represent deleted, moved and new
files. Since we want to authorize editing the patch of newly added file we
make the newly added file with some content not special anymore. This entails
that we have to save their content before applying the backup to be able to
revert it if the patch does not apply properly.
We reintroduce the test showing that newly added files can be edited and that
their content is shown to the user.
2015-04-23 14:27:26 -07:00
Laurent Charignon
ec981b8835 record: remove useless line in test
Remove a useless line in test to make the next patch cleaner.
2015-04-23 16:59:11 -07:00
FUJIWARA Katsunori
2a4f646cd6 revert: apply normallookup on reverted file if size isn't changed (issue4583)
Before this patch, reverting a file to the revision other than the
parent doesn't update dirstate. This seems to expect that timestamp
and/or size will be changed by reverting.

But if (1) dirstate of file "f" is filled with timestamp before
reverting and (2) size and timestamp of file "f" isn't changed at
reverting, file "f" is recognized as CLEAN unexpectedly.

This patch applies "dirstate.normallookup()" on reverted file, if size
isn't changed.

Making "localrepository.wwrite()" return length of written data is
needed to avoid additional (and redundant) "lstat(2)" on the reverted
file. "filectx.size()" can't be used to know it, because data may be
decoded at being written out.

BTW, interactive reverting may cause similar problem, too. But this
patch doesn't focus on fixing it, because (1) interactive (maybe slow)
reverting changes one (or both) of size/timestamp of reverted files in
many usecases, and (2) changes to fix it seems not suitable for stable
branch.
2015-04-24 23:52:41 +09:00
Martin von Zweigbergk
f1e241ceae revert: accept just -I/-X without paths or -a/-i (issue4592)
'hg revert -I foo' currently fails with

  abort: no files or directories specified
  (use --all to revert all files, or 'hg update 1' to update)

It doesn't seem intentional that -I/-X without other paths or
--all/--interactive should fail, and it doesn't seem that harmful to
allow it either, so let's just do that.
2015-04-22 16:38:36 -07:00
FUJIWARA Katsunori
8fe63fa17c tests: use double quote to quote arguments in hook for portability
On windows, single quote doesn't work as quote character in hook
command line, because "cmd.exe" doesn't recognize it as quoting
character. And this causes failure of test.

This patch uses double quote to quote arguments in hook instead of
single quote for portability.

Even though single quotes for "[hooks] pretxncommit" in
test-clone-pull-corruption.t seems to work correctly (may MinGW sh
treat specially ?) AFAIK, this patch also replaces them by double
quotes for consistency.
2015-04-23 22:39:21 +09:00
Laurent Charignon
4fc3c4c465 record: fix record with change on moved file crashes (issue4619)
reverting fe807064739c, add a test to prevent the issue from coming back.
2015-04-22 13:56:30 -07:00
Durham Goode
f289436208 histedit: fix rollup prompting for a commit message (issue4606)
Commit 960f8ca79ab1 broke histedit's rollup by causing it to open the editor.
Turns out I missed a spot where the rollup option was read.

This fixes that and adjusts the test to catch this case.
2015-04-20 18:44:57 -07:00
Matt Harbison
172c5c52cf test-hook.t: don't directly use redirect to /dev/null in hook for Windows
This goes with 4100e338a886.  External hooks are run in cmd.exe, which doesn't
know about /dev/null, but sh can handle it.
2015-04-20 13:43:10 -04:00
Matt Mackall
55ee41405d mq: avoid silent failure when single patch doesn't apply (issue4604)
The error-handling here is quite byzantine. self._apply raises an
AbortNoCleanup, but self.apply was swallowing the exception and
returns 2. In self.push, we catch all exceptions.. and cleanup. We try
to print a message to clean up.. but that relies on having a
top-of-stack.

Instead, we re-raise the abort in self.apply, and avoid cleanup on
AbortNoCleanup in self.push by adding a trivial new except clause. We
also modernize the now-visible abort message.
2015-04-20 18:13:44 -05:00
Pierre-Yves David
bf28a4a61f changelog: fix readpending if no pending data exist (issue4609)
Since transaction are used for more than just changesets, it is possible
to have a transaction without new changesets at all. In this case no
''00changelog.i.a' are written. In all cases the 'changelog.readpending'
method is called if the repository has any pending data. The 'revlog' logic
provides empty content if the file is missing, so the whole operation
resulted in an empty changelog.

We now skip reading the pending file if it is missing.
2015-04-20 17:16:22 +02:00
Pierre-Yves David
cb2e913723 afterlock: add the callback to the top level lock (issue4608)
If 'wlock' is taken, we should add 'afterlock' callback to the 'wlock' instead.
Otherwise, running post transaction hook after 'lock' is release but 'wlock' is
still taken lead to a deadlock (eg: 'hg update' during a hook).

This situation is much more common since: b7067abc16c0

  push: acquire local 'wlock' if "pushback" is expected (BC) (issue4596)
2015-04-20 15:27:55 +02:00
Yuya Nishihara
5b51ae23c8 committablefilectx: propagate ancestry info to parent to fix annotation
Before this patch, annotating working directory could include wrong revisions
that were hidden or belonged to different branches. This fixes wfctx.parents()
to set _descendantrev so that all ancestors can take advantage of the linkrev
adjustment introduced at a5aaaeedd6cb. _adjustlinkrev() can handle 'None'
revision thanks to bb19d597bbcd.
2015-04-18 14:10:55 +09:00
Matt Harbison
4ce249627a largefiles: don't mangle filesets when fixing up the log matcher
The fileset-generated.t test previously failed with this:

  +  hg: parse error: unknown identifier: .hglf/modified
  +  (did you mean 'modified'?)
  +  [255]

Filesets will find the standins on their own, without any help.  While that's
useful for some things like modified(), clean(), etc., it is wrong for things
like size().  Proper fileset support for largefiles is not trivial, but this was
failing with just the extension enabled on a normal repo.
2015-04-18 13:08:41 -04:00
Matt Harbison
72ef386079 largefiles: don't crash when cloning to a remote repo
The immediate crash was when checking for requirements immediately after this,
but lfcommands.downloadlfiles() will also crash if --all-largefiles is
specified.  That has been in place since atleast e01343f7da6f (2.3-rc) without
anyone noticing.

I can't tell from the peer classes if there's a way to make the custom largefile
functionality work in this case, but atleast it doesn't crash.
2015-04-18 00:34:38 -04:00
Gregory Szorc
704132c0a7 run-tests: don't error when glob matched line ends with backslash
As part of writing another test, I triggered an array index error in
glob match processing code by having a (glob) line end in a single
backslash (which is the escape character).

Adding a simple bounds check prevents the error in run-tests.py.
2015-04-17 14:12:01 -07:00
Matt Mackall
c5804a09d6 tests: fix portability issue with test-merge-tools
Not sure how this ever worked.
2015-04-17 15:42:20 -05:00
Matt Harbison
d731476e46 test-rename-merge2: fix test failure on Windows
Windows and OpenVMS use double quote for shell quoting, posix uses
single quote. Since the other test lines added in 3ba9d147e92e don't
include the quotes, this was presumably an oversight.
2015-04-17 12:39:55 -04:00
Matt Harbison
f2dec594fe test-add.t: fix output difference between Windows and OS X (issue4603) 2015-04-17 12:11:14 -04:00
Yuya Nishihara
230c1c62ef tags: do not abort if failed to write lock file to save cache
LockHeld wasn't enough to suppress error during acquiring lock. If .hg directory
is read-only, LockUnavailable will be raised.

  $ chmod ugo-w .hg
  $ hg identify
  abort: could not lock working directory of ...: Permission denied
2015-04-17 23:22:58 +09:00
Matt Mackall
0999da5247 tests: fix up whitespace complaint 2015-04-16 20:56:43 -05:00
Matt Mackall
3c00a35039 tests: fix test-tags on vfat
The unix conditional section wasn't cleaning up sufficiently.
2015-04-16 20:52:37 -05:00
Matt Mackall
26612cbb39 tests: ignore sha512 flag in bundle2 for py2.4 2015-04-16 20:31:44 -05:00
Pierre-Yves David
fe42feb68e bundle2-localpeer: properly propagate the server output on error (issue4594)
In case of errors, output parts salvaged from the reply bundle need to be
processed for outputting their content. This concludes our quest for fixing
issue4594.
2015-04-16 04:01:51 -04:00
Pierre-Yves David
0bbcf25859 bundle2-wireproto: properly propagate the server output on error (issue4594)
In case of errors, output parts salvaged from the reply bundle are re-injected
into the bundle carrying the exception.

We still need to fix the situation for non-wireprotocol push.
2015-04-16 03:17:37 -04:00
Pierre-Yves David
bfdd8d2ada hooks: add a 'txnabort' hook
This hook will be called whenever a transaction is aborted. This will make it
easy for people to clean up temporary content they may have created during a
transaction.
2015-04-16 05:36:49 -04:00
Matt Harbison
041a91f971 match: add a subclass for dirstate normalizing of the matched patterns
This class is only needed on case insensitive filesystems, and only
for wdir context matches. It allows the user to not match the case of
the items in the filesystem- especially for naming directories, which
dirstate doesn't handle[1]. Making dirstate handle mismatched
directory cases is too expensive[2].

Since dirstate doesn't apply to committed csets, this is only created by
overriding basectx.match() in workingctx, and only on icasefs.  The default
arguments have been dropped, because the ctx must be passed to the matcher in
order to function.

For operations that can apply to both wdir and some other context, this ends up
normalizing the filename to the case as it exists in the filesystem, and using
that case for the lookup in the other context.  See the diff example in the
test.

Previously, given a directory with an inexact case:

  - add worked as expected

  - diff, forget and status would silently ignore the request

  - files would exit with 1

  - commit, revert and remove would fail (even when the commands leading up to
    them worked):

        $ hg ci -m "AbCDef" capsdir1/capsdir
        abort: CapsDir1/CapsDir: no match under directory!

        $ hg revert -r '.^' capsdir1/capsdir
        capsdir1\capsdir: no such file in rev 64dae27060b7

        $ hg remove capsdir1/capsdir
        not removing capsdir1\capsdir: no tracked files
        [1]

Globs are normalized, so that the -I and -X don't need to be specified with a
case match.  Without that, the second last remove (with -X) removes the files,
leaving nothing for the last remove.  However, specifying the files as
'glob:**.Txt' does not work.  Perhaps this requires 're.IGNORECASE'?

There are only a handful of places that create matchers directly, instead of
being routed through the context.match() method.  Some may benefit from changing
over to using ctx.match() as a factory function:

  revset.checkstatus()
  revset.contains()
  revset.filelog()
  revset._matchfiles()
  localrepository._loadfilter()
  ignore.ignore()
  fileset.subrepo()
  filemerge._picktool()
  overrides.addlargefiles()
  lfcommands.lfconvert()
  kwtemplate.__init__()
  eolfile.__init__()
  eolfile.checkrev()
  acl.buildmatch()

Currently, a toplevel subrepo can be named with an inexact case.  However, the
path auditor gets in the way of naming _anything_ in the subrepo if the top
level case doesn't match.  That is trickier to handle, because there's the user
provided case, the case in the filesystem, and the case stored in .hgsub.  This
can be fixed next cycle.

  --- a/tests/test-subrepo-deep-nested-change.t
  +++ b/tests/test-subrepo-deep-nested-change.t
  @@ -170,8 +170,15 @@
     R sub1/sub2/test.txt
     $ hg update -Cq
     $ touch sub1/sub2/folder/bar
  +#if icasefs
  +  $ hg addremove Sub1/sub2
  +  abort: path 'Sub1\sub2' is inside nested repo 'Sub1'
  +  [255]
  +  $ hg -q addremove sub1/sub2
  +#else
     $ hg addremove sub1/sub2
     adding sub1/sub2/folder/bar (glob)
  +#endif
     $ hg status -S
     A sub1/sub2/folder/bar
     ? foo/bar/abc

The narrowmatcher class may need to be tweaked when that is fixed.


[1] http://www.selenic.com/pipermail/mercurial-devel/2015-April/068183.html
[2] http://www.selenic.com/pipermail/mercurial-devel/2015-April/068191.html
2015-04-12 01:39:21 -04:00
Mads Kiilerich
45a6e1e82f largefiles: for update -C, only update largefiles when necessary
Before, a --clean update with largefiles would use the "optimization" that it
didn't read hashes from standin files before and after the update. Instead of
trusting the content of the standin files, it would rehash all the actual
largefiles that lfdirstate reported clean and update the standins that didn't
have the expected content. It could thus in some "impossible" situations
automatically recover from some "largefile got out sync with its standin"
issues (even there apparently still were weird corner cases where it could
fail). This extra checking is similar to what core --clean intentionally do
not do, and it made update --clean unbearable slow.

Usually in core Mercurial, --clean will rely on the dirstate to find the files
it should update. (It is thus intentionally possible (when trying to trick the
system or if there should be bugs) to end up in situations where --clean not
will restore the working directory content correctly.) Checking every file when
we "know" it is ok is however not an option - that would be too slow.

Instead, trust the content of the standin files. Use the same logic for --clean
as for linear updates and trust the dirstate and that our "logic" will keep
them in sync. It is much cheaper to just rehash the largefiles reported dirty
by a status walk and read all standins than to hash largefiles.

Most of the changes are just a change of indentation now when the different
kinds of updates no longer are handled that differently. Standins for added
files are however only written when doing a normal update, while deleted and
removed files only will be updated for --clean updates.
2015-04-15 15:22:16 -04:00
Mathias De Maré
3f5d166a19 subrepo: add include/exclude support for diffing git subrepos
Previously, git subrepos were ignored if any type of path selection
was done.
This can be solved by using subrepo status and filtering matching files.
2015-04-14 20:09:56 +02:00
Durham Goode
cdb6754f26 histedit: convert fold/roll actions into a class
This converts the fold/roll actions into a histeditclass instance, as part of an
ongoing effort to refactor histedit for maintainability and robustness.

The tests changed for two reasons:

1) We get a new 'empty changeset' warning because we now warn more consistently
between normal histedit and --continue about commits disappearing.

2) Previously we were not putting the histedit-source extra field on the
temporary fold commit during normal runs, but we were on --continue runs. By
unifying these code paths we now consistently put histedit-source on the
temporary fold commit, which changes some of the hashes in the backup bundles.
2015-04-04 02:03:27 -07:00
Durham Goode
e59cce69af histedit: convert pick action into a class
This converts the pick action into a histeditclass instance, as part of an
ongoing effort to refactor histedit for maintainability and robustness.

The test output changed because previously pick would only report the commit
disappearing if there were no merge conflicts. Now that we've unified the normal
and the --continue flows, they act the same and we get the warning even after
--continue.
2015-04-04 11:39:08 -07:00
Durham Goode
8cf27316ea histedit: allow histedit --continue when not on a descendant (BC)
Previously we would not allow --continue if the current working copy parent was
not a descendant of the commit produced by the previous histedit step. There's
nothing really blocking us from continuing the histedit in this situation, so
let's stop aborting in this case.

This is technically a BC change, but it is making things more forgiving so I
think it's ok.

In the future we will likely add an 'exec' action to histedit, which means the
user can do whatever they want during the middle of a histedit (like perhaps
calling 'hg update'), which means we'll need to support this case eventually
anyway.
2015-04-04 01:00:05 -07:00
Gregory Szorc
7af3081f5e tags: explicitly log which tags cache file is being written
We now have multiple tags cache files. Record exactly which file is
being written. This should help aid debugging into performance issues
with any single filter.
2015-04-16 11:59:36 -04:00
Gregory Szorc
7d23ec157b tags: write a separate tags cache file for unfiltered repos
Since we changed the format of the tags cache, we should bump the
filename. Before this patch, "tags" was being used for unfiltered
repositories. Change the naming scheme to be consistent and ensure
that a new cache file is used.

While I was here, I updated the docs to describe the existence of
multiple caches. I also added explicit test coverage for the creation of
the unfiltered tags cache.
2015-04-16 11:54:13 -04:00
Gregory Szorc
0f9537f76f tags: change format of tags cache files
.hgtags fnodes are now written to a shared cache file. They don't need
to exist in the per-filter tags cache files. Stop writing them.

The format of the tags cache file has changed in a backwards
incompatible way. This should be acceptable, as we just established
per-filter tags cache files and no client should have per-filter tags
cache files that will need to be read. So no backwards compatbility
concern is present.

The new format has a single header line followed by resolved tags
entries.

The header line is similar to the old first line with a major
difference: we now compute and store a hash of the filtered revisions.
Before, if the set of filtered revs changed, we may return incorrect
results. We now detect that.

A test for verifying filtered rev change is handled properly has been
added.
2015-04-16 12:01:00 -04:00
Gregory Szorc
277556bcdd tags: don't read .hgtags fnodes from tags cache files
Now that we have a standalone and shared cache for .hgtags fnodes, the
.hgtags fnodes stored in the tags cache files are redundant.

Upcoming patches will change the format of the tags cache files to
remove this data and to improve the validation. To prepare for this, we
change the tags reading code to ignore all but the tip .hgtags fnodes
entries in existing tags cache files.

All fnodes lookups now go through our new shared cache, which is why
test output changed. Format of tags cache files has not yet changed.
2015-04-16 10:12:44 -04:00
Tony Tung
67e28539d1 rebase: restore bookmark state on abort
The bookmark state was already being preserved, but it wasn't being
properly restored.
2015-04-13 14:54:02 -04:00
Durham Goode
2d8e97020e histedit: store backup file before histedit
It's possible for the user to delete some of the commits they started with
during a histedit, and aborting the histedit doesn't bring them back. Let's
store a backup bundle so we can always recover the stack of commits from before
they began.
2015-04-04 02:37:43 -07:00
Pierre-Yves David
3e542e8c99 devel-warn: add a prefix to all messages ("devel-warn: ")
We want to make the origin and importance of the message clear to developers.
2015-04-15 01:18:09 -04:00
Pierre-Yves David
c99cb9e546 push: acquire local 'wlock' if "pushback" is expected (BC) (issue4596)
If the client allows "pushback", the bundle2 served back by the server may
contains parts that will write to the repository. Such parts may require the
'wlock' (eg: bookmark) so we acquire it in advance to make sure it got acquired
before the 'lock'.
2015-04-15 10:36:21 -04:00
Pierre-Yves David
b13ab55f2f unbundle: acquire 'wlock' when processing bundle2 (BC) (issue4596)
A bundle2 may contain bookmark updates (or other extension content) that
requires the 'wlock' to be written. As 'wlock' must be acquired before 'lock',
we must stay on the side of caution and use both in all case to ensure their
ordering.
2015-04-15 01:16:40 -04:00
Pierre-Yves David
93e144e4f3 run-test: enable the devel warning during tests
This should help us to catch new locking order issues as soon as possible.

There are two harmless test updates (from the config change). Moreover, some
bundle2 tests are displaying warning for a legitimate reason. The use of pushkey
during the unbundle process may requires the 'wlock' after 'lock' (around the
whole unbundle process was taken). This is non-trivial to fix, so I better have
the check on, with the warning in the test than the check off. See issue4596 for
details.
2015-04-12 09:46:03 -04:00
Pierre-Yves David
22d9658ad9 wlock: do not warn for non-wait locking
We are warning about lock acquired in the wrong order because this can create
dead-lock situation. But non-wait acquisition will not block and therefore not
create a dead-lock. So we do not need to wait in such case.
2015-04-12 15:37:59 -04:00
Pierre-Yves David
23f376ba5d develwarn: include call site in the simple message version
Just displaying the warning makes it quite hard to recognise the guilty code
quickly and using --traceback for all calls is not very convenient. So we
include the call site with all simple message to help developer to recognise
errors sources.
2015-04-12 14:27:42 -04:00
Pierre-Yves David
ac5bf7b3e8 develwarn: handle the end of line inside the function itself
The traceback version should not have a end of line at all. The non-traceback
version will requires the same things soon.
2015-04-12 14:26:11 -04:00
Pierre-Yves David
16be4bee6c wlock: reword the devel warning
We change the wording of the developer warning:

  -  "lock" taken before "wlock"
  +  "wlock" acquired after "lock"

The goals here are to:

- Put the "subject" as the first word,
- use "acquired" instead of "taken" since it seems more accurate.
2015-04-12 13:28:35 -04:00
Pierre-Yves David
ffd22c7a3b wlock: only issue devel warning when actually acquiring the lock
Before this change, any call to 'wlock' after we acquired a 'lock' was issuing a
warning. This is wrong as the 'wlock' have been properly acquired before the
'lock' in a previous call.

We move the warning code to only issue such warnings when we are acquiring the
'wlock' -after- acquiring 'lock'. This is the expected behavior of this warning
from the start.
2015-04-12 10:01:48 -04:00
Pierre-Yves David
ca91862874 run-tests: also follow symlink when update PATH with 'run-tests.py' dir
I'm using 'run-tests.py' from my '$PATH' and use a symlink to get 'run-tests.py'
to in that '$PATH'. There is a handful of test helpers (like f) that needs to be
in the '$PATH' for the test to run, and they are expected to live next to the
'run-tests.py' binary. Using a symlink confuses this logic, so we add to the
'$PATH' both the 'run-tests.py' executable directory, and the actual file
location direction.
2015-04-11 14:44:12 -04:00
Pierre-Yves David
502fe91f02 transaction: introduce a transaction ID, to be available to all hooks
The transaction ID is built from the object ID and creation time stamp to make
sure it is unique.
2015-04-15 11:11:54 -04:00
Pierre-Yves David
bba1369f79 transaction: actually use tr.hookargs in pretxnclose
The 'tr.hookargs' is a dictionary containing all the arguments to be passed to
hooks. It is actually used for hooks now...
2015-04-14 13:07:41 -04:00
Pierre-Yves David
d9bafadc4d bundle2: use unbundle source as transaction name
This is what a bundle 1 push is doing. This got caught by trying to run the
whole test-suite using bundle2 for exchanges.
2015-04-11 13:58:36 -04:00
Pierre-Yves David
99746dff73 tags: have a different cache file per filter level
Currently whichever filter level asks for tags last will write the data on disk.
This create massive issues when tags are read for "visible" and "unfiltered"
on large and multi headed repository (like Mozilla central). See issue4550 for
details

Each filter level recomputes its own cache without direct collaboration but they
all share the same 'hgtagsfnodes' cache. And that is where most of the time is
spent.
2015-04-15 18:34:34 -04:00
Gregory Szorc
d866fa83a1 tags: extract .hgtags filenodes cache to a standalone file
Resolution of .hgtags filenodes values has historically been a
performance pain point for large repositories, where reading individual
manifests can take over 100ms. Multiplied by hundreds or even thousands
of heads and resolving .hgtags filenodes becomes a performance issue.

This patch establishes a standalone cache file holding the .hgtags
filenodes for each changeset. After this patch, the .hgtags filenode
for any particular changeset should only have to be computed once
during the lifetime of the repository.

The introduced hgtagsfnodes1 cache file is modeled after the rev branch
cache: the cache is effectively an array of entries consisting of a
changeset fragment and the filenode for a revision. The file grows in
proportion to the length of the repository (24 bytes per changeset) and
is truncated when the repository is stripped. The file is not written
unless tag info is requested and tags have changed since last time.

This patch partially addresses issue4550. Future patches will split the
"tags" cache file into per-filter files and will refactor the cache
format to not capture the .hgtags fnodes, as these are now stored in
the hgtagsfnodes1 cache. This patch is capable of standing alone. We
should not have to wait on the tags cache filter split and format
refactor for this patch to land.
2015-04-15 17:42:38 -04:00
Pierre-Yves David
c24d1f37c9 obsolete: experimental flag to get debug about obsmarkers exchange
The obsolescence markers exchange is still experimental. We (developer) need
more information about what is going on. I'm adding an experimental flag to add
display the amount of data exchanged during bundle2 exchanges.
2015-04-14 11:44:04 -04:00
Mads Kiilerich
f11e1d55b9 branchcache: stay silent if failing to read cache files
The warning has in some cases incorrectly attributed unrelated problems to rbc.

Instead, just do like the branch head cache does and stay quiet when reading
fails. The cache will be missing the first time a repo is used. It is a normal
situation and there is no reason to make a note of that.
2015-01-14 01:15:26 +01:00
Mads Kiilerich
17c4f7c523 merge: better debug messages before/after invoking external merge tool 2015-03-19 22:22:50 +01:00
Gregory Szorc
7498d10d47 revset: don't import discovery at module level
discovery.py imports a lot of the world. Pierre-Yves told me to move it
to a function-level import to avoid an import cycle in a future patch.
2015-04-14 12:54:16 -04:00
Yuya Nishihara
15789cf528 cat: disable optimization of single file case for workingctx
It crashes because workingctx has no manifest.
2015-04-05 13:16:46 +09:00
Gregory Szorc
205d244aa3 json: implement {fileannotate} template 2015-04-10 22:37:40 -04:00
Gregory Szorc
173c4bfaea json: implement {comparison} template
Similar to {filediff}, we abbreviate some property names to cut down on
string bloat.
2015-04-10 22:26:53 -04:00
Gregory Szorc
2f0000c95a json: implement {filediff} template
Single letter properties are used to keep payload size down, as diff
representation can be quite large and longer property names can create a
lot of extra work for parsers.

Rename is not yet captured. This can be done in a follow-up.
2015-04-10 22:39:22 -04:00
Matt Mackall
bfad591c42 strip: properly clear resolve state with --keep (issue4593)
Normal updates automatically clean up the resolve state, but strip
--keep does a "manual" update that bypasses the normal machinery. This
adds a mergestate reset.
2015-04-13 07:42:25 -05:00
Ryan McElroy
0bcb80448a revsets: more informative syntax error message
I came across a case where an internal command was using a revset that I didn't
immediately pass in and it was difficult to debug what was going wrong with the
revset. This prints out the revset and informs the user that the error is with
a rebset so it should be more obvious what and where the error is.
2015-04-13 20:53:05 -07:00
Ryan McElroy
7500433d6e revsets: show current revset abort behavior 2015-04-13 21:06:21 -07:00
Gregory Szorc
cbc3d51109 tests: move blackbox testing of tags to test-tags.t
We're going to refactor tags cache shortly. It is easier to test the
blackbox logging if these tests are in test-tags.t.
2015-04-13 13:28:37 -04:00
Gregory Szorc
bc524f4cd2 tests: move mock blackbox extension into own file
Having all blackbox log testing in test-blackbox.t isn't scalable. Move
the mock blackbox extension into its own file so we can start to move
blackbox logging into other tests.
2015-04-13 09:36:33 -04:00
Pierre-Yves David
9ec3313e25 revert: do not requires '--all' if '--interative' is present
The '--all' option have been introduced in 0a81b7721d8f (August 2006), most
probably to prevent user shooting themselves in the foot. As the record process
will let you, view and select the set of files and change you want to revert, I
feel like the '--all' flag is superfluous in the '--interactive' case.
2015-04-11 12:26:54 -04:00
Pierre-Yves David
393230ee25 bundle2: advertise bundle2 by default
That way, any new server will be ready to accept bundle2 payload. The decision
for the client to use it is still off by default so this is not turning bundle2
everywhere.

We introduce a new kill switch for this in case stuff goes wrong.
2015-04-10 15:41:33 -04:00
Pierre-Yves David
af7d20b000 bundle2: rename format, parts and config to final names
It is finally time to freeze the bundle2 format! To do so we:
- rename HG2Y to HG20,
- drop "b2x:" prefix from all part names,
- rename capability to "bundle2-exp" to "bundle2"
- rename the hook flag from 'bundle2-exp' to 'bundle2'
2015-04-09 16:25:48 -04:00
Yuya Nishihara
7de01412a9 archive: look for first visible revision to build repo identity (issue4591)
No test for the case where all revisions are hidden because "archive" command
aborts if the target revision is null.
2015-04-08 23:30:02 +09:00
Yuya Nishihara
1209d3b6f0 largefiles: use common function to build content of .hg_archival.txt
This fixes the missing "changessincelatesttag" field introduced by
7203a55cb648.
2015-04-08 22:42:37 +09:00
Yuya Nishihara
58c060fcfc test-largefiles: verify content of .hg_archival.txt 2015-04-08 22:38:46 +09:00
Mathias De Maré
8b3f5b98e3 commands: add ui.statuscopies config knob
statuscopies enables viewing of copies and moves in 'hg status' by default.
2015-03-24 21:25:57 +01:00
FUJIWARA Katsunori
15fa88d61c bookmarks: show detailed status about outgoing bookmarks
Before this patch, "hg outgoing -B" shows only difference of bookmarks
between two repositories, and it isn't user friendly.

This patch shows detailed status about outgoing bookmarks at "hg
outgoing -B".

To avoid breaking backward compatibility with other tool chains, this
patch shows status, only if --verbose is specified,
2015-04-08 02:56:19 +09:00
FUJIWARA Katsunori
f7b7fe9dcb bookmarks: show detailed status about incoming bookmarks
Before this patch, "hg incoming -B" shows only difference of bookmarks
between two repositories, and it isn't user friendly.

This patch shows detailed status about incoming bookmarks at "hg
incoming -B".

To avoid breaking backward compatibility with other tool chains, this
patch shows status, only if --verbose is specified,
2015-04-08 02:56:19 +09:00
FUJIWARA Katsunori
a3fd38b1fc bookmarks: enhance test of showing detail about incoming/outgoing bookmarks 2015-04-08 02:56:19 +09:00
FUJIWARA Katsunori
71b8a887f2 bookmarks: show outgoing bookmarks more exactly
Before this patch, "hg outgoing -B" shows only bookmarks added
locally. Then, users can't know about bookmarks below before "hg push"
execution.

  - deleted locally (even though it may be added remotely from "hg pull" view)
  - advanced locally
  - diverged
  - changed (= remote revision is unknown for local)

This patch shows such bookmarks, too.
2015-04-08 02:56:19 +09:00
FUJIWARA Katsunori
c1a49db724 bookmarks: show incoming bookmarks more exactly
Before this patch, "hg incoming -B" shows only bookmarks added
remotely. Then, users can't know about bookmarks below before "hg
pull" execution.

  - advanced remotely
  - diverged
  - changed (remote revision is unknown for local)

This patch shows such bookmarks, too.
2015-04-08 02:56:19 +09:00
Drew Gottlieb
503f226d39 test-manifest: add some test coverage for treemanifest
Similar to the testmanifest test case, testtreemanifest extends the base test
case but uses treemanifests instead of manifestdicts. Adding this test provides
some basic test coverage of treemanifest within the standard test suite.
2015-04-07 15:16:19 -07:00
Drew Gottlieb
923e5328ab test-manifest: make manifesttest a base class that is extended
The implementation of the testmanifest test case is moved to a new base class,
which is then extended to make the testmanifest. And instead of testmanifest,
the subclass is named testmanifestdict because, well, that's what it's testing.

This refactoring makes it possible to create alternate versions of what was
formerly testmanifest, improving test coverage of different manifestdict
implementations.
2015-04-07 15:16:19 -07:00
Drew Gottlieb
575a958d63 test-manifest: move parsemanifest() to be a testmanifest class method
This refactoring lets testmanifest subclasses override this method to
return different manifestdict implementations, such as treemanifest.

It is useful for later commits where the testmanifest class is moved into a
base class, and test cases that extend the base class can provide their own
parsemanifest() implementation.
2015-04-07 15:16:19 -07:00
Matt Harbison
a941ba77e5 subrepo: precisely identify the missing subrepo spec file
It isn't obvious which file is the problem with deep subrepos, so provide the
path.  Since the parsing is done with a ctx and not a subrepo object, it isn't
possible to display a path from the root subrepo.  Therefore, the path shown is
relative to cwd.

There's no test coverage for the first abort, and I couldn't figure out how to
trigger it, but it is changed for consistency.
2015-04-05 15:08:55 -04:00
Durham Goode
1080800192 graft: record intermediate grafts in extras
Previously the extra field for a graft only contained the original commit hash.
This made it impossible to use graft to copy a commit more than once, because
the extras fields did not change after the second graft.

The fix is to add an extra.intermediate-source field that records the immediate
predecessor to graft. This changes hashes for commits that have been grafted
twice, which is why the test was affected.
2015-04-05 12:12:02 -07:00
Durham Goode
9d87aed6e4 graft: allow creating sibling grafts
Previously it was impossible to graft a commit onto it's own parent (i.e. create
a copy of the commit). This is useful when wanting to create a backup of the
commit before continuing to amend it. This patch enables that behavior.

The change to the histedit test is because histedit uses graft to apply commits.
The test in question moves a commit backwards onto an ancestor. Since the graft
logic now more explicitly supports this, it knows to simply accept the incoming
changes (since they are more recent), instead of prompting.
2015-04-05 11:55:38 -07:00
Pierre-Yves David
9dd801717e unbundle20: retrieve unbundler instances through a factory function
To support multiple bundle2 formats, we will need a function returning
the proper unbundler according to the header. We introduce such aa
function and change the usage in the code base. The function will get
smarter in later changesets.

This is somewhat similar to the dispatching we do for 'HG10' and 'HG11'.

The main target is to allow HG2Y support in an extension to ease transition of
companies using the experimental protocol in production (yeah...) But I've no
doubt this will be useful when playing with a future HG21.
2015-04-06 16:04:33 -07:00
Yuya Nishihara
e9b10cef87 templates-default: do not show description or summary if empty
changeset_printer shows description only if ctx.description().strip() is not
empty. The default template should do the same way.
2015-03-27 22:12:53 +09:00
Matt Mackall
c72258bf67 merge with stable 2015-04-06 17:16:55 -05:00
Martin von Zweigbergk
87d497396a dirstate.walk: don't report same file stat multiple times
dirstate.walk() generates pairs of filename and a stat-like
object. After "hg mv foo Foo", it generates one pair for "foo" and one
for "Foo", as it should. However, on case-insensitive file systems,
when it tries to stat to get the disk state as well, it gets the same
stat result for both names. This confuses at least
scmutil._interestingfiles(), making it think that "foo" was forgotten
rather than removed. That, in turn, makes "hg addremove" add "foo"
back, resulting in both cases in the dirstate, as reported in
issue4590.

This change only takes care of the "if unknown" branch. A similar fix
should perhaps be applied to the other branch.
2015-04-04 21:54:12 -07:00
Matt Harbison
673b9701b1 largefiles: use the share source as the primary local store (issue4471)
The benefit of retargeting the local store to the share source is that all
shares will always have access to the largefiles any one of them commit, even if
the user cache is deleted (which is documented to be OK to do).  Further, any
push into the source (and now any shares), will likewise make the largefile(s)
visible to all related repositories.

In order to maintain compatibility with existing repos, where the largefiles
would be cached only in the local share, fallback to searching the local share
if it isn't found at the share source.

The unshare command should probably be taught to copy the source store into the
store for the repo being unshared to complete the loop.


This patch changes the test like this:

  @@ -159,6 +159,5 @@
     $ hg share -q src share_dst --config extensions.share=
     $ hg -R share_dst update -r0
     getting changed largefiles
  -  large: largefile $HASH not available from file:///$TESTTMP\share_dst
  -  0 largefiles updated, 0 removed
  +  1 largefiles updated, 0 removed
     1 files updated, 0 files merged, 0 files removed, 0 files unresolved


The issue writeup mentions pushing a largefile from a remote repo to the main
local repo, and the largefile is then not available in any shares.  Since the
push doesn't cache the largefile in $USERCACHE, the trashed $USERCACHE in this
test is equivalent.
2015-04-04 19:06:43 -04:00
Durham Goode
04eb9da604 histedit: fix preventing strips during histedit
We were trying to prevent strips of important nodes during histedit,
but the check was actually comparing the short hashes in the rules to
the exact value the user typed in, so it only ever worked if the user
typed a 12 character hash.
2015-04-04 11:24:48 -07:00
Augie Fackler
a5924b3112 test-subrepo-recursion: fix output on non-hardlink systems
There's a slight bug present where a topic doesn't get closed when it should.
This isn't a regression, so I've made a note in the test file.
2015-04-03 18:19:24 -04:00
Augie Fackler
4330579238 test-subrepo-recursion: set progress.changedelay really high
This avoids subtopics from showing up, which were introduced by my recent
change that added progress bars to hardlink clones in some cases.
2015-04-03 23:12:21 -04:00
Augie Fackler
fffbd3731c test-clone: fix test expectations on systems without hardlinks 2015-04-03 18:10:12 -04:00
Matt Harbison
cdcba76207 forget: cleanup the output for an inexact case match on icasefs
Previously, specifying a file name but not matching the dirstate case yielded
the following, even though the file was actually removed:

  $ hg forget capsdir1/capsdir/abc.txt
  not removing capsdir\a.txt: file is already untracked
  removing CapsDir\A.txt
  [1]

This change doesn't appear to cause any extra filesystem accesses, even if a
nonexistant file is specified.

If a directory is specified without a case match, it is (and was previously)
still silently ignored.
2015-03-31 17:42:46 -04:00
Matt Harbison
a3480284f9 dirstate: don't require exact case when adding dirs on icasefs (issue4578)
We don't require it when adding files on a case insensitive filesystem, so don't
require it to add directories for consistency.

The problem with the previous code was that _walkexplicit() was only returning
the normalized directory.  The file(s) in the directory are then appended, and
passed to the matcher.  But if the user asks for 'capsdir1/capsdir', the matcher
will not accept 'CapsDir1/CapsDir/AbC.txt', and the name is dropped.  Matching
based on the non-normalized name is required.

If not normalizing, skip the extra string building for efficiency.  '.' is
replaced with '' so that the path being tested when no file is specified, isn't
prefixed with './' (and therefore fail the match).
2015-03-31 11:11:39 -04:00
Yuya Nishihara
4a691471f2 templates: fix "log -q" output of phases style
It had the same problem as be4dab229c78, name conflicts of {node} keyword.
2015-03-28 20:22:03 +09:00
Yuya Nishihara
990aa241a1 templates: fix "log -q" output of default style
It was changed at ad92c202bbcd unintentionally due to name conflicts.
2015-03-14 22:34:27 +09:00
Yuya Nishihara
91233c9b15 jsonchangeset: set manifest node to "null" for workingctx
Unlike changeset_printer, it does not hide the manifest field because JSON
output will be parsed by machine where explicit "null" will be more useful
than nothing.
2015-03-14 20:16:35 +09:00
Yuya Nishihara
8a805d1c6d jsonchangeset: set rev and node to "null" for workingctx 2015-03-14 20:15:40 +09:00
Yuya Nishihara
7445ebd638 hgweb: prevent loading style map from directories other than specified paths
A style name should not contain "/", "\", "." and "..". Otherwise, templates
could be loaded from outside of the specified templates directory by invalid
?style= parameter. hgweb should not allow such requests.

This change means subdir/name is also rejected.
2015-03-13 21:18:59 +09:00
Gregory Szorc
6ce5b94bd9 json: implement {help} template
We should consider add HTML rendering of the RST into the response as a
follow-up. I attempted to do this, but there was an empty array
returned by the rstdoc() template function. Not sure what's going on.
Will deal with it later.
2015-04-01 22:24:03 -07:00
Gregory Szorc
26f4be7d62 json: implement {helptopics} template 2015-04-01 22:16:05 -07:00
Gregory Szorc
47b0fd3ed6 json: implement {manifest} template
Property naming was borrowed from `hg files -Tjson`.

We omit branch because, again, representation of branches in this
template is wonky.
2015-04-01 22:04:03 -07:00
Gregory Szorc
351f923f65 json: implement {shortlog} and {changelog} templates
These are the same dispatch function under the hood. The only difference
is the default number of entries to render and the template to use. So
it makes sense to use a shared template.

Format for {changelistentry} is similar to {changeset}. However, there
are differences to argument names and their values preventing us from
(easily) using the same template. (Perhaps there is room to consolidate
the templates as a follow-up.)

We're currently not recording some data in {changelistentry} that exists
in {changeset}. This includes the branch name. This should be added in
a follow-up. For now, something is better than nothing.
2015-03-31 22:53:48 -07:00
Yuya Nishihara
fcd69a9d8b changeset_printer: hide manifest node for workingctx
Because workingctx has no manifest, it makes sense to hide "manifest:" row
completely.
2015-03-14 17:33:22 +09:00
Yuya Nishihara
f52009fe3b changeset_printer: display p1rev:p1node with "+" suffix for workingctx
Still templater can't handle workingctx, which will be fixed later.
2015-03-14 20:01:30 +09:00
Mathias De Maré
80df46375b tests: handle deleted .hg directory (git 2.2.0 and higher) (issue4585)
In git 2.2.0 and higher, removing files and directories is changed:
removing an object that does not exist returns success rather than failure.
As a result, even though .hg/hgrc does not exist, success is returned
and the .hg/ directory is removed.

To handle this correctly, use 'rm -rf' to allow successful removing
for all git versions.

The exact changeset where this was introduced in git:
1054af7d04aef64378d69a0496b45cdbf6a0bef2
wrapper.c: remove/unlink_or_warn: simplify, treat ENOENT as success
2015-04-02 08:18:33 +02:00
Martin von Zweigbergk
ebd2a39ab3 manifestv2: add support for writing new manifest format
If .hg/requires has 'manifestv2', the manifest will be written using
the new format.
2015-03-31 14:01:33 -07:00
Martin von Zweigbergk
c5433d6da0 manifestv2: add support for reading new manifest format
The new manifest format is designed to be smaller, in particular to
produce smaller deltas. It stores hashes in binary and puts the hash
on a new line (for smaller deltas). It also uses stem compression to
save space for long paths. The format has room for metadata, but
that's there only for future-proofing. The parser thus accepts any
metadata and throws it away. For more information, see
http://mercurial.selenic.com/wiki/ManifestV2Plan.

The current manifest format doesn't allow an empty filename, so we use
an empty filename on the first line to tell a manifest of the new
format from the old. Since we still never write manifests in the new
format, the added code is unused, but it is tested by
test-manifest.py.
2015-03-27 22:26:41 -07:00
Martin von Zweigbergk
e931247479 manifestv2: set requires at repo creation time
While it should be safe to switch to the new manifest format on an
existing repo, let's keep it simple for now and make the configuration
have any effect only at repo creation time. If the configuration is
enabled then (at repo creation), we add an entry to requires and read
that instead of the configuration from then on.
2015-03-31 22:45:45 -07:00
Martin von Zweigbergk
e12d2d5528 test-manifest: extract constants for binary hashes
The binary hashes are used quite frequently, so let's extract
constants for them so we don't have to repeat binascii.unhexlify() so
often.
2015-03-31 15:06:55 -07:00
Martin von Zweigbergk
578f7b252d test-manifest: create constant for empty manifest
For symmetry with manifest v2, once we add that, let's extract a
constant for the empty v1 manifest.
2015-03-31 14:46:05 -07:00
Yuya Nishihara
97a7438eb1 templatefilters: add "upper" and "lower" for case conversion
Typically it will be used in patchbomb's flag template, which will be
implemented by future patches.
2015-03-30 23:54:29 +09:00
Gregory Szorc
35a9613552 hgweb: add phase to {changeset} template
It's pretty surprising phase wasn't part of this template call already.
We now expose {phase} to the {changeset} template and we expose this
data to JSON.

This brings JSON output in line with the output from `hg log -Tjson`.
The lone exception is hweb doesn't print the numeric rev. As has been
stated previously, I don't believe hgweb should be exposing these
unstable identifiers. (We can add them later if we really want them.)
There is still work to bring hgweb in parity with --verbose and
--debug output from the CLI.
2015-03-31 22:29:12 -07:00
Gregory Szorc
3b964c6e89 json: implement {changeset} template
Output only contains basic changeset information for the moment. The
format is compatible with `hg log -Tjson`.
2015-03-31 22:35:12 -07:00
Gregory Szorc
661199cf08 test-hgweb-json: fix URL for file revision tests
Likely a copy and paste fail.
2015-03-31 21:49:10 -07:00
Matt Mackall
e494662102 tests: fix py2.4 glob for devel warnings 2015-03-31 18:09:21 -05:00
Matt Mackall
b4e070d32e merge with stable 2015-03-31 17:49:46 -05:00
Drew Gottlieb
f6dc5a186e manifest: add some tests for manifest.matches()
There were no tests for the various code paths in manifestdict.matches(), so I
added some. This also adds a more complex testing manifest so that any bugs
relating to traversal of directories are more likely to be caught.
2015-03-30 11:58:39 -07:00
Gregory Szorc
41b7117a38 json: implement {branches} template 2015-03-30 21:37:24 -07:00
Gregory Szorc
ea1d486b32 json: implement {bookmarks} template 2015-03-31 14:54:56 -07:00
Gregory Szorc
46d1c69185 json: implement {tags} template
Tags is pretty easy to implement. Let's start there.

The output is slightly different from `hg tags -Tjson`. For reference,
the CLI has the following output:

  [
   {
    "node": "e2049974f9a23176c2addb61d8f5b86e0d620490",
    "rev": 29880,
    "tag": "tip",
    "type": ""
   },
   ...
  ]

Our output has the format:

  {
    "node": "0aeb19ea57a6d223bacddda3871cb78f24b06510",
    "tags": [
      {
        "node": "e2049974f9a23176c2addb61d8f5b86e0d620490",
        "tag": "tag1",
        "date": [1427775457.0, 25200]
      },
      ...
    ]
  }

"rev" is omitted because it isn't a reliable identifier. We shouldn't
be exposing them in web APIs and giving the impression it remotely
resembles a stable identifier. Perhaps we could one day hide this behind
a config option (it might be useful to expose when running servers
locally).

The "type" of the tag isn't defined because this information isn't yet
exposed to the hgweb templater (it could be in a follow-up) and because
it is questionable whether different types should be exposed at all.
(Should the web interface really be exposing "local" tags?)

We use an object for the outer type instead of Array for a few reasons.
First, it is extensible. If we ever need to throw more global properties
into the output, we can do that without breaking backwards compatibility
(property additions should be backwards compatible). Second, uniformity
in web APIs is nice. Having everything return objects seems much saner than
a mix of array and object. Third, there are security issues with arrays
in older browsers. The JSON web services world almost never uses arrays
as the main type for this reason.

Another possibly controversial part about this patch is how dates are
defined. While JSON has a Date type, it is based on the JavaScript Date
type, which is widely considered a pile of garbage. It is a non-starter
for this reason.

Many of Mercurial's built-in date filters drop seconds resolution. So
that's a non-starter as well, since we want the API to be lossless where
possible. rfc3339date, rfc822date, isodatesec, and date are all lossless.
However, they each require the client to perform string parsing on top of
JSON decoding. While date parsing libraries are pretty ubiquitous, some
languages don't have them out of the box. However, pretty much every
programming language can deal with UNIX timestamps (which are just
integers or floats). So, we choose to use Mercurial's internal date
representation, which in JSON is modeled as float seconds since UNIX
epoch and an integer timezone offset from UTC (keep in mind
JavaScript/JSON models all "Numbers" as double prevision floating point
numbers, so there isn't a difference between ints and floats in JSON).
2015-03-31 14:52:21 -07:00
Gregory Szorc
a5cff59341 templates: add a stub template for json
Many have long wanted hgweb to emit a common machine readable output.

We start the process by defining a stub json template.

Right now, each endpoint returns a stub "not yet implemented" string.
Individual templates will be implemented in subsequent patches.

Basic tests for templates have been included. Coverage isn't perfect,
but it is better than nothing.
2015-03-30 20:15:03 -07:00
Gregory Szorc
3a983954a1 get-with-headers: support parsing and pretty printing JSON
Upcoming patches will add support for JSON output from hgweb.

Because JSON output from the templater is hard to read and because it
is easy to introduce malformed JSON, we introduce a JSON processing
mode to get-with-headers.py that will parse and pretty print JSON
from HTTP responses. This will make tests easier to read and write
and it will ensure hgweb is emitting well-formed JSON.
2015-03-30 20:56:54 -07:00
Matt Mackall
91b7caa71a merge with stable 2015-03-31 16:14:14 -05:00
Matt Mackall
c2e689e49d merge with stable 2015-03-31 08:31:42 -05:00
Matt Mackall
1dee8dda3b tags: remove scary message about corrupt tags cache
Caches should be transparent. If a cache is damaged, it should
silently be rebuilt, much like if it were invalid. No one seems to
have ever hit this in the wild.
2015-03-31 08:04:42 -05:00
Laurent Charignon
9430b8ddec phases: add killswitch for native implementation 2015-03-30 12:57:55 -07:00
Gregory Szorc
54ee501852 run-tests: obtain replacements inside Test._runcommand
Now that command running is part of Test, we no longer need to pass
a list of replacements down through various call layers.

The impetus for this change is to fetch replacements after
command execution, not before. This will allow replacements to be
defined as part of test execution.
2015-03-28 14:55:28 -07:00
Gregory Szorc
959709b719 run-tests: separate newline normalization from replacements
Upcoming patches will change how the replacements system works
to make it more flexible. To prepare for this, eliminate the one-off
use of replacements to perform newline normalization on Windows.
2015-03-28 14:28:22 -07:00
Gregory Szorc
779896c562 run-tests: remove arguments from Test._runcommand
Now that runcommand is part of the Test class, arguments that were
previously coming from Test attributes can now be switched to
lookups inline.
2015-03-28 14:12:57 -07:00
Gregory Szorc
681a5f7b0d run-tests: move run into Test class
Future patches will change how replacements work. Since the logic in
run() is strongly tied to the operation of individual tests and since
there is potential to make the implementation simpler by giving the
function access to Test attributes, move it into Test.
2015-03-28 14:08:25 -07:00
Gregory Szorc
918575b5f2 run-tests: wait for test threads after first error
The test runner has the ability to stop on first error.

Tests are executed in new Python threads. The test runner starts new
threads when it has capacity to do so. Before this patch, the "stop on
first error" logic would return immediately from the "run tests"
function, without waiting on test threads to complete. There was thus
a race between the test runner thread doing cleanup work and the test
thread performing activity. For example, the test thread could be in
the middle of executing a test shell script and the test runner
could remove the test's temporary directory. Depending on timing, this
could result in any number of output from the test runner.

This patch eliminates the race condition by having the test runner
explicitly wait for test threads to complete before continuing.

I discovered this issue as I modified the test harness in a subsequent
patch and was reliably able to tickle the race condition.
2015-03-28 19:39:03 -07:00
Gregory Szorc
325c00cc79 run-tests: report code coverage from source directory
As part of testing code coverage output, I noticed some files were
being reported twice: there was an entry for the file in the install
location and for the file in the source tree. I'm not sure why this
is. But it resulted in under-reporting of coverage data since some
lines weren't getting covered in both locations.

I also noticed that files in the source directory and outside the
"mercurial" and "hgext" packages were getting included in the
coverage report. Cosmetically, this seemed odd to me. It's not
difficult to filter paths from the report. But I figure this data
can be useful (we could start reporting run-tests.py coverage,
for example).

This patch switches the coverage API to report code coverage from
the source directory. It registers a path alias so that data from
the install location is merged into data from the source directory.
We now get merged results for files that were being reported in
multiple locations.

Since code coverage reporting now relies on the profiled install
now being in sync with the source tree, an additional check to
disallow code coverage when --with-hg is specified has been added.
This should have been present before, as --local was previously
disallowed for the same reasons.

Merging the paths raises our aggregate line coverage from ~60 to
81%.
2015-03-28 00:21:30 -07:00
Gregory Szorc
34e11242ee run-tests: collect aggregate code coverage
Before this patch, every Python process during a code coverage run was
writing coverage data to the same file. I'm not sure if the coverage
package even tries to obtain a lock on the file. But what I do know is
there was some last write wins leading to loss of code coverage data, at
least with -j > 1.

This patch changes the code coverage mechanism to be multiple process
safe. The mechanism for initializing code coverage via sitecustomize.py
has been tweaked so each Python process will produce a separate coverage
data file on disk. Unless two processes generate the same random value,
there are no race conditions writing to the same file. At the end of the
test run, we combine all written files into an aggregate report.

On my machine, running the full test suite produces a little over
20,000 coverage files consuming ~350 MB. As you can imagine, it takes
several seconds to load and merge these coverage files. But when it is
done, you have an accurate picture of the aggregate code coverage for the
entire test suite, which is ~60% line coverage.
2015-03-28 00:47:58 -07:00
Gregory Szorc
a8bfabf2e6 run-tests: obtain code coverage via Python API
Before, we were invoking the "coverage" program provided by the
"coverage" module. This patch changes the code to go through the
Python API. This makes the next patch a little bit easier to reason
about.

A side effect of this patch is that writing code coverage reports
will be slightly faster, as we won't have to redundantly load
coverage data.
2015-03-27 23:17:19 -07:00
Gregory Szorc
7ba88d1a50 commands.debugrevlog: report max chain length
This is sometimes useful to know. Report it.
2015-03-28 12:58:44 -07:00
Matt Harbison
2625472c94 test-git-export: add globs the test runner wants on Windows
The only difference for the first two was to add the globs, but the third line
of output on Windows was '..\dir2\copy'.  I'm not sure why 'copy' is output on
Windows instead of '*'.
2015-03-29 00:00:14 -04:00
Gregory Szorc
01447cbf3e run-tests: explicitly handle unicode when writing xunit file
The xunit writer was passing a str to a minidom API. An implicit
.decode('ascii') was performed somewhere, causing UnicodeDecodeError
if test output contained non-ascii sequences.

This patch converts test output to utf-8 before passing it to minidom.
We use the "replace" strategy to ensure invalid utf-8 sequences get
munged into �.
2015-03-29 10:41:23 -07:00
Matt Harbison
e0846fc2d8 test-annotate: conditionalize error output for Windows
It seems better to leave the actual output in place instead of globbing
everything but 'abort:', in case it starts aborting for other reasons.

It isn't clear the purpose for reversing the file name position, but that
originates in windows.posixfile.
2015-03-29 00:20:56 -04:00
Matt Harbison
46014de55c test-diffstat: add a glob the test runner wants on Windows
The test gets a '~' status without it.
2015-03-28 23:57:16 -04:00
Mathias De Maré
6a032dab5a tests: add testing for diff.showfunc
The diff.showfunc config knob did not have coverage before.
2015-03-24 21:36:38 +01:00
Drew Gottlieb
d2ab66f723 manifest: make manifest.intersectfiles() internal
manifest.intersectfiles() is just a utility used by manifest.matches(), and
a future commit removes intersectfiles for treemanifest for optimization
purposes.

This commit makes the intersectfiles methods on manifestdict and treemanifest
internal, and converts its test to a more generic testMatches(), which has the
exact same coverage.
2015-03-30 10:43:52 -07:00
Matt Mackall
407d8470d0 import-checker: fix rotatecycle
It was duplicating the last element sometimes.
2015-03-27 18:50:39 -05:00
Yuya Nishihara
6e575010bd children: don't pass filectx to displayer
displayer doesn't want a fctx but a ctx. It failed with -Tdefault template.

    Traceback (most recent call last):
      ...
      File "mercurial/templatekw.py", line 212, in showbookmarks
        bookmarks = args['ctx'].bookmarks()
    AttributeError: 'filectx' object has no attribute 'bookmarks'
2015-03-26 23:56:18 +09:00
Matt Mackall
61bcacd057 revert: move calculation of targetsubs earlier 2015-03-27 13:48:51 -05:00
Laurent Charignon
601ebc9422 shelve: add interactive mode
This allows us to shelve selectively part of the changes of the workdir
2015-03-25 15:53:30 -07:00
Laurent Charignon
ea953c7452 shelve: add interactive mode command line option 2015-03-25 15:52:28 -07:00
Laurent Charignon
ce53ca6b37 revert: fix --interactive on local modification (issue4576)
We were moving files during the backup phase and it was incompatible with the
way record/crecord is working
2015-03-25 14:01:14 -07:00
FUJIWARA Katsunori
3706cf02be update: replace workingctx.dirty and raising Abort by cmdutil.bailifchanged
This patch makes wrapping "commands.update()" by largefiles extension
useless, because "cmdutil.bailifchanged()" can detect changes of
largefiles in the working directory.

This patch also changes test-update-branches.t, because
"cmdutil.bailifchanged()" shows more detailed information about
dirty-ness of the working directory than "workingctx.dirty()".
2015-03-25 13:55:35 +09:00
FUJIWARA Katsunori
e269967115 subrepo: add bailifchanged to centralize raising Abort if subrepo is dirty
This patch also centralizes composing dirty reason message like
"uncommitted changes in subrepository 'xxxx'".
2015-03-25 13:55:35 +09:00
FUJIWARA Katsunori
d9071e6959 subrepo: add dirtyreason to centralize composing dirty reason message
This patch newly adds "dirtyreason()" to centralize composing dirty
reason message like "uncommitted changes in subrepository 'xxxx'".

There are 3 similar messages below, and this patch is a part of
preparations for unifying them into (1), too.

  1. uncommitted changes in subrepository 'XXXX'
  2. uncommitted changes in subrepository XXXX
  3. uncommitted changes in subrepo XXXX

This patch chooses adding new method "dirtyreason()" instead of making
"dirty()" return "reason string", because:

  - some of existing "dirty()" implementation is too complicated to do
    so simply, and

  - ill-mannered 3rd party subrepo classes, of which "dirty()" doesn't
    return "reason string", cause meaningless message (even though it
    is rare case)
2015-03-25 13:55:32 +09:00
Laurent Charignon
ac26bdeb92 record_curses: add test for newly added files
We have a UI bug where toggling a newly added file twice in the curses
interface didn't mark it as selected. This test checks that the underlying
logic is working as expected, the next patch of the series fixes the UI bug.
2015-03-25 16:40:37 -07:00
Martin von Zweigbergk
f6215c3b43 test-manifest.py: don't test .text() with present node suffix
When m.text() is called after setting a nodeid with a suffix (such as
'+'), manifestdict uses the suffix-less nodeid for the text, while
treemanifest includes the suffix. It would perhaps make most sense to
raise an exception so the bug is found, but since the two
implementations behave differently, let's just not test the behavior
for now.
2015-03-25 17:18:48 -07:00
Martin von Zweigbergk
0bb02e37be test-manifest.py: rewrite tests in terms of manifestdict
By rewriting test-manifest.py in terms of manifestdict instead of
_lazymanifest, the tests can be run on treemanifests too. There are
still a few tests that fail on treemanifests. They will be addressed
in the next few patches.
2015-03-25 14:13:46 -07:00
Martin von Zweigbergk
a8758e2b6a test-manifest.py: separate out test for double-free after copy()
The test that we don't double-free anything after creating a copy is
currently mixed with the __setitem__ test. Let's separate them.
2015-03-25 14:21:34 -07:00
Matt Harbison
1b58f58b45 revert: evaluate subrepos to revert against the working directory
Reverting to a revision where the subrepo didn't exist will now abort, and
matching subrepos against the working directory is consistent with how filesets
are evaluated since dd1c701aad4d.
2015-03-25 22:20:44 -04:00
Yuya Nishihara
499c2ed6e7 revset: optimize "x & fullreposet" case
If self is a smartset and other is a fullreposet, nothing should be necessary.

A small win for trivial query in mozilla-central repo:

revset #0: (0:100000)
0) wall 0.017211 comb 0.020000 user 0.020000 sys 0.000000 (best of 163)
1) wall 0.001324 comb 0.000000 user 0.000000 sys 0.000000 (best of 2160)
2015-03-16 17:11:25 +09:00
Yuya Nishihara
bc9e0dc64b debugrevspec: show nesting structure of smartsets if verbose
This shows how smartsets are constructed from the query. It will be somewhat
useful to track problems such as stack overflow.
2015-03-16 18:36:53 +09:00
Sean Farley
a0d78a3107 diff: rename --relative option to --root
The diff output format is unable to express files outside the directory so it
makes sense to name this option --root instead of --relative.
2015-03-25 11:55:15 -07:00
Pierre-Yves David
9d2643c9ed amend: check for directory renames for both merge parents (issue4516)
Before this change, amending a merge would lose the rename information for file
adding in the second parents and implicitly renamed into a new directory.

In case of the merge, we also look for directory rename data from the second
parent. This seems to fix the bug and does not show other issues from the test
suite.
2015-03-02 19:01:00 +00:00
Matt Harbison
721f888f2f transaction: really disable hardlink backups (issue4546) 2015-03-02 10:31:22 -05: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
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
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
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
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
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
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
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
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
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
Matt Harbison
12ec4872c6 subrepo: don't abort in add when non-hg subrepos are present (issue4513)
This change should have been part of a5602d49abba.
2015-01-27 20:57:43 -05:00
Matt Harbison
d92b702a94 largefiles: revert to lfilesrepo.status() being an unfiltered method
This effectively reverts 9fc565fa1621, which caused some normal file copies to
not be displayed as copies.  Other normal file copies could be displayed- the
exact reason isn't clear.  This also adds two tests that were failing prior to
this backout, so that this can be sorted out next cycle.

The difference between copy cases that worked and those that didn't seemed to be
in copies.pathcopies().  When largefiles isn't enabled for the changed test, or
lfstatus is not set in the commands.status() override, 'y.ancestor(x) == x'.
That wasn't true otherwise, which fell through to the _chain() method.  In this
case, the copy is removed in the criss cross loop.

'y.ancestor(x)' returns a context.changectx type, while 'x' is a lfilesctx type
in the failing case.  I tried adding the ancestor method to the lfilesctx class
to change the type of the ancestor context, however the context when printed as
a string then gains a '+'.  This points to it being a context.committablectx,
which clearly isn't correct for an ancestor.  Possibly the problem is the
lfilesctx needs to subclass context.committablectx in some cases, but
context.changectx in others, within the same invocation?  I'm not sure how to
pull that off, and backing out this change is safer during the freeze.

As to the status changing when a path is specified, I haven't looked into it
yet.
2015-01-25 22:55:10 -05:00
Matt Mackall
81a40bb2be test-tools: portability tweak 2015-01-25 20:13:54 -06:00
Yuya Nishihara
b5f973788a revset: fix ancestors(null) to include null revision (issue4512)
Since fe39bbbf31f0, null parent is explicitly excluded. So, there is no reason
to have nullrev in the initial seen set.
2015-01-25 20:20:27 +09:00
Yuya Nishihara
ed458b9332 log: use rev() to build revset of --follow option from numeric revision
startrev can be -1.
2015-01-10 13:14:00 +09:00
Yuya Nishihara
78d778b5ef revset: allow rev(-1) to indicate null revision (BC)
This can simplify the conversion from numeric revision to string. Without it,
we have to handle -1 specially because repo['-1'] != repo[-1].

The -1 revision is not officially documented, but this change makes sense
assuming that "rev(%d)" exists for scripting or third-party tools.
2015-01-10 12:56:38 +09:00