Commit Graph

55 Commits

Author SHA1 Message Date
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
Matt Mackall
f1d993bf16 merge with stable 2014-06-13 17:42:04 -05:00
Danek Duvall
8ddd82e2d3 tests: cat error messages are different on Solaris 2014-06-09 10:34:21 -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
a8f723b6c7 subrepo: invoke "_sanitize()" also after "git merge --ff"
Before this patch, sanitizing ".hg/hgrc" in git subrepo doesn't work,
when the working directory is updated by "git merge --ff".

"_sanitize()" is not invoked after checking target revision out into
the working directory in this case, even though it is invoked
indirectly via "checkout" (or "rawcheckout") in other cases.

This patch invokes "_sanitize()" explicitly also after "git merge
--ff" execution.
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
Matt Mackall
95a0ecfb91 merge with stable 2014-05-27 17:41:20 -07:00
Mads Kiilerich
0e8795ccd6 spelling: fixes from spell checker 2014-04-13 19:01:00 +02:00
Mads Kiilerich
666578cf0e tests: deal with new gits sending status messages to stderr
git-1.8.4.2 will send messages like
  Cloning into 'X'...
  done.
to stderr.

Mute stderr.
2013-11-16 19:55:38 -05: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
Kevin Bullock
5340fc4c0d subrepo: fix test breakage introduced in c4e616650776
The test didn't break when I originally committed it (git version
1.7.12.4 (Apple Git-37)), and still doesn't on that machine, but the
output changes elsewhere with "Warning: you are leaving N commits
behind..."

This change sets a ref on the commit we're updating the subrepo _away_
from to quash the warning.
2013-02-21 21:05:06 +00:00
Kevin Bullock
1945e018e5 subrepo: add regression test for issue3870 2013-04-16 22:00:41 -05:00
Angel Ezquerra
b4d4cc2829 subrepo: use subrepo shortid method to generate subrepo diverged promptchoice
We were always using only the first 12 characters of the subrepo revision id
when generating the "subrepo diverged" promptchoice. This is not necessarily
correct for non mercurial subrepos.
2014-05-07 00:13:22 +02: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
Mads Kiilerich
9cddfd19ab check-code: fix check for trailing whitespace on sh command lines
The $ has been without necessary escaping since introduced in c4ecbbd282fe.
2012-08-08 18:10:16 +02:00
Patrick Mezard
2e04c51661 identity: show trailing '+' for dirty subrepos (issue2839) 2012-07-27 13:56:19 +02:00
Mads Kiilerich
43fde17e2d tests: ignore pax_global_header in test-subrepo-git.t
Failure seen on hgbuildbot 2.4 and 2.5 after a62fb0987502.

Hide '../archive_x/s/pax_global_header' with same strange trick as in
686775e575f3.
2012-07-05 02:25:49 +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
Eduard-Cristian Stefan
bdebec155d test-subrepo-git.t: 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-20 02:09:49 +03:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Patrick Mezard
f98c45e1c6 subrepo: fix default implementation of forget() (issue3404) 2012-04-27 11:02:16 +02:00
Matt Mackall
80e06b69f8 merge with stable 2012-03-18 18:21:58 -05:00
Javi Merino
d914ea463e tests: ignore git's output in test-subrepo-git.t
git version 1.7.9.1 makes the testsuite fail with:

@@ -482,7 +482,17 @@

 Sticky repository, update --clean
   $ hg update --clean tip
-  Previous HEAD position was aa84837... f
+  Warning: you are leaving 2 commits behind, not connected to
+  any of your branches:
+
+    aa84837 f
+    126f2a1 gg
+
+  If you want to keep them by creating a new branch, this may be a good time
+  to do so with:
+
+   git branch new_branch_name aa84837ccfbdfedcdcdeeedc309d73e6eb069edc
+
   HEAD is now at 32a3438... fff
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg id -n

ERROR: test-subrepo-git.t output changed
2012-03-15 23:02:31 +00: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
Eric Roshan Eisner
5dcac2b222 subrepo: fix git status false positive (issue3109)
It turns out there's a separate command to force git to look at file contents
if the stat has changed.
2011-11-11 11:11:11 +11:11
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
Matt Mackall
e5b463de99 merge with stable 2011-05-31 15:28:23 -05:00
Eric Eisner
55bac452e8 subrepo: don't crash when git .hgsubstate is empty (issue2716) 2011-05-28 11:03:48 -04:00
Eric Eisner
25b04beb36 subrepo: don't crash when git repo is missing 2011-03-07 12:03:54 -05:00
Eric Eisner
16fbbf312c subrepo: expand relative sources for git subrepos 2011-02-22 15:11:10 -05:00
Kevin Bullock
720b543cad subrepos: print short git changeset ids
This changes the prompts on git subrepos to show only the first seven
digits of git changeset IDs (as git's command line does):

    $ hg update
    subrepository sources for s differ (in checked out version)
    use (l)ocal source (32a3438) or (r)emote source (da5f5b1)?
2011-02-16 11:53:48 -06: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
Eric Eisner
968806d4b9 test-subrepo-git.t: make compatible with old git 2011-01-31 19:19:56 -05:00
Erik Zielke
68282c3062 subrepo: make update -C clean the working directory for git subrepos
This makes 'hg update --clean' behave the same way for all three kinds
of subrepositories [hg, svn, git]. Before git 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:40:05 +01:00
Lee Cantey
61056636c3 Ignore pax_global_header that some tar versions write as a file. 2011-01-25 16:33:46 -08:00
Eric Eisner
5a68596380 subrepo: basic support for status of git subrepos 2010-12-20 13:59:33 -05:00
Eric Eisner
ca54cd3a42 subrepo: fix subrelpath for git subrepos
This patch conforms gitsubrepo code to the variable naming scheme of the other
subrepo implementations. All user-facing path references should be relative
to the root repository.
2010-12-20 13:59:33 -05:00
Eric Eisner
196def6fd2 subrepo: silence git output when ui.quiet is set 2010-12-09 16:52:14 -05:00
Eric Eisner
bdf59c0067 test-subrepo-git.t: make gitroot pushable earlier
Older git versions get confused when the git repo becomes bare.
2010-12-06 21:17:27 -05:00
Eric Eisner
3cd880088d test-subrepo-git.t: silence git output
Older git versions have different ideas of what output is considered quiet,
so the tests can be more version-blind.
2010-12-06 21:17:27 -05:00
Eric Eisner
433dad3882 subrepo: lazily update git's local tracking branches
This continues the strategy of separation between hg pull and hg update in
git subrepos by only dealing with git's branches on an update. This behavior
tries to cover the bare essentials of the semantics of git pull in the subrepo
when the parent repo does hg pull and hg update.
2010-11-28 17:19:23 -05:00
Eric Eisner
47f74e81de subrepo: lazier git push logic
Avoids calls to git push when the revision is already known to be
in the remote repository. Now, when using a read-only git subrepo,
git will never need to talk to its upstream repository.
2010-11-21 22:00:51 -05:00
Eric Eisner
0e03c676b5 subrepo: archive git subrepos 2010-11-18 19:20:21 -05:00
Dan Villiom Podlaski Christiansen
56cb66ebbb test-subrepo-git.t: portability fix.
Specifying arguments after file names for 'ls' is a GNU extension.
2010-11-16 13:29:35 +01:00
Eric Eisner
c8106b69bb subrepo: removing (and restoring) git subrepo state 2010-11-14 18:31:40 -05:00
Eric Eisner
7c9ab4f118 subrepo: update and merge works with any git branch 2010-11-14 18:31:29 -05:00
Eric Eisner
22744d6861 subrepo: allow git subrepos to push and merge
(master branch only)

gitsubrepo based on patch from David Soria Parra:
http://bitbucket.org/segv/davids-poor-git-subrepo-attempt/
2010-11-14 18:22:33 -05:00
Eric Eisner
244b8e45a7 subrepo: cloning and updating of git subrepos
gitsubrepo based on patch from David Soria Parra:
http://bitbucket.org/segv/davids-poor-git-subrepo-attempt/
2010-11-14 18:20:13 -05:00