Commit Graph

65 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
3af8e0ba8c tests: make tests for convert with svn portable
svn 1.6.x (at least, 1.6.12 or 1.6.17) might display empty lines, even
though svn 1.9.x (at least, 1.9.3) doesn't.

To make tests for convert with svn portable, this patch adds "|(^$)"
regexp to egrep in filter_svn_output.

To avoid similar future issue, this patch adds "|(^$)" regexp to all
filter_svn_output (and adjusts test-subrepo-svn.t), even though only
test-convert-svn-source.t fails with svn 1.6.x, AFAIK.
2016-03-15 00:14:53 +09:00
Yuya Nishihara
ae50cd8035 tests: suppress verbose output of svn transaction
Subversion 1.9 shows more verbose messages than 1.8 and the tests fail
because of them. These outputs are not important in our tests, so let's
suppress them by -q or grep -v.
2015-09-26 15:20:32 +09:00
Gilles Moris
c60f7ce967 summary: move the parents phase marker to commit line (issue4688)
The phase of the pending commit depends on the parent of the working directory
and on the phases.newcommit configuration.
First, this information rather depend on the commit line which describe the
pending commit.
Then, we only want to be advertised when the pending phase is going to be higher
than the default new commit phase.

So the format will change from

$ hg summary
parent: 2:ab91dfabc5ad
 foo
parent: 3:24f1031ad244 tip
 bar
branch: default
commit: 1 modified, 1 unknown, 1 unresolved (merge)
update: (current)
phases: 1 secret (secret)

to

parent: 2:ab91dfabc5ad
 foo
parent: 3:24f1031ad244 tip
 bar
branch: default
commit: 1 modified, 1 unknown, 1 unresolved (merge) (secret)
update: (current)
phases: 1 secret
2015-05-29 22:23:58 +02:00
Pierre-Yves David
281365197e progress: get the extremely verbose output out of default debug
When the progress extension is not enabled, each call to 'ui.progress' used to
issue a debug message. This results is a very verbose output and often redundant
in tests. Dropping it makes tests less volatile to factor they do not meant to
test.

We had to alter the sed trick in 'test-rename-merge2.t'. Sed is used to drop all
output from a certain point and hidding the progress output remove its anchor.
So we anchor on something else.
2015-05-09 23:40:40 -07:00
Gilles Moris
7771de9187 summary: add a phase line (draft, secret) to the output
The number of draft and secret changesets are currently not summarized.
This is an important information because the number of drafts give some rough
idea of the number of outgoing changesets in typical workflows, without needing
to probe a remote repository. And a non-zero number of secrets means that
those changeset will not be pushed.

If the repository is "dirty" - some draft or secret changesets exists - then
summary will display a line like:

phases: X draft, Y secret (public)

The phase in parenthesis corresponds to the highest phase of the parents of
the working directory, i.e. the current phase.

By default, the line is not printed if the repository is "clean" - all
changesets are public - but if verbose is activated, it will display:

phases: (public)

On the other hand, nothing will be printed if quiet is in action.

A few tests have been added in test-phases.t to cover the -v and -q cases.
2015-05-14 17:38:38 +02: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
Augie Fackler
a5ddb1dcfe tests: use $PYTHON instead of hardcoding python
This makes running the testsuite with pypy possible.
2014-10-15 15:35:59 -04:00
Mads Kiilerich
3a64b6d7ed subrepo: remove superfluous newline from subrepo prompt 2014-10-01 01:08:17 +02:00
Matt Mackall
11be5cc27c tests: replace exit 80 with #require 2014-08-06 11:43:59 -05:00
Danek Duvall
151b68d8da tests: cat error messages are different on Solaris 2014-07-21 11:27:24 -07:00
Matt Mackall
95a0ecfb91 merge with stable 2014-05-27 17:41:20 -07:00
FUJIWARA Katsunori
f2a51c0956 subrepo: avoid sanitizing ".hg/hgrc" in meta data area for non-hg subrepos
Before this patch, sanitizing ".hg/hgrc" scans directories and files
also in meta data area for non-hg subrepos: under ".svn" for
Subversion subrepo, for example.

This may cause not only performance impact (especially in large scale
subrepos) but also unexpected removing meta data files.

This patch avoids sanitizing ".hg/hgrc" in meta data area for non-hg
subrepos.

This patch stops checking "ignore" target at the first
(case-insensitive) appearance of it, because continuation of scanning
is meaningless in almost all cases.
2014-05-08 19:03:00 +09:00
FUJIWARA Katsunori
8aea0c13e6 subrepo: make "_sanitize()" take absolute path to the root of subrepo
Before this patch, "hg update" doesn't sanitize ".hg/hgrc" in non-hg
subrepos correctly, if "hg update" is executed not at the root of the
parent repository.

"_sanitize()" takes relative path to subrepo from the root of the
parent repository, and passes it to "os.walk()". In this case,
"os.walk()" expects CWD to be equal to the root of the parent
repository.

So, "os.walk()" can't find specified path (or may scan unexpected
path), if CWD isn't equal to the root of the parent repository.

Non-hg subrepo under nested hg-subrepos may cause same problem, too:
CWD may be equal to the root of the outer most repository, or so.

This patch makes "_sanitize()" take absolute path to the root of
subrepo to sanitize correctly in such cases.

This patch doesn't normalize the path to hostile files as the one
relative to CWD (or the root of the outer most repository), to fix the
problem in the simple way suitable for "stable".

Normalizing should be done in the future: maybe as a part of the
migration to vfs.
2014-05-08 19:03:00 +09:00
FUJIWARA Katsunori
78cdb35351 subrepo: make "_sanitize()" work
"_sanitize()" was introduced by 5131f2755f60 on "stable" branch, but
it has done nothing for sanitizing since 5131f2755f60.

"_sanitize()" assumes "Visitor" design pattern:

    "os.walk()" should invoke specified function ("v" in this case)
    for each directory elements under specified path

but "os.walk()" assumes "Iterator" design pattern:

    callers of it should drive loop to scan each directory elements
    under specified path by themselves with the returned generator
    object

Because of this mismatching, "_sanitize()" just discards the generator
object returned by "os.walk()" and does nothing for sanitizing.

This patch makes "_sanitize()" work.

This patch also changes the format of warning message to show each
unlinked files, for multiple appearances of "potentially hostile
.hg/hgrc".
2014-05-08 19:03:00 +09:00
Mads Kiilerich
0e8795ccd6 spelling: fixes from spell checker 2014-04-13 19:01:00 +02:00
Stephen Lee
767b0ab60c update: show message when a bookmark is activated by update
When updating to a bookmark, mention that the bookmark is now
active.  This is a reminder that update does not move the
current bookmark if an explicit target is given - instead
it activates that target.
2013-03-07 14:17:56 +11:00
Siddharth Agarwal
1dfb639cc9 update: when deactivating a bookmark, print a message
This helps prevent user confusion when innocent-seeming commands like
'hg update -C .' are run.
2014-05-14 12:49:55 -07:00
Angel Ezquerra
65d42d2870 merge: let the user choose to merge, keep local or keep remote subrepo revisions
When a subrepo has changed on the local and remote revisions, prompt the user
whether it wants to merge those subrepo revisions, keep the local revision or
keep the remote revision.

Up until now mercurial would always perform a merge on a subrepo that had
changed on the local and the remote revisions. This is often inconvenient. For
example:

- You may want to perform the actual subrepo merge after you have merged the
parent subrepo files.
- Some subrepos may be considered "read only", in the sense that you are not
supposed to add new revisions to them. In those cases "merging a subrepo" means
choosing which _existing_ revision you want to use on the merged revision. This
is often the case for subrepos that contain binary dependencies (such as DLLs,
etc).

This new prompt makes mercurial better cope with those common scenarios.

Notes:

- The default behavior (which is the one that is used when ui is not
interactive) remains unchanged (i.e. merge is the default action).
- This prompt will be shown even if the ui --tool flag is set.
- I don't know of a way to test the "keep local" and "keep remote" options (i.e.
to force the test to choose those options).


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1378420708 -7200
#      Fri Sep 06 00:38:28 2013 +0200
# Node ID 2fb9cb0c7b26303ac3178b7739975e663075857d
# Parent  796d34e1b749b79834321ef1181ed8433a5515d9
merge: let the user choose to merge, keep local or keep remote subrepo revisions

When a subrepo has changed on the local and remote revisions, prompt the user
whether it wants to merge those subrepo revisions, keep the local revision or
keep the remote revision.

Up until now mercurial would always perform a merge on a subrepo that had
changed on the local and the remote revisions. This is often inconvenient. For
example:

- You may want to perform the actual subrepo merge after you have merged the
parent subrepo files.
- Some subrepos may be considered "read only", in the sense that you are not
supposed to add new revisions to them. In those cases "merging a subrepo" means
choosing which _existing_ revision you want to use on the merged revision. This
is often the case for subrepos that contain binary dependencies (such as DLLs,
etc).

This new prompt makes mercurial better cope with those common scenarios.

Notes:

- The default behavior (which is the one that is used when ui is not
interactive) remains unchanged (i.e. merge is the default action).
- This prompt will be shown even if the ui --tool flag is set.
- I don't know of a way to test the "keep local" and "keep remote" options (i.e.
to force the test to choose those options).
2013-09-06 00:38:28 +02:00
Siddharth Agarwal
ecd3be8cef update: add error message for dirty non-linear update with no rev
Previously, the error message for a dirty non-linear update was the same (and
relatively unhelpful) whether or not a rev was specified. This patch and an
upcoming one will introduce separate, more helpful hints.
2013-09-23 20:07:30 -07:00
Mads Kiilerich
2d6545f8b6 subrepos: process subrepos in sorted order
Add sorted() in places found by testing with PYTHONHASHSEED=random and code
inspection.

An alternative to sprinkling sorted() all over would be to change substate to a
custom dict with sorted iterators...
2012-12-12 02:38:14 +01:00
Angel Ezquerra
586f53ce9d subrepo: append subrepo path to subrepo error messages
This change appends the subrepo path to subrepo errors. That is, when there
is an error performing an operation a subrepo, rather than displaying a message
such as:

pushing subrepo MYSUBREPO to PATH
searching for changes
abort: push creates new remote head HEADHASH!
hint: did you forget to merge? use push -f to force

mercurial will show:

pushing subrepo MYSUBREPO to PATH
searching for changes
abort: push creates new remote head HEADHASH! (in subrepo MYSUBREPO)
hint: did you forget to merge? use push -f to force

The rationale for this change is that the current error messages make it hard
for TortoiseHg (and similar tools) to tell the user which subrepo caused the
push failure.

The "(in subrepo MYSUBREPO)" message has been added to those subrepo methods
were it made sense (by using a decorator). We avoid appending "(in subrepo XXX)"
multiple times when subrepos are nexted by throwing a "SubrepoAbort" exception
after the extra message is appended. The decorator will then "ignore" (i.e. just
re-raise) the exception and never add the message again.

A small drawback of this method is that part of the exception trace is lost when
the exception is catched and re-raised by the annotatesubrepoerror decorator.

Also, because the state() function already printed the subrepo path when it
threw an error, that error has been changed to avoid duplicating the subrepo
path in the error message.

Note that I have also updated several subrepo related tests to reflect these
changes.
2012-12-13 23:37:53 +01:00
Patrick Mezard
2e04c51661 identity: show trailing '+' for dirty subrepos (issue2839) 2012-07-27 13:56:19 +02:00
Matt Harbison
63a46b018b subrepo: propagate matcher to subrepos when archiving
Add a match object to subrepo.archive(). This will allow the -X and -I
options to be honored inside subrepos when archiving. They formerly
only affect the top level repo.
2012-06-16 22:34:06 -04:00
Mads Kiilerich
b584158b6d tests: cleanup of svn url handling
The subversion tests used different tricks to create properly encoded URLs,
partly due to partial support for different ways of running the tests on
windows. Now we only need/support one way of running the tests on windows.

Windows URLs should look like 'file:///c:/foo%20bar' and on Unix platforms
like 'file:///tmp/baz'.

'pwd' in the test framework will on Windows emit paths like 'c:/foo bar'.
Explicit handling of backslashes in paths is thus no longer needed and is
removed.  Paths on windows do however need an extra '/' compared to other
platforms.

This change makes test-subrepo-svn.t pass on windows with msys. Other tests
might need more work.
2012-06-26 03:35:22 +02:00
Eduard-Cristian Stefan
171e65bf7f test-subrepo-svn.t: partially adapt for Windows
hg forget 'notafile*' is changed to use a name that is valid on Windows so we
still get the same error ... but the error message is disabled because it
varies with the Windows version.
2012-06-23 19:54:08 +03:00
Mads Kiilerich
1df3d48d73 tests: change odd uses of 'if hghave' to #if 2012-06-10 13:01:40 +02:00
Patrick Mezard
5e78cfbfbb subrepo/svn: fix checked out rev number retrieval (issue2968)
The initial version was to take the "Revision" field from svn info. It works
but produces false positive when parent paths are being moved or unrelated
changes are being committed, causing it to change while the svn checkout itself
remains the same. To avoid spurious commit, we took "Revision" and "Last
Changed Rev" for general comparison and kept the latter to answer "what is your
revision?" question. This is better but fails when the subrepo path exists at
"Revision" but not at "Last Changed Rev". This patch adds a check for this, and
returns "Revision" if the path does not exist. We try to avoid doing this as
much as possible at it implies an extra, *remote* call.
2012-04-30 17:03:15 +02:00
Patrick Mezard
cb57bc8bda subrepo/svn: improve error message on missing files
From:

  abort: failed to commit svn changes

to:

  abort: cannot commit missing svn entries
2012-04-26 12:13:20 +02:00
Patrick Mezard
ed26ff342c subrepo/svn: abort on commit with missing file (issue3029)
Previous code was printing a traceback because it expected some error output
from svn. But sometimes our definition of "changed" differs with the subversion
one. For instance, subversion ignores missing files when committing. And when
there are only missing files, svn commit will be a successful no-op with no
output. Still, we should stick to our definition including missing files in
changes as doing otherwise could cause surprising behaviour for the user.
2012-04-26 11:55:07 +02:00
Patrick Mezard
f98c45e1c6 subrepo: fix default implementation of forget() (issue3404) 2012-04-27 11:02:16 +02:00
Patrick Mezard
4125f797db test-subrepo-svn: fix non-determinism
The test was randomly failing with:

  --- /tests/test-subrepo-svn.t
  +++ /test-subrepo-svn.t.err
  @@ -273,10 +273,10 @@
     1 files updated, 0 files merged, 0 files removed, 0 files unresolved
     $ cd t/s
     $ svn status
  -  ? *    a (glob)
  -  X *    externals (glob)
  -  ? *    f1 (glob)
  -  ? *    f2 (glob)
  +  ?       f1
  +  ?       f2
  +  ?       a
  +  X       externals

     Performing status on external item at 'externals'* (glob)
2012-04-27 10:17:55 +02:00
Matt Mackall
1ca3f6721a merge with stable 2012-04-16 16:50:25 -05:00
Patrick Mezard
4539c8fa89 archive: make it work with svn subrepos (issue3308)
- _svncommand() in files() returns a tuple since 1ca3bbcf0c2a not a string.
- _svncommand() in filedata() returns a tuple not a string.
- "svn list" returns files but also directories.
- "svn list" is not recursive by default.

I have no idea what happens to svn:externals possibly embedded in the svn
subrepository.
2012-04-16 11:48:15 +02:00
Matt Mackall
a17b10a14b subrepo: rewrite handling of subrepo state at commit (issue2403)
When the contents of .hgsubstate are stale (either because they've
manually been tweaked or partial updates have confused it), we get
confused about whether it actually needs committing.

So instead, we actively consult the parent's substate and compare it
the actual current state when deciding whether it needs committing.

Side effect: lots of "committing subrepo" messages that didn't
correspond with real commits disappear.

This change is fairly invasive for a fairly obscure condition, so it's
kept on the default branch.
2012-02-06 15:10:01 -06:00
Patrick Mezard
7a8d1bb9db test-svn-subrepo: fix reference output for svn 1.7
I modified check-code.py "$?" detection because I thought my use was legit, we
cannot test exit status of pipelines commands except for the last one without
this. So it now tolerates "[$?" which is unlikely to be added by mistake.

Tested on:
- OSX + svn 1.7.1
- Linux + svn 1.6.12
2011-12-02 16:50:48 +01:00
Matt Mackall
8971e5af3c check-code: fix issues with finding patterns in unified tests, fix tests
- old-style patterns without ^ were getting improperly anchored
- finditer was matching against beginning of line poorly
- \s was matching newlines
- [^x] was matching newlines

so we:

- remove earlier hacks for multiline matching
- fix unified test anchoring by adding .*
- replace \s with [ \t]
- replace [^x] with [^\nx]
- force all matches into multiline mode so ^ anchors work

This uncovers a number of test issues that are then repaired.
2011-10-27 17:22:04 -05:00
Thomas Arendsen Hein
e0dfb62c23 tests: check for svn >= 1.3 and >= 1.5 in tests that require those versions 2011-10-23 21:22:55 +02:00
Martin Geisler
acfa971cf1 subrepos: abort commit by default if a subrepo is dirty (BC)
This changeset flips the default value of ui.commitsubrepos setting
from True to False and adds a --subrepos flag to commit.

The commit, status, and diff commands behave like this with regard to
recusion and the ui.commitsubrepos setting:

          | recurses      | recurses
          | by default    | with --subrepos
  --------+---------------+----------------
  commit: | commitsubrepo | True
  status: | False         | True
  diff:   | False         | True

By changing the default from True to False, the table becomes
consistent in the two columns:

* without --subrepos on the command line, commit will abort if a
  subrepo is dirty and status/diff wont show changes inside subrepos.

* with --subrepos, all three commands will recurse.

A --subrepos flag on the command line overrides the config settin.g
2011-10-21 00:33:08 +02:00
Mads Kiilerich
4578a9a76b tests: don't use 'test -e'
On Solaris 10:

  $ test -e f
  test: argument expected
2011-10-17 00:11:56 +02:00
Eli Carter
8827c54a9a subrepo: correct revision in svn checkout
A Subversion subrepo checkout uses a url and --revision which does not do the
correct thing when specifying a revision of a branch that has since been
deleted and recreated.  The checkout needs to specify the revision as URL@REV
instead.
2011-06-30 13:22:12 -05:00
Augie Fackler
e777b9d80a svn subrepos: work around checkout obstructions (issue2752)
We do this by ensuring the working copy is clean and then blowing away
the working copy and replacing it with one from the desired path. We
could probably use 'svn switch' to do this more efficiently, but
there's some subtle logic required to get that right and this is
more likely to work reliably.
2011-06-17 15:22:50 -05:00
Matt Mackall
3b61150db3 merge with stable 2011-04-30 03:44:31 -05:00
Patrick Mezard
3616aca56a subrepo: handle svn tracked/unknown directory collisions
This happens more often than expected. Say you have an svn subrepository with
python code. Python would have generated unknown .pyc files. Now, you rebase
this setup on a revision where a directory containing python code does not
exist. Subversion is first asked to remove this directory when updating, but
will not because it contains untracked items. Then it will have to bring back
the directory after the merge but will fail because it now collides with an
untracked directory.

Using --force is not very elegant and only works with svn >= 1.5 but the only
alternative I can think of is to write our own purge command for subversion.
2011-03-04 14:00:49 +01:00
Matt Mackall
f80e0eddc7 subrepo: fix up svn test output 2011-04-07 09:47:30 -05:00
Patrick Mezard
cb64444c5f subrepo: backout 66e642f0195f, --force requires svn >= 1.5 2011-03-07 23:02:04 +01:00
Patrick Mezard
12049011b2 subrepo: handle svn tracked/unknown directory collisions
This happens more often than expected. Say you have an svn subrepository with
python code. Python would have generated unknown .pyc files. Now, you rebase
this setup on a revision where a directory containing python code does not
exist. Subversion is first asked to remove this directory when updating, but
will not because it contains untracked items. Then it will have to bring back
the directory after the merge but will fail because it now collides with an
untracked directory.

Using --force is not very elegant but it is much simpler than rewriting our own
purge command for subversion.
2011-03-04 14:00:49 +01:00
Erik Zielke
1d125c0477 subrepos: prompt on conflicts on update with dirty subrepos
Consider a repository with a single subrepository. The changesets in
the main repository reference the subrepository changesets like this:

  m0 -> s0
  m1 -> s1
  m2 -> s2

Starting from a state (m1, s0), doing 'hg update m2' in the main
repository will yield a conflict: the subrepo is at revision s0 but
the target revision says it should be at revision s2.

Before this change, Mercurial would do (m1, s0) -> (m2, s2) and thus
ignore the conflict between the working copy and the target revision.

With this change, the user is prompted to resolve the conflict by
choosing which revision he wants. This is consistent with 'hg merge',
which also prompts the user when it detects conflicts in the merged
.hgsubstate files.

The prompt looks like this:

  $ hg update tip
   subrepository sources for my-subrepo differ
  use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)?
2011-02-09 10:53:09 +01:00
Matt Mackall
f435f40e4e tests: fixes for svn 1.4.2 2011-02-15 16:19:11 -06:00
Patrick Mezard
339c6194d0 subrepo: fix update -C with svn subrepos when cwd != repo.root 2011-02-01 21:39:28 +01:00
Erik Zielke
bf9e13d063 subrepo: make update -C clean the working directory for svn subrepos
This makes 'hg update --clean' behave the same way for both kinds of
subrepositories. Before Subversion subrepos did not take the clean
parameter into account, but just updated to the given revision and
merged uncommitted changes into that.
2011-01-31 13:33:41 +01:00