2011-10-21 02:33:08 +04:00
|
|
|
Let commit recurse into subrepos by default to match pre-2.0 behavior:
|
|
|
|
|
|
|
|
$ echo "[ui]" >> $HGRCPATH
|
|
|
|
$ echo "commitsubrepos = Yes" >> $HGRCPATH
|
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg init t
|
|
|
|
$ cd t
|
|
|
|
|
|
|
|
first revision, no sub
|
|
|
|
|
|
|
|
$ echo a > a
|
|
|
|
$ hg ci -Am0
|
|
|
|
adding a
|
|
|
|
|
|
|
|
add first sub
|
|
|
|
|
|
|
|
$ echo s = s > .hgsub
|
|
|
|
$ hg add .hgsub
|
|
|
|
$ hg init s
|
|
|
|
$ echo a > s/a
|
|
|
|
|
2010-09-24 12:13:49 +04:00
|
|
|
Issue2232: committing a subrepo without .hgsub
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
$ hg ci -mbad s
|
|
|
|
abort: can't commit subrepos without .hgsub
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-17 18:52:05 +04:00
|
|
|
|
2015-03-19 06:03:41 +03:00
|
|
|
$ hg -R s add s/a
|
|
|
|
$ hg files -S
|
|
|
|
.hgsub
|
|
|
|
a
|
2017-12-11 06:50:57 +03:00
|
|
|
s/a
|
2015-03-19 06:03:41 +03:00
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R s ci -Ams0
|
|
|
|
$ hg sum
|
|
|
|
parent: 0:f7b1eb17ad24 tip
|
|
|
|
0
|
|
|
|
branch: default
|
|
|
|
commit: 1 added, 1 subrepos
|
|
|
|
update: (current)
|
2015-05-29 23:23:58 +03:00
|
|
|
phases: 1 draft
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg ci -m1
|
|
|
|
|
localrepo: omit ".hgsubstate" also from "added" files
Before this patch, "localrepository.commit()" omits ".hgsubstate" from
"modified" (changes[0]) and "removed" (changes[2]) file list before
checking subrepositories, but leaves one in "added" (changes[1]) as it
is.
Then, "localrepository.commit()" adds ".hgsubstate" into "modified" or
"removed" list forcibly, according to subrepository statuses.
If "added" contains ".hgsubstate", the committed context will contain
two ".hgsubstate" in its "files": one from "added" (not omitted one),
and another from "modified" or "removed" (newly added one).
How many times ".hgsubstate" appears in "files" changes node hash,
even though revision content is same, because node hash calculation
uses the specified "files" directly (without duplication check or so).
This means that node hash of committed revision changes according to
existence of ".hgsubstate" in "added" at "localrepository.commit()".
".hgsubstate" is treated as "added", not only in accidental cases, but
also in the case of "qpush" for the patch adding ".hgsubstate".
This patch omits ".hgsubstate" also from "added" files before checking
subrepositories. This patch also omits ".hgsubstate" exclusion in
"qnew"/"qrefresh" introduced by changeset bbb8109a634f, because this
patch makes them meaningless.
"hg parents --template '{files}\n'" newly added to "test-mq-subrepo.t"
enhances checking unexpected multiple appearances of ".hgsubstate" in
"files" of created/refreshed MQ revisions.
2014-03-22 18:39:51 +04:00
|
|
|
test handling .hgsubstate "added" explicitly.
|
|
|
|
|
|
|
|
$ hg parents --template '{node}\n{files}\n'
|
|
|
|
7cf8cfea66e410e8e3336508dfeec07b3192de51
|
|
|
|
.hgsub .hgsubstate
|
|
|
|
$ hg rollback -q
|
|
|
|
$ hg add .hgsubstate
|
|
|
|
$ hg ci -m1
|
|
|
|
$ hg parents --template '{node}\n{files}\n'
|
|
|
|
7cf8cfea66e410e8e3336508dfeec07b3192de51
|
|
|
|
.hgsub .hgsubstate
|
|
|
|
|
2016-07-22 14:29:42 +03:00
|
|
|
Subrepopath which overlaps with filepath, does not change warnings in remove()
|
|
|
|
|
|
|
|
$ mkdir snot
|
|
|
|
$ touch snot/file
|
|
|
|
$ hg remove -S snot/file
|
2017-12-11 06:50:57 +03:00
|
|
|
not removing snot/file: file is untracked
|
2016-07-22 14:29:42 +03:00
|
|
|
[1]
|
2016-07-27 11:38:54 +03:00
|
|
|
$ hg cat snot/filenot
|
2017-12-11 06:50:57 +03:00
|
|
|
snot/filenot: no such file in rev 7cf8cfea66e4
|
2016-07-27 11:38:54 +03:00
|
|
|
[1]
|
2016-07-22 14:29:42 +03:00
|
|
|
$ rm -r snot
|
|
|
|
|
2012-04-17 09:22:44 +04:00
|
|
|
Revert subrepo and test subrepo fileset keyword:
|
2011-10-15 03:06:52 +04:00
|
|
|
|
|
|
|
$ echo b > s/a
|
2015-02-08 05:47:28 +03:00
|
|
|
$ hg revert --dry-run "set:subrepo('glob:s*')"
|
|
|
|
reverting subrepo s
|
2017-12-11 06:50:57 +03:00
|
|
|
reverting s/a
|
2015-02-08 05:47:28 +03:00
|
|
|
$ cat s/a
|
|
|
|
b
|
2012-04-17 09:22:44 +04:00
|
|
|
$ hg revert "set:subrepo('glob:s*')"
|
2012-03-28 13:42:17 +04:00
|
|
|
reverting subrepo s
|
2017-12-11 06:50:57 +03:00
|
|
|
reverting s/a
|
2015-02-08 05:47:28 +03:00
|
|
|
$ cat s/a
|
|
|
|
a
|
2012-03-28 13:42:17 +04:00
|
|
|
$ rm s/a.orig
|
2011-10-15 03:06:52 +04:00
|
|
|
|
2012-03-28 13:42:17 +04:00
|
|
|
Revert subrepo with no backup. The "reverting s/a" line is gone since
|
|
|
|
we're really running 'hg update' in the subrepo:
|
2011-10-15 03:06:52 +04:00
|
|
|
|
2012-03-28 13:42:17 +04:00
|
|
|
$ echo b > s/a
|
|
|
|
$ hg revert --no-backup s
|
|
|
|
reverting subrepo s
|
2011-10-15 03:06:52 +04:00
|
|
|
|
2010-09-24 12:13:49 +04:00
|
|
|
Issue2022: update -C
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
$ echo b > s/a
|
|
|
|
$ hg sum
|
|
|
|
parent: 1:7cf8cfea66e4 tip
|
|
|
|
1
|
|
|
|
branch: default
|
|
|
|
commit: 1 subrepos
|
|
|
|
update: (current)
|
2015-05-29 23:23:58 +03:00
|
|
|
phases: 2 draft
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg co -C 1
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg sum
|
|
|
|
parent: 1:7cf8cfea66e4 tip
|
|
|
|
1
|
|
|
|
branch: default
|
|
|
|
commit: (clean)
|
|
|
|
update: (current)
|
2015-05-29 23:23:58 +03:00
|
|
|
phases: 2 draft
|
2010-08-17 18:52:05 +04:00
|
|
|
|
2011-10-12 05:18:15 +04:00
|
|
|
commands that require a clean repo should respect subrepos
|
|
|
|
|
|
|
|
$ echo b >> s/a
|
|
|
|
$ hg backout tip
|
2017-07-09 23:13:30 +03:00
|
|
|
abort: uncommitted changes in subrepository "s"
|
2011-10-12 05:18:15 +04:00
|
|
|
[255]
|
|
|
|
$ hg revert -C -R s s/a
|
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
add sub sub
|
|
|
|
|
|
|
|
$ echo ss = ss > s/.hgsub
|
|
|
|
$ hg init s/ss
|
|
|
|
$ echo a > s/ss/a
|
|
|
|
$ hg -R s add s/.hgsub
|
|
|
|
$ hg -R s/ss add s/ss/a
|
|
|
|
$ hg sum
|
|
|
|
parent: 1:7cf8cfea66e4 tip
|
|
|
|
1
|
|
|
|
branch: default
|
|
|
|
commit: 1 subrepos
|
|
|
|
update: (current)
|
2015-05-29 23:23:58 +03:00
|
|
|
phases: 2 draft
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg ci -m2
|
|
|
|
committing subrepository s
|
2017-12-11 06:50:57 +03:00
|
|
|
committing subrepository s/ss
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg sum
|
|
|
|
parent: 2:df30734270ae tip
|
|
|
|
2
|
|
|
|
branch: default
|
|
|
|
commit: (clean)
|
|
|
|
update: (current)
|
2015-05-29 23:23:58 +03:00
|
|
|
phases: 3 draft
|
2010-08-17 18:52:05 +04:00
|
|
|
|
localrepo: omit ".hgsubstate" also from "added" files
Before this patch, "localrepository.commit()" omits ".hgsubstate" from
"modified" (changes[0]) and "removed" (changes[2]) file list before
checking subrepositories, but leaves one in "added" (changes[1]) as it
is.
Then, "localrepository.commit()" adds ".hgsubstate" into "modified" or
"removed" list forcibly, according to subrepository statuses.
If "added" contains ".hgsubstate", the committed context will contain
two ".hgsubstate" in its "files": one from "added" (not omitted one),
and another from "modified" or "removed" (newly added one).
How many times ".hgsubstate" appears in "files" changes node hash,
even though revision content is same, because node hash calculation
uses the specified "files" directly (without duplication check or so).
This means that node hash of committed revision changes according to
existence of ".hgsubstate" in "added" at "localrepository.commit()".
".hgsubstate" is treated as "added", not only in accidental cases, but
also in the case of "qpush" for the patch adding ".hgsubstate".
This patch omits ".hgsubstate" also from "added" files before checking
subrepositories. This patch also omits ".hgsubstate" exclusion in
"qnew"/"qrefresh" introduced by changeset bbb8109a634f, because this
patch makes them meaningless.
"hg parents --template '{files}\n'" newly added to "test-mq-subrepo.t"
enhances checking unexpected multiple appearances of ".hgsubstate" in
"files" of created/refreshed MQ revisions.
2014-03-22 18:39:51 +04:00
|
|
|
test handling .hgsubstate "modified" explicitly.
|
|
|
|
|
|
|
|
$ hg parents --template '{node}\n{files}\n'
|
|
|
|
df30734270ae757feb35e643b7018e818e78a9aa
|
|
|
|
.hgsubstate
|
|
|
|
$ hg rollback -q
|
|
|
|
$ hg status -A .hgsubstate
|
|
|
|
M .hgsubstate
|
|
|
|
$ hg ci -m2
|
|
|
|
$ hg parents --template '{node}\n{files}\n'
|
|
|
|
df30734270ae757feb35e643b7018e818e78a9aa
|
|
|
|
.hgsubstate
|
|
|
|
|
2011-02-16 00:25:48 +03:00
|
|
|
bump sub rev (and check it is ignored by ui.commitsubrepos)
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
$ echo b > s/a
|
|
|
|
$ hg -R s ci -ms1
|
2011-02-16 00:25:48 +03:00
|
|
|
$ hg --config ui.commitsubrepos=no ci -m3
|
2010-08-17 18:52:05 +04:00
|
|
|
|
2011-02-16 00:25:48 +03:00
|
|
|
leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
$ echo c > s/a
|
2011-02-16 00:25:48 +03:00
|
|
|
$ hg --config ui.commitsubrepos=no ci -m4
|
2017-07-09 23:13:30 +03:00
|
|
|
abort: uncommitted changes in subrepository "s"
|
2011-10-21 02:33:08 +04:00
|
|
|
(use --subrepos for recursive commit)
|
2011-02-16 00:25:48 +03:00
|
|
|
[255]
|
2012-07-27 15:56:19 +04:00
|
|
|
$ hg id
|
|
|
|
f6affe3fbfaa+ tip
|
|
|
|
$ hg -R s ci -mc
|
|
|
|
$ hg id
|
|
|
|
f6affe3fbfaa+ tip
|
|
|
|
$ echo d > s/a
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg ci -m4
|
|
|
|
committing subrepository s
|
|
|
|
$ hg tip -R s
|
2012-07-27 15:56:19 +04:00
|
|
|
changeset: 4:02dcf1d70411
|
2010-08-17 18:52:05 +04:00
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: 4
|
|
|
|
|
|
|
|
|
|
|
|
check caching
|
|
|
|
|
|
|
|
$ hg co 0
|
|
|
|
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
|
|
|
|
$ hg debugsub
|
|
|
|
|
|
|
|
restore
|
|
|
|
|
|
|
|
$ hg co
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
2012-07-27 15:56:19 +04:00
|
|
|
revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
new branch for merge tests
|
|
|
|
|
|
|
|
$ hg co 1
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ echo t = t >> .hgsub
|
|
|
|
$ hg init t
|
|
|
|
$ echo t > t/t
|
|
|
|
$ hg -R t add t
|
2017-12-11 06:50:57 +03:00
|
|
|
adding t/t
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
$ hg ci -m5 # add sub
|
|
|
|
committing subrepository t
|
|
|
|
$ echo t2 > t/t
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
$ hg st -R s
|
|
|
|
$ hg ci -m6 # change sub
|
|
|
|
committing subrepository t
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
path t
|
|
|
|
source t
|
|
|
|
revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
|
|
|
|
$ echo t3 > t/t
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
$ hg ci -m7 # change sub again for conflict test
|
|
|
|
committing subrepository t
|
|
|
|
$ hg rm .hgsub
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
$ hg ci -m8 # remove sub
|
|
|
|
|
localrepo: omit ".hgsubstate" also from "added" files
Before this patch, "localrepository.commit()" omits ".hgsubstate" from
"modified" (changes[0]) and "removed" (changes[2]) file list before
checking subrepositories, but leaves one in "added" (changes[1]) as it
is.
Then, "localrepository.commit()" adds ".hgsubstate" into "modified" or
"removed" list forcibly, according to subrepository statuses.
If "added" contains ".hgsubstate", the committed context will contain
two ".hgsubstate" in its "files": one from "added" (not omitted one),
and another from "modified" or "removed" (newly added one).
How many times ".hgsubstate" appears in "files" changes node hash,
even though revision content is same, because node hash calculation
uses the specified "files" directly (without duplication check or so).
This means that node hash of committed revision changes according to
existence of ".hgsubstate" in "added" at "localrepository.commit()".
".hgsubstate" is treated as "added", not only in accidental cases, but
also in the case of "qpush" for the patch adding ".hgsubstate".
This patch omits ".hgsubstate" also from "added" files before checking
subrepositories. This patch also omits ".hgsubstate" exclusion in
"qnew"/"qrefresh" introduced by changeset bbb8109a634f, because this
patch makes them meaningless.
"hg parents --template '{files}\n'" newly added to "test-mq-subrepo.t"
enhances checking unexpected multiple appearances of ".hgsubstate" in
"files" of created/refreshed MQ revisions.
2014-03-22 18:39:51 +04:00
|
|
|
test handling .hgsubstate "removed" explicitly.
|
|
|
|
|
|
|
|
$ hg parents --template '{node}\n{files}\n'
|
|
|
|
96615c1dad2dc8e3796d7332c77ce69156f7b78e
|
|
|
|
.hgsub .hgsubstate
|
|
|
|
$ hg rollback -q
|
|
|
|
$ hg remove .hgsubstate
|
|
|
|
$ hg ci -m8
|
|
|
|
$ hg parents --template '{node}\n{files}\n'
|
|
|
|
96615c1dad2dc8e3796d7332c77ce69156f7b78e
|
|
|
|
.hgsub .hgsubstate
|
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
merge tests
|
|
|
|
|
|
|
|
$ hg co -C 3
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg merge 5 # test adding
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
|
|
|
|
path t
|
|
|
|
source t
|
|
|
|
revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
|
|
|
|
$ hg ci -m9
|
|
|
|
$ hg merge 6 --debug # test change
|
|
|
|
searching for copies back to rev 2
|
|
|
|
resolving manifests
|
2013-02-08 19:23:23 +04:00
|
|
|
branchmerge: True, force: False, partial: False
|
2011-12-09 20:34:53 +04:00
|
|
|
ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
|
2016-02-29 09:01:20 +03:00
|
|
|
starting 4 threads for background file closing (?)
|
2015-10-12 07:56:39 +03:00
|
|
|
.hgsubstate: versions differ -> m (premerge)
|
2010-08-17 18:52:05 +04:00
|
|
|
subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
|
|
|
|
subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
|
|
|
|
getting subrepo t
|
|
|
|
resolving manifests
|
2013-02-08 19:23:23 +04:00
|
|
|
branchmerge: False, force: False, partial: False
|
2012-10-24 20:45:22 +04:00
|
|
|
ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
|
2010-08-17 18:52:05 +04:00
|
|
|
t: remote is newer -> g
|
|
|
|
getting t
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
|
|
|
|
path t
|
|
|
|
source t
|
|
|
|
revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
|
|
|
|
$ echo conflict > t/t
|
|
|
|
$ hg ci -m10
|
|
|
|
committing subrepository t
|
|
|
|
$ HGMERGE=internal:merge hg merge --debug 7 # test conflict
|
|
|
|
searching for copies back to rev 2
|
|
|
|
resolving manifests
|
2013-02-08 19:23:23 +04:00
|
|
|
branchmerge: True, force: False, partial: False
|
2011-12-09 20:34:53 +04:00
|
|
|
ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
|
2016-02-29 09:01:20 +03:00
|
|
|
starting 4 threads for background file closing (?)
|
2015-10-12 07:56:39 +03:00
|
|
|
.hgsubstate: versions differ -> m (premerge)
|
2010-08-17 18:52:05 +04:00
|
|
|
subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
|
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 02:38:28 +04:00
|
|
|
subrepo t: both sides changed
|
|
|
|
subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
|
2016-10-08 11:25:28 +03:00
|
|
|
starting 4 threads for background file closing (?)
|
2016-10-07 18:51:50 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
|
2017-07-09 23:13:30 +03:00
|
|
|
merging subrepository "t"
|
2010-08-17 18:52:05 +04:00
|
|
|
searching for copies back to rev 2
|
|
|
|
resolving manifests
|
2013-02-08 19:23:23 +04:00
|
|
|
branchmerge: True, force: False, partial: False
|
2011-12-09 20:34:53 +04:00
|
|
|
ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
|
2014-04-22 04:10:25 +04:00
|
|
|
preserving t for resolve of t
|
2017-04-02 09:24:09 +03:00
|
|
|
starting 4 threads for background file closing (?)
|
2015-10-12 07:56:39 +03:00
|
|
|
t: versions differ -> m (premerge)
|
2015-11-26 01:25:26 +03:00
|
|
|
picked tool ':merge' for t (binary False symlink False changedelete False)
|
2010-08-17 18:52:05 +04:00
|
|
|
merging t
|
|
|
|
my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
|
2015-10-12 07:56:39 +03:00
|
|
|
t: versions differ -> m (merge)
|
2015-11-26 01:25:26 +03:00
|
|
|
picked tool ':merge' for t (binary False symlink False changedelete False)
|
2015-10-12 06:47:14 +03:00
|
|
|
my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
|
2015-10-09 23:54:52 +03:00
|
|
|
warning: conflicts while merging t! (edit, then use 'hg resolve --mark')
|
2010-08-17 18:52:05 +04:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
|
2010-09-13 03:05:53 +04:00
|
|
|
use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
|
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 02:38:28 +04:00
|
|
|
subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
|
2010-08-17 18:52:05 +04:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
|
|
|
|
should conflict
|
|
|
|
|
|
|
|
$ cat t/t
|
2014-05-26 22:44:58 +04:00
|
|
|
<<<<<<< local: 20a0db6fbf6c - test: 10
|
2010-08-17 18:52:05 +04:00
|
|
|
conflict
|
|
|
|
=======
|
|
|
|
t3
|
2016-11-20 02:41:37 +03:00
|
|
|
>>>>>>> other: 7af322bc1198 - test: 7
|
2010-08-17 18:52:05 +04:00
|
|
|
|
2015-02-18 10:20:55 +03:00
|
|
|
11: remove subrepo t
|
|
|
|
|
|
|
|
$ hg co -C 5
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg revert -r 4 .hgsub # remove t
|
|
|
|
$ hg ci -m11
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
|
|
|
|
local removed, remote changed, keep changed
|
|
|
|
|
|
|
|
$ hg merge 6
|
2017-03-20 14:36:55 +03:00
|
|
|
remote [merge rev] changed subrepository t which local [working copy] removed
|
2015-02-18 10:20:55 +03:00
|
|
|
use (c)hanged version or (d)elete? c
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
BROKEN: should include subrepo t
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
$ cat .hgsubstate
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
6747d179aa9a688023c4b0cad32e4c92bb7f34ad t
|
|
|
|
$ hg ci -m 'local removed, remote changed, keep changed'
|
|
|
|
BROKEN: should include subrepo t
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
BROKEN: should include subrepo t
|
|
|
|
$ cat .hgsubstate
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
$ cat t/t
|
|
|
|
t2
|
|
|
|
|
|
|
|
local removed, remote changed, keep removed
|
|
|
|
|
|
|
|
$ hg co -C 11
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg merge --config ui.interactive=true 6 <<EOF
|
|
|
|
> d
|
|
|
|
> EOF
|
2017-03-20 14:36:55 +03:00
|
|
|
remote [merge rev] changed subrepository t which local [working copy] removed
|
2015-02-18 10:20:55 +03:00
|
|
|
use (c)hanged version or (d)elete? d
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
$ cat .hgsubstate
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
$ hg ci -m 'local removed, remote changed, keep removed'
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
$ cat .hgsubstate
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
|
|
|
|
local changed, remote removed, keep changed
|
|
|
|
|
|
|
|
$ hg co -C 6
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg merge 11
|
2017-03-20 14:36:55 +03:00
|
|
|
local [working copy] changed subrepository t which remote [merge rev] removed
|
2015-02-18 10:20:55 +03:00
|
|
|
use (c)hanged version or (d)elete? c
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
BROKEN: should include subrepo t
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
BROKEN: should include subrepo t
|
|
|
|
$ cat .hgsubstate
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
$ hg ci -m 'local changed, remote removed, keep changed'
|
|
|
|
BROKEN: should include subrepo t
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
BROKEN: should include subrepo t
|
|
|
|
$ cat .hgsubstate
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
$ cat t/t
|
|
|
|
t2
|
|
|
|
|
|
|
|
local changed, remote removed, keep removed
|
|
|
|
|
|
|
|
$ hg co -C 6
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg merge --config ui.interactive=true 11 <<EOF
|
|
|
|
> d
|
|
|
|
> EOF
|
2017-03-20 14:36:55 +03:00
|
|
|
local [working copy] changed subrepository t which remote [merge rev] removed
|
2015-02-18 10:20:55 +03:00
|
|
|
use (c)hanged version or (d)elete? d
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
$ cat .hgsubstate
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
$ hg ci -m 'local changed, remote removed, keep removed'
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
|
|
|
|
$ cat .hgsubstate
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
|
|
|
|
clean up to avoid having to fix up the tests below
|
|
|
|
|
|
|
|
$ hg co -C 10
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> strip=
|
|
|
|
> EOF
|
|
|
|
$ hg strip -r 11:15
|
|
|
|
saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
|
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
clone
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ hg clone t tc
|
|
|
|
updating to branch default
|
2013-02-24 01:54:57 +04:00
|
|
|
cloning subrepo s from $TESTTMP/t/s
|
2017-12-11 06:50:57 +03:00
|
|
|
cloning subrepo s/ss from $TESTTMP/t/s/ss
|
2013-02-24 01:54:57 +04:00
|
|
|
cloning subrepo t from $TESTTMP/t/t
|
2010-08-17 18:52:05 +04:00
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd tc
|
|
|
|
$ hg debugsub
|
|
|
|
path s
|
|
|
|
source s
|
|
|
|
revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
|
|
|
|
path t
|
|
|
|
source t
|
|
|
|
revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
|
2017-11-05 15:22:07 +03:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
clone with subrepo disabled (update should fail)
|
|
|
|
|
2017-11-07 09:32:41 +03:00
|
|
|
$ hg clone t -U tc2 --config subrepos.allowed=false
|
|
|
|
$ hg update -R tc2 --config subrepos.allowed=false
|
|
|
|
abort: subrepos not enabled
|
2017-11-05 15:22:07 +03:00
|
|
|
(see 'hg help config.subrepos' for details)
|
|
|
|
[255]
|
|
|
|
$ ls tc2
|
|
|
|
a
|
|
|
|
|
2017-11-07 09:32:41 +03:00
|
|
|
$ hg clone t tc3 --config subrepos.allowed=false
|
2017-11-05 15:22:07 +03:00
|
|
|
updating to branch default
|
2017-11-07 09:32:41 +03:00
|
|
|
abort: subrepos not enabled
|
2017-11-05 15:22:07 +03:00
|
|
|
(see 'hg help config.subrepos' for details)
|
|
|
|
[255]
|
|
|
|
$ ls tc3
|
|
|
|
a
|
2010-08-17 18:52:05 +04:00
|
|
|
|
2017-11-07 09:32:41 +03:00
|
|
|
And again with just the hg type disabled
|
|
|
|
|
|
|
|
$ hg clone t -U tc4 --config subrepos.hg:allowed=false
|
|
|
|
$ hg update -R tc4 --config subrepos.hg:allowed=false
|
|
|
|
abort: hg subrepos not allowed
|
2017-11-05 15:48:58 +03:00
|
|
|
(see 'hg help config.subrepos' for details)
|
|
|
|
[255]
|
|
|
|
$ ls tc4
|
|
|
|
a
|
|
|
|
|
2017-11-07 09:32:41 +03:00
|
|
|
$ hg clone t tc5 --config subrepos.hg:allowed=false
|
|
|
|
updating to branch default
|
|
|
|
abort: hg subrepos not allowed
|
|
|
|
(see 'hg help config.subrepos' for details)
|
|
|
|
[255]
|
|
|
|
$ ls tc5
|
|
|
|
a
|
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
push
|
|
|
|
|
2017-11-05 15:22:07 +03:00
|
|
|
$ cd tc
|
2010-08-17 18:52:05 +04:00
|
|
|
$ echo bah > t/t
|
|
|
|
$ hg ci -m11
|
|
|
|
committing subrepository t
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/t
|
|
|
|
no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
no changes made to subrepo s since last push to $TESTTMP/t/s
|
2013-02-24 01:54:57 +04:00
|
|
|
pushing subrepo t to $TESTTMP/t/t
|
2010-08-17 18:52:05 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
|
|
|
|
push -f
|
|
|
|
|
|
|
|
$ echo bah > s/a
|
|
|
|
$ hg ci -m12
|
|
|
|
committing subrepository s
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/t
|
|
|
|
no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
|
2013-02-24 01:54:57 +04:00
|
|
|
pushing subrepo s to $TESTTMP/t/s
|
2010-08-17 18:52:05 +04:00
|
|
|
searching for changes
|
2017-07-09 23:13:30 +03:00
|
|
|
abort: push creates new remote head 12a213df6fa9! (in subrepository "s")
|
2016-09-21 02:47:30 +03:00
|
|
|
(merge or see 'hg help push' for details about pushing new heads)
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg push -f
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/t
|
|
|
|
pushing subrepo s/ss to $TESTTMP/t/s/ss
|
2010-08-17 18:52:05 +04:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
2013-02-24 01:54:57 +04:00
|
|
|
pushing subrepo s to $TESTTMP/t/s
|
2010-08-17 18:52:05 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files (+1 heads)
|
2013-02-24 01:54:57 +04:00
|
|
|
pushing subrepo t to $TESTTMP/t/t
|
2010-08-17 18:52:05 +04:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
|
2013-03-09 00:50:27 +04:00
|
|
|
check that unmodified subrepos are not pushed
|
|
|
|
|
|
|
|
$ hg clone . ../tcc
|
|
|
|
updating to branch default
|
|
|
|
cloning subrepo s from $TESTTMP/tc/s
|
2017-12-11 06:50:57 +03:00
|
|
|
cloning subrepo s/ss from $TESTTMP/tc/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
cloning subrepo t from $TESTTMP/tc/t
|
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
the subrepos on the new clone have nothing to push to its source
|
|
|
|
|
|
|
|
$ hg push -R ../tcc .
|
|
|
|
pushing to .
|
2017-12-11 06:50:57 +03:00
|
|
|
no changes made to subrepo s/ss since last push to s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
no changes made to subrepo s since last push to s
|
|
|
|
no changes made to subrepo t since last push to t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
|
|
|
|
the subrepos on the source do not have a clean store versus the clone target
|
|
|
|
because they were never explicitly pushed to the source
|
|
|
|
|
|
|
|
$ hg push ../tcc
|
|
|
|
pushing to ../tcc
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing subrepo s/ss to ../tcc/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
pushing subrepo s to ../tcc/s
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
pushing subrepo t to ../tcc/t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
|
|
|
|
after push their stores become clean
|
|
|
|
|
|
|
|
$ hg push ../tcc
|
|
|
|
pushing to ../tcc
|
2017-12-11 06:50:57 +03:00
|
|
|
no changes made to subrepo s/ss since last push to ../tcc/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
no changes made to subrepo s since last push to ../tcc/s
|
|
|
|
no changes made to subrepo t since last push to ../tcc/t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
|
|
|
|
updating a subrepo to a different revision or changing
|
|
|
|
its working directory does not make its store dirty
|
|
|
|
|
|
|
|
$ hg -R s update '.^'
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/t
|
|
|
|
no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
no changes made to subrepo s since last push to $TESTTMP/t/s
|
|
|
|
no changes made to subrepo t since last push to $TESTTMP/t/t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
$ echo foo >> s/a
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/t
|
|
|
|
no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
no changes made to subrepo s since last push to $TESTTMP/t/s
|
|
|
|
no changes made to subrepo t since last push to $TESTTMP/t/t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
$ hg -R s update -C tip
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
committing into a subrepo makes its store (but not its parent's store) dirty
|
|
|
|
|
|
|
|
$ echo foo >> s/ss/a
|
|
|
|
$ hg -R s/ss commit -m 'test dirty store detection'
|
2015-04-28 04:15:25 +03:00
|
|
|
|
|
|
|
$ hg out -S -r `hg log -r tip -T "{node|short}"`
|
2017-12-11 06:50:57 +03:00
|
|
|
comparing with $TESTTMP/t
|
2015-04-28 04:15:25 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
comparing with $TESTTMP/t/s
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
comparing with $TESTTMP/t/s/ss
|
|
|
|
searching for changes
|
|
|
|
changeset: 1:79ea5566a333
|
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: test dirty store detection
|
|
|
|
|
|
|
|
comparing with $TESTTMP/t/t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
|
2013-03-09 00:50:27 +04:00
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/t
|
|
|
|
pushing subrepo s/ss to $TESTTMP/t/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
no changes made to subrepo s since last push to $TESTTMP/t/s
|
|
|
|
no changes made to subrepo t since last push to $TESTTMP/t/t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
|
|
|
|
a subrepo store may be clean versus one repo but not versus another
|
|
|
|
|
|
|
|
$ hg push
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/t
|
|
|
|
no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
no changes made to subrepo s since last push to $TESTTMP/t/s
|
|
|
|
no changes made to subrepo t since last push to $TESTTMP/t/t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
$ hg push ../tcc
|
|
|
|
pushing to ../tcc
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing subrepo s/ss to ../tcc/s/ss
|
2013-03-09 00:50:27 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
|
|
|
no changes made to subrepo s since last push to ../tcc/s
|
|
|
|
no changes made to subrepo t since last push to ../tcc/t
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
update
|
|
|
|
|
|
|
|
$ cd ../t
|
|
|
|
$ hg up -C # discard our earlier merge
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2017-06-06 19:47:39 +03:00
|
|
|
updated to "c373c8102e68: 12"
|
2016-02-02 17:49:02 +03:00
|
|
|
2 other heads for branch "default"
|
2010-08-17 18:52:05 +04:00
|
|
|
$ echo blah > t/t
|
|
|
|
$ hg ci -m13
|
|
|
|
committing subrepository t
|
|
|
|
|
2013-04-15 18:52:57 +04:00
|
|
|
backout calls revert internally with minimal opts, which should not raise
|
|
|
|
KeyError
|
|
|
|
|
2016-01-16 00:46:33 +03:00
|
|
|
$ hg backout ".^" --no-commit
|
2013-04-15 18:52:57 +04:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2014-01-09 05:23:26 +04:00
|
|
|
changeset c373c8102e68 backed out, don't forget to commit.
|
2013-04-15 18:52:57 +04:00
|
|
|
|
|
|
|
$ hg up -C # discard changes
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2017-06-06 19:47:39 +03:00
|
|
|
updated to "925c17564ef8: 13"
|
2016-02-02 17:49:02 +03:00
|
|
|
2 other heads for branch "default"
|
2013-04-15 18:52:57 +04:00
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
pull
|
|
|
|
|
|
|
|
$ cd ../tc
|
|
|
|
$ hg pull
|
2017-12-11 06:50:57 +03:00
|
|
|
pulling from $TESTTMP/t
|
2010-08-17 18:52:05 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 925c17564ef8
|
2010-08-17 18:52:05 +04:00
|
|
|
(run 'hg update' to get a working copy)
|
|
|
|
|
|
|
|
should pull t
|
|
|
|
|
2015-04-28 04:34:23 +03:00
|
|
|
$ hg incoming -S -r `hg log -r tip -T "{node|short}"`
|
2017-12-11 06:50:57 +03:00
|
|
|
comparing with $TESTTMP/t
|
2015-04-28 04:34:23 +03:00
|
|
|
no changes found
|
|
|
|
comparing with $TESTTMP/t/s
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
comparing with $TESTTMP/t/s/ss
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
comparing with $TESTTMP/t/t
|
|
|
|
searching for changes
|
|
|
|
changeset: 5:52c0adc0515a
|
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: 13
|
|
|
|
|
|
|
|
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg up
|
2013-02-24 01:54:57 +04:00
|
|
|
pulling subrepo t from $TESTTMP/t/t
|
2010-08-17 18:52:05 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 52c0adc0515a
|
2013-03-09 00:50:27 +04:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2017-06-06 19:47:39 +03:00
|
|
|
updated to "925c17564ef8: 13"
|
2016-02-02 17:49:02 +03:00
|
|
|
2 other heads for branch "default"
|
2010-08-17 18:52:05 +04:00
|
|
|
$ cat t/t
|
|
|
|
blah
|
|
|
|
|
|
|
|
bogus subrepo path aborts
|
|
|
|
|
|
|
|
$ echo 'bogus=[boguspath' >> .hgsub
|
|
|
|
$ hg ci -m 'bogus subrepo path'
|
2017-07-09 23:13:30 +03:00
|
|
|
abort: missing ] in subrepository source
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-17 18:52:05 +04:00
|
|
|
|
2010-09-24 12:13:49 +04:00
|
|
|
Issue1986: merge aborts when trying to merge a subrepo that
|
|
|
|
shouldn't need merging
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
# subrepo layout
|
|
|
|
#
|
|
|
|
# o 5 br
|
|
|
|
# /|
|
|
|
|
# o | 4 default
|
|
|
|
# | |
|
|
|
|
# | o 3 br
|
|
|
|
# |/|
|
|
|
|
# o | 2 default
|
|
|
|
# | |
|
|
|
|
# | o 1 br
|
|
|
|
# |/
|
|
|
|
# o 0 default
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ rm -rf sub
|
|
|
|
$ hg init main
|
|
|
|
$ cd main
|
|
|
|
$ hg init s
|
|
|
|
$ cd s
|
|
|
|
$ echo a > a
|
|
|
|
$ hg ci -Am1
|
|
|
|
adding a
|
|
|
|
$ hg branch br
|
|
|
|
marked working directory as branch br
|
2011-12-09 00:32:44 +04:00
|
|
|
(branches are permanent and global, did you want a bookmark?)
|
2010-08-17 18:52:05 +04:00
|
|
|
$ echo a >> a
|
|
|
|
$ hg ci -m1
|
|
|
|
$ hg up default
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ echo b > b
|
|
|
|
$ hg ci -Am1
|
|
|
|
adding b
|
|
|
|
$ hg up br
|
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg merge tip
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg ci -m1
|
|
|
|
$ hg up 2
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ echo c > c
|
|
|
|
$ hg ci -Am1
|
|
|
|
adding c
|
|
|
|
$ hg up 3
|
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg merge 4
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg ci -m1
|
|
|
|
|
|
|
|
# main repo layout:
|
|
|
|
#
|
|
|
|
# * <-- try to merge default into br again
|
|
|
|
# .`|
|
|
|
|
# . o 5 br --> substate = 5
|
|
|
|
# . |
|
|
|
|
# o | 4 default --> substate = 4
|
|
|
|
# | |
|
|
|
|
# | o 3 br --> substate = 2
|
|
|
|
# |/|
|
|
|
|
# o | 2 default --> substate = 2
|
|
|
|
# | |
|
|
|
|
# | o 1 br --> substate = 3
|
|
|
|
# |/
|
|
|
|
# o 0 default --> substate = 2
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ echo 's = s' > .hgsub
|
|
|
|
$ hg -R s up 2
|
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg ci -Am1
|
|
|
|
adding .hgsub
|
|
|
|
$ hg branch br
|
|
|
|
marked working directory as branch br
|
2011-12-09 00:32:44 +04:00
|
|
|
(branches are permanent and global, did you want a bookmark?)
|
2010-08-17 18:52:05 +04:00
|
|
|
$ echo b > b
|
|
|
|
$ hg -R s up 3
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg ci -Am1
|
|
|
|
adding b
|
|
|
|
$ hg up default
|
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ echo c > c
|
|
|
|
$ hg ci -Am1
|
|
|
|
adding c
|
|
|
|
$ hg up 1
|
|
|
|
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg merge 2
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg ci -m1
|
|
|
|
$ hg up 2
|
|
|
|
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg -R s up 4
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ echo d > d
|
|
|
|
$ hg ci -Am1
|
|
|
|
adding d
|
|
|
|
$ hg up 3
|
|
|
|
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg -R s up 5
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ echo e > e
|
|
|
|
$ hg ci -Am1
|
|
|
|
adding e
|
|
|
|
|
|
|
|
$ hg up 5
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg merge 4 # try to merge default into br again
|
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 02:38:28 +04:00
|
|
|
subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
|
2016-10-07 18:51:50 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m
|
2010-08-17 18:52:05 +04:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
test subrepo delete from .hgsubstate
|
|
|
|
|
|
|
|
$ hg init testdelete
|
|
|
|
$ mkdir testdelete/nested testdelete/nested2
|
|
|
|
$ hg init testdelete/nested
|
|
|
|
$ hg init testdelete/nested2
|
|
|
|
$ echo test > testdelete/nested/foo
|
|
|
|
$ echo test > testdelete/nested2/foo
|
|
|
|
$ hg -R testdelete/nested add
|
2017-12-11 06:50:57 +03:00
|
|
|
adding testdelete/nested/foo
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R testdelete/nested2 add
|
2017-12-11 06:50:57 +03:00
|
|
|
adding testdelete/nested2/foo
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R testdelete/nested ci -m test
|
|
|
|
$ hg -R testdelete/nested2 ci -m test
|
|
|
|
$ echo nested = nested > testdelete/.hgsub
|
|
|
|
$ echo nested2 = nested2 >> testdelete/.hgsub
|
|
|
|
$ hg -R testdelete add
|
2017-12-11 06:50:57 +03:00
|
|
|
adding testdelete/.hgsub
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R testdelete ci -m "nested 1 & 2 added"
|
|
|
|
$ echo nested = nested > testdelete/.hgsub
|
|
|
|
$ hg -R testdelete ci -m "nested 2 deleted"
|
|
|
|
$ cat testdelete/.hgsubstate
|
|
|
|
bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
|
|
|
|
$ hg -R testdelete remove testdelete/.hgsub
|
|
|
|
$ hg -R testdelete ci -m ".hgsub deleted"
|
|
|
|
$ cat testdelete/.hgsubstate
|
2011-06-07 00:17:40 +04:00
|
|
|
bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
test repository cloning
|
|
|
|
|
|
|
|
$ mkdir mercurial mercurial2
|
|
|
|
$ hg init nested_absolute
|
|
|
|
$ echo test > nested_absolute/foo
|
|
|
|
$ hg -R nested_absolute add
|
2017-12-11 06:50:57 +03:00
|
|
|
adding nested_absolute/foo
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R nested_absolute ci -mtest
|
|
|
|
$ cd mercurial
|
|
|
|
$ hg init nested_relative
|
|
|
|
$ echo test2 > nested_relative/foo2
|
|
|
|
$ hg -R nested_relative add
|
2017-12-11 06:50:57 +03:00
|
|
|
adding nested_relative/foo2
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R nested_relative ci -mtest2
|
|
|
|
$ hg init main
|
|
|
|
$ echo "nested_relative = ../nested_relative" > main/.hgsub
|
|
|
|
$ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
|
|
|
|
$ hg -R main add
|
2017-12-11 06:50:57 +03:00
|
|
|
adding main/.hgsub
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R main ci -m "add subrepos"
|
|
|
|
$ cd ..
|
|
|
|
$ hg clone mercurial/main mercurial2/main
|
|
|
|
updating to branch default
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cat mercurial2/main/nested_absolute/.hg/hgrc \
|
|
|
|
> mercurial2/main/nested_relative/.hg/hgrc
|
|
|
|
[paths]
|
2012-06-11 03:38:32 +04:00
|
|
|
default = $TESTTMP/mercurial/nested_absolute
|
2010-08-17 18:52:05 +04:00
|
|
|
[paths]
|
2012-06-11 03:38:32 +04:00
|
|
|
default = $TESTTMP/mercurial/nested_relative
|
2010-08-17 18:52:05 +04:00
|
|
|
$ rm -rf mercurial mercurial2
|
|
|
|
|
2010-09-24 12:13:49 +04:00
|
|
|
Issue1977: multirepo push should fail if subrepo push fails
|
2010-08-17 18:52:05 +04:00
|
|
|
|
|
|
|
$ hg init repo
|
|
|
|
$ hg init repo/s
|
|
|
|
$ echo a > repo/s/a
|
|
|
|
$ hg -R repo/s ci -Am0
|
|
|
|
adding a
|
|
|
|
$ echo s = s > repo/.hgsub
|
|
|
|
$ hg -R repo ci -Am1
|
|
|
|
adding .hgsub
|
|
|
|
$ hg clone repo repo2
|
|
|
|
updating to branch default
|
2013-02-24 01:54:57 +04:00
|
|
|
cloning subrepo s from $TESTTMP/repo/s
|
2010-08-17 18:52:05 +04:00
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg -q -R repo2 pull -u
|
|
|
|
$ echo 1 > repo2/s/a
|
|
|
|
$ hg -R repo2/s ci -m2
|
|
|
|
$ hg -q -R repo2/s push
|
|
|
|
$ hg -R repo2/s up -C 0
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2012-10-24 20:45:22 +04:00
|
|
|
$ echo 2 > repo2/s/b
|
|
|
|
$ hg -R repo2/s ci -m3 -A
|
|
|
|
adding b
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R repo2 ci -m3
|
|
|
|
$ hg -q -R repo2 push
|
2017-07-09 23:13:30 +03:00
|
|
|
abort: push creates new remote head cc505f09a8b2! (in subrepository "s")
|
2016-09-21 02:47:30 +03:00
|
|
|
(merge or see 'hg help push' for details about pushing new heads)
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-08-17 18:52:05 +04:00
|
|
|
$ hg -R repo update
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2012-10-24 20:45:22 +04:00
|
|
|
|
|
|
|
test if untracked file is not overwritten
|
|
|
|
|
context: write dirstate out explicitly after marking files as clean
To detect change of a file without redundant comparison of file
content, dirstate recognizes a file as certainly clean, if:
(1) it is already known as "normal",
(2) dirstate entry for it has valid (= not "-1") timestamp, and
(3) mode, size and timestamp of it on the filesystem are as same as
ones expected in dirstate
This works as expected in many cases, but doesn't in the corner case
that changing a file keeps mode, size and timestamp of it on the
filesystem.
The timetable below shows steps in one of typical such situations:
---- ----------------------------------- ----------------
timestamp of "f"
----------------
dirstate file-
time action mem file system
---- ----------------------------------- ---- ----- -----
N -1 ***
- make file "f" clean N
- execute 'hg foobar'
- instantiate 'dirstate' -1 -1
- 'dirstate.normal("f")' N -1
(e.g. via dirty check)
- change "f", but keep size N
N+1
- release wlock
- 'dirstate.write()' N N
- 'hg status' shows "f" as "clean" N N N
---- ----------------------------------- ---- ----- -----
The most important point is that 'dirstate.write()' is executed at N+1
or later. This causes writing dirstate timestamp N of "f" out
successfully. If it is executed at N, 'parsers.pack_dirstate()'
replaces timestamp N with "-1" before actual writing dirstate out.
Occasional test failure for unexpected file status is typical example
of this corner case. Batch execution with small working directory is
finished in no time, and rarely satisfies condition (2) above.
This issue can occur in cases below;
- 'hg revert --rev REV' for revisions other than the parent
- failure of 'merge.update()' before 'merge.recordupdates()'
The root cause of this issue is that files are changed without
flushing in-memory dirstate changes via 'repo.commit()' (even though
omitting 'dirstate.normallookup()' on changed files also causes this
issue).
To detect changes of files correctly, this patch writes in-memory
dirstate changes out explicitly after marking files as clean in
'workingctx._checklookup()', which is invoked via 'repo.status()'.
After this change, timetable is changed as below:
---- ----------------------------------- ----------------
timestamp of "f"
----------------
dirstate file-
time action mem file system
---- ----------------------------------- ---- ----- -----
N -1 ***
- make file "f" clean N
- execute 'hg foobar'
- instantiate 'dirstate' -1 -1
- 'dirstate.normal("f")' N -1
(e.g. via dirty check)
----------------------------------- ---- ----- -----
- 'dirsttate.write()' -1 -1
----------------------------------- ---- ----- -----
- change "f", but keep size N
N+1
- release wlock
- 'dirstate.write()' -1 -1
- 'hg status' -1 -1 N
---- ----------------------------------- ---- ----- -----
To reproduce this issue in tests certainly, this patch emulates some
timing critical actions as below:
- timestamp of "f" in '.hg/dirstate' is -1 at the beginning
'hg debugrebuildstate' before command invocation ensures it.
- make file "f" clean at N
- change "f" at N
'touch -t 200001010000' before and after command invocation
changes mtime of "f" to "2000-01-01 00:00" (= N).
- invoke 'dirstate.write()' via 'repo.status()' at N
'fakedirstatewritetime.py' forces 'pack_dirstate()' to use
"2000-01-01 00:00" as "now", only if 'pack_dirstate()' is invoked
via 'workingctx._checklookup()'.
- invoke 'dirstate.write()' via releasing wlock at N+1 (or "not at N")
'pack_dirstate()' via releasing wlock uses actual timestamp at
runtime as "now", and it should be different from the "2000-01-01
00:00" of "f".
BTW, this patch also changes 'test-largefiles-misc.t', because adding
'dirstate.write()' makes recent dirstate changes visible to external
process.
2015-07-08 11:01:09 +03:00
|
|
|
(this also tests that updated .hgsubstate is treated as "modified",
|
|
|
|
when 'merge.update()' is aborted before 'merge.recordupdates()', even
|
|
|
|
if none of mode, size and timestamp of it isn't changed on the
|
|
|
|
filesystem (see also issue4583))
|
|
|
|
|
2012-10-24 20:45:22 +04:00
|
|
|
$ echo issue3276_ok > repo/s/b
|
|
|
|
$ hg -R repo2 push -f -q
|
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-29 22:59:05 +03:00
|
|
|
$ touch -t 200001010000 repo/.hgsubstate
|
context: write dirstate out explicitly after marking files as clean
To detect change of a file without redundant comparison of file
content, dirstate recognizes a file as certainly clean, if:
(1) it is already known as "normal",
(2) dirstate entry for it has valid (= not "-1") timestamp, and
(3) mode, size and timestamp of it on the filesystem are as same as
ones expected in dirstate
This works as expected in many cases, but doesn't in the corner case
that changing a file keeps mode, size and timestamp of it on the
filesystem.
The timetable below shows steps in one of typical such situations:
---- ----------------------------------- ----------------
timestamp of "f"
----------------
dirstate file-
time action mem file system
---- ----------------------------------- ---- ----- -----
N -1 ***
- make file "f" clean N
- execute 'hg foobar'
- instantiate 'dirstate' -1 -1
- 'dirstate.normal("f")' N -1
(e.g. via dirty check)
- change "f", but keep size N
N+1
- release wlock
- 'dirstate.write()' N N
- 'hg status' shows "f" as "clean" N N N
---- ----------------------------------- ---- ----- -----
The most important point is that 'dirstate.write()' is executed at N+1
or later. This causes writing dirstate timestamp N of "f" out
successfully. If it is executed at N, 'parsers.pack_dirstate()'
replaces timestamp N with "-1" before actual writing dirstate out.
Occasional test failure for unexpected file status is typical example
of this corner case. Batch execution with small working directory is
finished in no time, and rarely satisfies condition (2) above.
This issue can occur in cases below;
- 'hg revert --rev REV' for revisions other than the parent
- failure of 'merge.update()' before 'merge.recordupdates()'
The root cause of this issue is that files are changed without
flushing in-memory dirstate changes via 'repo.commit()' (even though
omitting 'dirstate.normallookup()' on changed files also causes this
issue).
To detect changes of files correctly, this patch writes in-memory
dirstate changes out explicitly after marking files as clean in
'workingctx._checklookup()', which is invoked via 'repo.status()'.
After this change, timetable is changed as below:
---- ----------------------------------- ----------------
timestamp of "f"
----------------
dirstate file-
time action mem file system
---- ----------------------------------- ---- ----- -----
N -1 ***
- make file "f" clean N
- execute 'hg foobar'
- instantiate 'dirstate' -1 -1
- 'dirstate.normal("f")' N -1
(e.g. via dirty check)
----------------------------------- ---- ----- -----
- 'dirsttate.write()' -1 -1
----------------------------------- ---- ----- -----
- change "f", but keep size N
N+1
- release wlock
- 'dirstate.write()' -1 -1
- 'hg status' -1 -1 N
---- ----------------------------------- ---- ----- -----
To reproduce this issue in tests certainly, this patch emulates some
timing critical actions as below:
- timestamp of "f" in '.hg/dirstate' is -1 at the beginning
'hg debugrebuildstate' before command invocation ensures it.
- make file "f" clean at N
- change "f" at N
'touch -t 200001010000' before and after command invocation
changes mtime of "f" to "2000-01-01 00:00" (= N).
- invoke 'dirstate.write()' via 'repo.status()' at N
'fakedirstatewritetime.py' forces 'pack_dirstate()' to use
"2000-01-01 00:00" as "now", only if 'pack_dirstate()' is invoked
via 'workingctx._checklookup()'.
- invoke 'dirstate.write()' via releasing wlock at N+1 (or "not at N")
'pack_dirstate()' via releasing wlock uses actual timestamp at
runtime as "now", and it should be different from the "2000-01-01
00:00" of "f".
BTW, this patch also changes 'test-largefiles-misc.t', because adding
'dirstate.write()' makes recent dirstate changes visible to external
process.
2015-07-08 11:01:09 +03:00
|
|
|
|
|
|
|
$ cat >> repo/.hg/hgrc <<EOF
|
|
|
|
> [fakedirstatewritetime]
|
|
|
|
> # emulate invoking dirstate.write() via repo.status()
|
|
|
|
> # at 2000-01-01 00:00
|
|
|
|
> fakenow = 200001010000
|
|
|
|
>
|
|
|
|
> [extensions]
|
|
|
|
> fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
|
|
|
|
> EOF
|
2012-10-24 20:45:22 +04:00
|
|
|
$ hg -R repo update
|
|
|
|
b: untracked file differs
|
2017-07-09 23:13:30 +03:00
|
|
|
abort: untracked files in working directory differ from files in requested revision (in subrepository "s")
|
2012-10-24 20:45:22 +04:00
|
|
|
[255]
|
context: write dirstate out explicitly after marking files as clean
To detect change of a file without redundant comparison of file
content, dirstate recognizes a file as certainly clean, if:
(1) it is already known as "normal",
(2) dirstate entry for it has valid (= not "-1") timestamp, and
(3) mode, size and timestamp of it on the filesystem are as same as
ones expected in dirstate
This works as expected in many cases, but doesn't in the corner case
that changing a file keeps mode, size and timestamp of it on the
filesystem.
The timetable below shows steps in one of typical such situations:
---- ----------------------------------- ----------------
timestamp of "f"
----------------
dirstate file-
time action mem file system
---- ----------------------------------- ---- ----- -----
N -1 ***
- make file "f" clean N
- execute 'hg foobar'
- instantiate 'dirstate' -1 -1
- 'dirstate.normal("f")' N -1
(e.g. via dirty check)
- change "f", but keep size N
N+1
- release wlock
- 'dirstate.write()' N N
- 'hg status' shows "f" as "clean" N N N
---- ----------------------------------- ---- ----- -----
The most important point is that 'dirstate.write()' is executed at N+1
or later. This causes writing dirstate timestamp N of "f" out
successfully. If it is executed at N, 'parsers.pack_dirstate()'
replaces timestamp N with "-1" before actual writing dirstate out.
Occasional test failure for unexpected file status is typical example
of this corner case. Batch execution with small working directory is
finished in no time, and rarely satisfies condition (2) above.
This issue can occur in cases below;
- 'hg revert --rev REV' for revisions other than the parent
- failure of 'merge.update()' before 'merge.recordupdates()'
The root cause of this issue is that files are changed without
flushing in-memory dirstate changes via 'repo.commit()' (even though
omitting 'dirstate.normallookup()' on changed files also causes this
issue).
To detect changes of files correctly, this patch writes in-memory
dirstate changes out explicitly after marking files as clean in
'workingctx._checklookup()', which is invoked via 'repo.status()'.
After this change, timetable is changed as below:
---- ----------------------------------- ----------------
timestamp of "f"
----------------
dirstate file-
time action mem file system
---- ----------------------------------- ---- ----- -----
N -1 ***
- make file "f" clean N
- execute 'hg foobar'
- instantiate 'dirstate' -1 -1
- 'dirstate.normal("f")' N -1
(e.g. via dirty check)
----------------------------------- ---- ----- -----
- 'dirsttate.write()' -1 -1
----------------------------------- ---- ----- -----
- change "f", but keep size N
N+1
- release wlock
- 'dirstate.write()' -1 -1
- 'hg status' -1 -1 N
---- ----------------------------------- ---- ----- -----
To reproduce this issue in tests certainly, this patch emulates some
timing critical actions as below:
- timestamp of "f" in '.hg/dirstate' is -1 at the beginning
'hg debugrebuildstate' before command invocation ensures it.
- make file "f" clean at N
- change "f" at N
'touch -t 200001010000' before and after command invocation
changes mtime of "f" to "2000-01-01 00:00" (= N).
- invoke 'dirstate.write()' via 'repo.status()' at N
'fakedirstatewritetime.py' forces 'pack_dirstate()' to use
"2000-01-01 00:00" as "now", only if 'pack_dirstate()' is invoked
via 'workingctx._checklookup()'.
- invoke 'dirstate.write()' via releasing wlock at N+1 (or "not at N")
'pack_dirstate()' via releasing wlock uses actual timestamp at
runtime as "now", and it should be different from the "2000-01-01
00:00" of "f".
BTW, this patch also changes 'test-largefiles-misc.t', because adding
'dirstate.write()' makes recent dirstate changes visible to external
process.
2015-07-08 11:01:09 +03:00
|
|
|
$ cat >> repo/.hg/hgrc <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> fakedirstatewritetime = !
|
|
|
|
> EOF
|
2012-10-24 20:45:22 +04:00
|
|
|
|
|
|
|
$ cat repo/s/b
|
|
|
|
issue3276_ok
|
|
|
|
$ rm repo/s/b
|
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-29 22:59:05 +03:00
|
|
|
$ touch -t 200001010000 repo/.hgsubstate
|
2012-10-24 20:45:22 +04:00
|
|
|
$ hg -R repo revert --all
|
2017-12-11 06:50:57 +03:00
|
|
|
reverting repo/.hgsubstate
|
2012-10-24 20:45:22 +04:00
|
|
|
reverting subrepo s
|
|
|
|
$ hg -R repo update
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cat repo/s/b
|
|
|
|
2
|
2010-08-17 18:52:05 +04:00
|
|
|
$ rm -rf repo2 repo
|
2010-10-19 05:56:20 +04:00
|
|
|
|
|
|
|
|
|
|
|
Issue1852 subrepos with relative paths always push/pull relative to default
|
|
|
|
|
|
|
|
Prepare a repo with subrepo
|
|
|
|
|
|
|
|
$ hg init issue1852a
|
|
|
|
$ cd issue1852a
|
|
|
|
$ hg init sub/repo
|
|
|
|
$ echo test > sub/repo/foo
|
|
|
|
$ hg -R sub/repo add sub/repo/foo
|
|
|
|
$ echo sub/repo = sub/repo > .hgsub
|
|
|
|
$ hg add .hgsub
|
|
|
|
$ hg ci -mtest
|
2017-12-11 06:50:57 +03:00
|
|
|
committing subrepository sub/repo
|
2010-10-19 05:56:20 +04:00
|
|
|
$ echo test >> sub/repo/foo
|
|
|
|
$ hg ci -mtest
|
2017-12-11 06:50:57 +03:00
|
|
|
committing subrepository sub/repo
|
2014-03-15 05:32:05 +04:00
|
|
|
$ hg cat sub/repo/foo
|
|
|
|
test
|
|
|
|
test
|
2017-06-05 03:11:59 +03:00
|
|
|
$ hg cat sub/repo/foo -Tjson | sed 's|\\\\|/|g'
|
2017-05-25 15:53:44 +03:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"abspath": "foo",
|
|
|
|
"data": "test\ntest\n",
|
2017-06-05 03:11:59 +03:00
|
|
|
"path": "sub/repo/foo"
|
2017-05-25 15:53:44 +03:00
|
|
|
}
|
|
|
|
]
|
2017-11-25 09:29:34 +03:00
|
|
|
|
|
|
|
non-exact match:
|
|
|
|
|
|
|
|
$ hg cat -T '{path}\n' 'glob:**'
|
|
|
|
.hgsub
|
|
|
|
.hgsubstate
|
2017-12-11 06:50:57 +03:00
|
|
|
sub/repo/foo
|
2017-11-25 09:29:34 +03:00
|
|
|
$ hg cat -T '{path}\n' 're:^sub'
|
2017-12-11 06:50:57 +03:00
|
|
|
sub/repo/foo
|
2017-11-25 09:29:34 +03:00
|
|
|
|
|
|
|
missing subrepos in working directory:
|
|
|
|
|
2014-03-15 05:32:05 +04:00
|
|
|
$ mkdir -p tmp/sub/repo
|
|
|
|
$ hg cat -r 0 --output tmp/%p_p sub/repo/foo
|
|
|
|
$ cat tmp/sub/repo/foo_p
|
|
|
|
test
|
|
|
|
$ mv sub/repo sub_
|
|
|
|
$ hg cat sub/repo/baz
|
|
|
|
skipping missing subrepository: sub/repo
|
|
|
|
[1]
|
|
|
|
$ rm -rf sub/repo
|
|
|
|
$ mv sub_ sub/repo
|
2010-10-19 05:56:20 +04:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
Create repo without default path, pull top repo, and see what happens on update
|
|
|
|
|
|
|
|
$ hg init issue1852b
|
|
|
|
$ hg -R issue1852b pull issue1852a
|
|
|
|
pulling from issue1852a
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 2 changesets with 3 changes to 2 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 19487b456929:be5eb94e7215
|
2010-10-19 05:56:20 +04:00
|
|
|
(run 'hg update' to get a working copy)
|
|
|
|
$ hg -R issue1852b update
|
2017-12-11 06:50:57 +03:00
|
|
|
abort: default path for subrepository not found (in subrepository "sub/repo")
|
2010-10-19 05:56:20 +04:00
|
|
|
[255]
|
|
|
|
|
2013-02-09 23:15:34 +04:00
|
|
|
Ensure a full traceback, not just the SubrepoAbort part
|
|
|
|
|
2015-10-08 22:55:45 +03:00
|
|
|
$ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort'
|
|
|
|
raise error.Abort(_("default path for subrepository not found"))
|
2013-02-09 23:15:34 +04:00
|
|
|
|
2010-10-19 05:56:20 +04:00
|
|
|
Pull -u now doesn't help
|
|
|
|
|
|
|
|
$ hg -R issue1852b pull -u issue1852a
|
|
|
|
pulling from issue1852a
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
|
|
|
|
Try the same, but with pull -u
|
|
|
|
|
|
|
|
$ hg init issue1852c
|
|
|
|
$ hg -R issue1852c pull -r0 -u issue1852a
|
|
|
|
pulling from issue1852a
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 2 changes to 2 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 19487b456929
|
2017-12-11 06:50:57 +03:00
|
|
|
cloning subrepo sub/repo from issue1852a/sub/repo
|
2010-10-27 02:28:40 +04:00
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2010-10-19 05:56:20 +04:00
|
|
|
|
|
|
|
Try to push from the other side
|
|
|
|
|
2010-10-27 02:28:40 +04:00
|
|
|
$ hg -R issue1852a push `pwd`/issue1852c
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/issue1852c
|
|
|
|
pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo
|
2010-10-27 02:28:40 +04:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2011-01-04 14:53:11 +03:00
|
|
|
|
2011-05-18 17:13:26 +04:00
|
|
|
Incoming and outgoing should not use the default path:
|
|
|
|
|
|
|
|
$ hg clone -q issue1852a issue1852d
|
|
|
|
$ hg -R issue1852d outgoing --subrepos issue1852c
|
|
|
|
comparing with issue1852c
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
comparing with issue1852c/sub/repo
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
$ hg -R issue1852d incoming --subrepos issue1852c
|
|
|
|
comparing with issue1852c
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
comparing with issue1852c/sub/repo
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
|
2015-04-25 06:23:55 +03:00
|
|
|
Check that merge of a new subrepo doesn't write the uncommitted state to
|
|
|
|
.hgsubstate (issue4622)
|
|
|
|
|
|
|
|
$ hg init issue1852a/addedsub
|
|
|
|
$ echo zzz > issue1852a/addedsub/zz.txt
|
|
|
|
$ hg -R issue1852a/addedsub ci -Aqm "initial ZZ"
|
|
|
|
|
|
|
|
$ hg clone issue1852a/addedsub issue1852d/addedsub
|
|
|
|
updating to branch default
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
$ echo def > issue1852a/sub/repo/foo
|
|
|
|
$ hg -R issue1852a ci -SAm 'tweaked subrepo'
|
|
|
|
adding tmp/sub/repo/foo_p
|
2017-12-11 06:50:57 +03:00
|
|
|
committing subrepository sub/repo
|
2015-04-25 06:23:55 +03:00
|
|
|
|
|
|
|
$ echo 'addedsub = addedsub' >> issue1852d/.hgsub
|
|
|
|
$ echo xyz > issue1852d/sub/repo/foo
|
|
|
|
$ hg -R issue1852d pull -u
|
2017-12-11 06:50:57 +03:00
|
|
|
pulling from $TESTTMP/issue1852a
|
2015-04-25 06:23:55 +03:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 2 changes to 2 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets c82b79fdcc5b
|
2015-04-25 06:23:55 +03:00
|
|
|
subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
|
2016-10-08 11:25:28 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
|
2017-12-11 06:50:57 +03:00
|
|
|
pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo
|
2015-04-25 06:23:55 +03:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 46cd4aac504c
|
2017-12-11 06:50:57 +03:00
|
|
|
subrepository sources for sub/repo differ
|
2015-04-25 06:23:55 +03:00
|
|
|
use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cat issue1852d/.hgsubstate
|
|
|
|
f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo
|
|
|
|
|
2011-01-04 14:53:11 +03:00
|
|
|
Check status of files when none of them belong to the first
|
|
|
|
subrepository:
|
|
|
|
|
|
|
|
$ hg init subrepo-status
|
|
|
|
$ cd subrepo-status
|
|
|
|
$ hg init subrepo-1
|
|
|
|
$ hg init subrepo-2
|
|
|
|
$ cd subrepo-2
|
|
|
|
$ touch file
|
|
|
|
$ hg add file
|
|
|
|
$ cd ..
|
|
|
|
$ echo subrepo-1 = subrepo-1 > .hgsub
|
|
|
|
$ echo subrepo-2 = subrepo-2 >> .hgsub
|
|
|
|
$ hg add .hgsub
|
|
|
|
$ hg ci -m 'Added subrepos'
|
|
|
|
committing subrepository subrepo-2
|
|
|
|
$ hg st subrepo-2/file
|
2011-01-31 15:33:41 +03:00
|
|
|
|
2012-10-27 14:38:59 +04:00
|
|
|
Check that share works with subrepo
|
|
|
|
$ hg --config extensions.share= share . ../shared
|
|
|
|
updating working directory
|
subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
Previously, only the top level repo was shared, and then any subrepos were
cloned on demand. This is problematic because commits to the parent repo would
write an updated .hgsubstate to the share source, but the corresponding subrepo
commit would be stuck in the local subrepo. That would prevent an update in the
source repo. We already go to great lengths to avoid having inconsistent repos
(e.g., `hg push -r rev` will push _everything_ in a subrepo, even if it isn't
referenced in one of the parent's outgoing commits). Therefore, this seems like
a bug fix, and there's no option to get the old behavior. I can't imagine the
previous behavior was useful to anybody.
There shouldn't be an issue with svn, since it is centralized. Maybe --git-dir
can be used for git subrepos, but I'll leave that to someone more familiar with
git.
An integer was previously being implicitly returned from commands.share(), which
caused dispatch() to start crashing when changing over to returning the shared
repo. All error paths appear to raise, so this can be hardcoded to success.
The clone command checks for 'is None' in a similar pattern, but since
hg.clone() always returns a tuple, that seems wrong?
.. fix:: Issue 5675
Creating a share of a repository with a Mercurial subrepository will now
share the subrepository.
and
.. bc::
Mercurial subrepositories are now shared instead of cloned when the parent
repository is shared. This prevents dangling subrepository references in the
share source. Previously shared repositories with cloned subrepositories
will continue to function unchanged.
2017-10-16 05:48:02 +03:00
|
|
|
sharing subrepo subrepo-1 from $TESTTMP/subrepo-status/subrepo-1
|
|
|
|
sharing subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2
|
2012-10-27 14:38:59 +04:00
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
subrepo: share instead of clone if the parent repo is shared (issue5675) (BC)
Previously, only the top level repo was shared, and then any subrepos were
cloned on demand. This is problematic because commits to the parent repo would
write an updated .hgsubstate to the share source, but the corresponding subrepo
commit would be stuck in the local subrepo. That would prevent an update in the
source repo. We already go to great lengths to avoid having inconsistent repos
(e.g., `hg push -r rev` will push _everything_ in a subrepo, even if it isn't
referenced in one of the parent's outgoing commits). Therefore, this seems like
a bug fix, and there's no option to get the old behavior. I can't imagine the
previous behavior was useful to anybody.
There shouldn't be an issue with svn, since it is centralized. Maybe --git-dir
can be used for git subrepos, but I'll leave that to someone more familiar with
git.
An integer was previously being implicitly returned from commands.share(), which
caused dispatch() to start crashing when changing over to returning the shared
repo. All error paths appear to raise, so this can be hardcoded to success.
The clone command checks for 'is None' in a similar pattern, but since
hg.clone() always returns a tuple, that seems wrong?
.. fix:: Issue 5675
Creating a share of a repository with a Mercurial subrepository will now
share the subrepository.
and
.. bc::
Mercurial subrepositories are now shared instead of cloned when the parent
repository is shared. This prevents dangling subrepository references in the
share source. Previously shared repositories with cloned subrepositories
will continue to function unchanged.
2017-10-16 05:48:02 +03:00
|
|
|
$ find ../shared/* | sort
|
|
|
|
../shared/subrepo-1
|
|
|
|
../shared/subrepo-1/.hg
|
|
|
|
../shared/subrepo-1/.hg/cache
|
|
|
|
../shared/subrepo-1/.hg/cache/storehash
|
|
|
|
../shared/subrepo-1/.hg/cache/storehash/* (glob)
|
|
|
|
../shared/subrepo-1/.hg/hgrc
|
|
|
|
../shared/subrepo-1/.hg/requires
|
|
|
|
../shared/subrepo-1/.hg/sharedpath
|
|
|
|
../shared/subrepo-2
|
|
|
|
../shared/subrepo-2/.hg
|
|
|
|
../shared/subrepo-2/.hg/branch
|
|
|
|
../shared/subrepo-2/.hg/cache
|
|
|
|
../shared/subrepo-2/.hg/cache/checkisexec (execbit !)
|
|
|
|
../shared/subrepo-2/.hg/cache/checklink (symlink !)
|
|
|
|
../shared/subrepo-2/.hg/cache/checklink-target (symlink !)
|
|
|
|
../shared/subrepo-2/.hg/cache/storehash
|
|
|
|
../shared/subrepo-2/.hg/cache/storehash/* (glob)
|
|
|
|
../shared/subrepo-2/.hg/dirstate
|
|
|
|
../shared/subrepo-2/.hg/hgrc
|
|
|
|
../shared/subrepo-2/.hg/requires
|
|
|
|
../shared/subrepo-2/.hg/sharedpath
|
|
|
|
../shared/subrepo-2/file
|
subrepo: use sharepath if available when locating the source repo
This is an alternative fix for issue3518, enabling sharing of repositories with
subrepos, without unconditionally setting the default path in the resulting
repo's hgrc file. Better test coverage is added here, but won't prove this code
is working until f48752441ca0 is backed out.
The problem with the original fix is, if a default path is not available to be
copied over from the share source, the default path on the resulting repo is set
to the source location. Since that's where the actual repository is stored, the
path is essentially self-referential, so push, pull, incoming and outgoing
effectively operate on itself. While incoming and outgoing make it look like
nothing was changed, push currently hangs (see issue3657). In this case where
there is not a real default path, these operations should abort with
"default(-push) not found", like the source repo would. Note this problem with
the original fix affected repos without subrepos too.
2012-11-28 05:56:27 +04:00
|
|
|
$ hg -R ../shared in
|
2012-11-28 06:31:59 +04:00
|
|
|
abort: repository default not found!
|
|
|
|
[255]
|
subrepo: use sharepath if available when locating the source repo
This is an alternative fix for issue3518, enabling sharing of repositories with
subrepos, without unconditionally setting the default path in the resulting
repo's hgrc file. Better test coverage is added here, but won't prove this code
is working until f48752441ca0 is backed out.
The problem with the original fix is, if a default path is not available to be
copied over from the share source, the default path on the resulting repo is set
to the source location. Since that's where the actual repository is stored, the
path is essentially self-referential, so push, pull, incoming and outgoing
effectively operate on itself. While incoming and outgoing make it look like
nothing was changed, push currently hangs (see issue3657). In this case where
there is not a real default path, these operations should abort with
"default(-push) not found", like the source repo would. Note this problem with
the original fix affected repos without subrepos too.
2012-11-28 05:56:27 +04:00
|
|
|
$ hg -R ../shared/subrepo-2 showconfig paths
|
|
|
|
paths.default=$TESTTMP/subrepo-status/subrepo-2
|
|
|
|
$ hg -R ../shared/subrepo-1 sum --remote
|
|
|
|
parent: -1:000000000000 tip (empty repository)
|
|
|
|
branch: default
|
|
|
|
commit: (clean)
|
|
|
|
update: (current)
|
|
|
|
remote: (synced)
|
2012-10-27 14:38:59 +04:00
|
|
|
|
2011-01-31 15:33:41 +03:00
|
|
|
Check hg update --clean
|
2012-06-11 03:38:32 +04:00
|
|
|
$ cd $TESTTMP/t
|
2011-01-31 15:33:41 +03:00
|
|
|
$ rm -r t/t.orig
|
|
|
|
$ hg status -S --all
|
|
|
|
C .hgsub
|
|
|
|
C .hgsubstate
|
|
|
|
C a
|
|
|
|
C s/.hgsub
|
|
|
|
C s/.hgsubstate
|
|
|
|
C s/a
|
|
|
|
C s/ss/a
|
|
|
|
C t/t
|
|
|
|
$ echo c1 > s/a
|
|
|
|
$ cd s
|
|
|
|
$ echo c1 > b
|
|
|
|
$ echo c1 > c
|
|
|
|
$ hg add b
|
|
|
|
$ cd ..
|
|
|
|
$ hg status -S
|
|
|
|
M s/a
|
|
|
|
A s/b
|
|
|
|
? s/c
|
|
|
|
$ hg update -C
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2017-06-06 19:47:39 +03:00
|
|
|
updated to "925c17564ef8: 13"
|
2016-02-02 17:49:02 +03:00
|
|
|
2 other heads for branch "default"
|
2011-01-31 15:33:41 +03:00
|
|
|
$ hg status -S
|
|
|
|
? s/b
|
|
|
|
? s/c
|
2011-02-09 12:53:09 +03:00
|
|
|
|
|
|
|
Sticky subrepositories, no changes
|
2012-06-11 03:38:32 +04:00
|
|
|
$ cd $TESTTMP/t
|
2011-02-09 12:53:09 +03:00
|
|
|
$ hg id
|
|
|
|
925c17564ef8 tip
|
|
|
|
$ hg -R s id
|
|
|
|
12a213df6fa9 tip
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
52c0adc0515a tip
|
|
|
|
$ hg update 11
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg id
|
|
|
|
365661e5936a
|
|
|
|
$ hg -R s id
|
|
|
|
fc627a69481f
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
e95bcfa18a35
|
|
|
|
|
2014-04-13 21:01:00 +04:00
|
|
|
Sticky subrepositories, file changes
|
2011-02-09 12:53:09 +03:00
|
|
|
$ touch s/f1
|
|
|
|
$ touch t/f1
|
|
|
|
$ hg add -S s/f1
|
|
|
|
$ hg add -S t/f1
|
|
|
|
$ hg id
|
2012-07-27 15:56:19 +04:00
|
|
|
365661e5936a+
|
2011-02-09 12:53:09 +03:00
|
|
|
$ hg -R s id
|
|
|
|
fc627a69481f+
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
e95bcfa18a35+
|
|
|
|
$ hg update tip
|
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 02:38:28 +04:00
|
|
|
subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
|
2016-10-08 11:25:28 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
|
2011-02-09 12:53:09 +03:00
|
|
|
subrepository sources for s differ
|
2014-10-01 03:08:17 +04:00
|
|
|
use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l
|
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 02:38:28 +04:00
|
|
|
subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
|
2016-10-08 11:25:28 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
|
2011-02-09 12:53:09 +03:00
|
|
|
subrepository sources for t differ
|
2014-10-01 03:08:17 +04:00
|
|
|
use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l
|
2011-02-09 12:53:09 +03:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg id
|
|
|
|
925c17564ef8+ tip
|
|
|
|
$ hg -R s id
|
|
|
|
fc627a69481f+
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
e95bcfa18a35+
|
|
|
|
$ hg update --clean tip
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
Sticky subrepository, revision updates
|
|
|
|
$ hg id
|
|
|
|
925c17564ef8 tip
|
|
|
|
$ hg -R s id
|
|
|
|
12a213df6fa9 tip
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
52c0adc0515a tip
|
|
|
|
$ cd s
|
|
|
|
$ hg update -r -2
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd ../t
|
|
|
|
$ hg update -r 2
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd ..
|
|
|
|
$ hg update 10
|
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 02:38:28 +04:00
|
|
|
subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
|
2016-10-08 11:25:28 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
|
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 02:38:28 +04:00
|
|
|
subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
|
2016-10-08 11:25:28 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
|
2011-02-09 12:53:09 +03:00
|
|
|
subrepository sources for t differ (in checked out version)
|
2014-10-01 03:08:17 +04:00
|
|
|
use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l
|
2011-02-09 12:53:09 +03:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg id
|
|
|
|
e45c8b14af55+
|
|
|
|
$ hg -R s id
|
2012-07-27 15:56:19 +04:00
|
|
|
02dcf1d70411
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
7af322bc1198
|
|
|
|
|
|
|
|
Sticky subrepository, file changes and revision updates
|
|
|
|
$ touch s/f1
|
|
|
|
$ touch t/f1
|
|
|
|
$ hg add -S s/f1
|
|
|
|
$ hg add -S t/f1
|
|
|
|
$ hg id
|
|
|
|
e45c8b14af55+
|
|
|
|
$ hg -R s id
|
2012-07-27 15:56:19 +04:00
|
|
|
02dcf1d70411+
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
7af322bc1198+
|
|
|
|
$ hg update tip
|
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 02:38:28 +04:00
|
|
|
subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
|
2016-10-08 11:25:28 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
|
2011-02-09 12:53:09 +03:00
|
|
|
subrepository sources for s differ
|
2014-10-01 03:08:17 +04:00
|
|
|
use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l
|
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 02:38:28 +04:00
|
|
|
subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
|
2016-10-08 11:25:28 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
|
2011-02-09 12:53:09 +03:00
|
|
|
subrepository sources for t differ
|
2014-10-01 03:08:17 +04:00
|
|
|
use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l
|
2011-02-09 12:53:09 +03:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg id
|
2012-07-27 15:56:19 +04:00
|
|
|
925c17564ef8+ tip
|
2011-02-09 12:53:09 +03:00
|
|
|
$ hg -R s id
|
2012-07-27 15:56:19 +04:00
|
|
|
02dcf1d70411+
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
7af322bc1198+
|
|
|
|
|
|
|
|
Sticky repository, update --clean
|
|
|
|
$ hg update --clean tip
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg id
|
|
|
|
925c17564ef8 tip
|
|
|
|
$ hg -R s id
|
|
|
|
12a213df6fa9 tip
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
52c0adc0515a tip
|
|
|
|
|
|
|
|
Test subrepo already at intended revision:
|
|
|
|
$ cd s
|
|
|
|
$ hg update fc627a69481f
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd ..
|
|
|
|
$ hg update 11
|
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 02:38:28 +04:00
|
|
|
subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
|
2016-10-08 11:25:28 +03:00
|
|
|
(M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
|
2011-02-09 12:53:09 +03:00
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg id -n
|
|
|
|
11+
|
|
|
|
$ hg -R s id
|
|
|
|
fc627a69481f
|
2012-08-08 20:10:16 +04:00
|
|
|
$ hg -R t id
|
2011-02-09 12:53:09 +03:00
|
|
|
e95bcfa18a35
|
2011-06-07 00:17:40 +04:00
|
|
|
|
|
|
|
Test that removing .hgsubstate doesn't break anything:
|
|
|
|
|
|
|
|
$ hg rm -f .hgsubstate
|
|
|
|
$ hg ci -mrm
|
2012-02-07 01:10:01 +04:00
|
|
|
nothing changed
|
|
|
|
[1]
|
2011-06-07 00:17:40 +04:00
|
|
|
$ hg log -vr tip
|
2012-02-07 01:10:01 +04:00
|
|
|
changeset: 13:925c17564ef8
|
2011-06-07 00:17:40 +04:00
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
2012-02-07 01:10:01 +04:00
|
|
|
files: .hgsubstate
|
2011-06-07 00:17:40 +04:00
|
|
|
description:
|
2012-02-07 01:10:01 +04:00
|
|
|
13
|
2011-06-07 00:17:40 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Test that removing .hgsub removes .hgsubstate:
|
|
|
|
|
|
|
|
$ hg rm .hgsub
|
|
|
|
$ hg ci -mrm2
|
|
|
|
$ hg log -vr tip
|
2012-02-07 01:10:01 +04:00
|
|
|
changeset: 14:2400bccd50af
|
2011-06-07 00:17:40 +04:00
|
|
|
tag: tip
|
2012-02-07 01:10:01 +04:00
|
|
|
parent: 11:365661e5936a
|
2011-06-07 00:17:40 +04:00
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
files: .hgsub .hgsubstate
|
|
|
|
description:
|
|
|
|
rm2
|
|
|
|
|
|
|
|
|
2011-12-15 19:18:10 +04:00
|
|
|
Test issue3153: diff -S with deleted subrepos
|
|
|
|
|
|
|
|
$ hg diff --nodates -S -c .
|
2012-02-07 01:10:01 +04:00
|
|
|
diff -r 365661e5936a -r 2400bccd50af .hgsub
|
2011-12-15 19:18:10 +04:00
|
|
|
--- a/.hgsub
|
|
|
|
+++ /dev/null
|
|
|
|
@@ -1,2 +0,0 @@
|
|
|
|
-s = s
|
|
|
|
-t = t
|
2012-02-07 01:10:01 +04:00
|
|
|
diff -r 365661e5936a -r 2400bccd50af .hgsubstate
|
2011-12-15 19:18:10 +04:00
|
|
|
--- a/.hgsubstate
|
|
|
|
+++ /dev/null
|
|
|
|
@@ -1,2 +0,0 @@
|
|
|
|
-fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
|
|
|
|
-e95bcfa18a358dc4936da981ebf4147b4cad1362 t
|
2011-12-15 19:26:33 +04:00
|
|
|
|
2011-11-02 07:53:29 +04:00
|
|
|
Test behavior of add for explicit path in subrepo:
|
|
|
|
$ cd ..
|
2011-11-10 04:46:49 +04:00
|
|
|
$ hg init explicit
|
|
|
|
$ cd explicit
|
2011-11-02 07:53:29 +04:00
|
|
|
$ echo s = s > .hgsub
|
|
|
|
$ hg add .hgsub
|
|
|
|
$ hg init s
|
|
|
|
$ hg ci -m0
|
2011-11-02 09:17:11 +04:00
|
|
|
Adding with an explicit path in a subrepo adds the file
|
2011-11-02 07:53:29 +04:00
|
|
|
$ echo c1 > f1
|
|
|
|
$ echo c2 > s/f2
|
|
|
|
$ hg st -S
|
|
|
|
? f1
|
|
|
|
? s/f2
|
|
|
|
$ hg add s/f2
|
|
|
|
$ hg st -S
|
2011-11-02 09:17:11 +04:00
|
|
|
A s/f2
|
2011-11-02 07:53:29 +04:00
|
|
|
? f1
|
2011-11-02 09:17:11 +04:00
|
|
|
$ hg ci -R s -m0
|
2011-11-02 07:53:29 +04:00
|
|
|
$ hg ci -Am1
|
|
|
|
adding f1
|
2011-11-02 09:17:11 +04:00
|
|
|
Adding with an explicit path in a subrepo with -S has the same behavior
|
2011-11-02 07:53:29 +04:00
|
|
|
$ echo c3 > f3
|
|
|
|
$ echo c4 > s/f4
|
|
|
|
$ hg st -S
|
|
|
|
? f3
|
|
|
|
? s/f4
|
|
|
|
$ hg add -S s/f4
|
|
|
|
$ hg st -S
|
|
|
|
A s/f4
|
|
|
|
? f3
|
|
|
|
$ hg ci -R s -m1
|
|
|
|
$ hg ci -Ama2
|
|
|
|
adding f3
|
|
|
|
Adding without a path or pattern silently ignores subrepos
|
|
|
|
$ echo c5 > f5
|
|
|
|
$ echo c6 > s/f6
|
|
|
|
$ echo c7 > s/f7
|
|
|
|
$ hg st -S
|
|
|
|
? f5
|
|
|
|
? s/f6
|
|
|
|
? s/f7
|
|
|
|
$ hg add
|
|
|
|
adding f5
|
|
|
|
$ hg st -S
|
|
|
|
A f5
|
|
|
|
? s/f6
|
|
|
|
? s/f7
|
|
|
|
$ hg ci -R s -Am2
|
|
|
|
adding f6
|
|
|
|
adding f7
|
|
|
|
$ hg ci -m3
|
|
|
|
Adding without a path or pattern with -S also adds files in subrepos
|
|
|
|
$ echo c8 > f8
|
|
|
|
$ echo c9 > s/f9
|
|
|
|
$ echo c10 > s/f10
|
|
|
|
$ hg st -S
|
|
|
|
? f8
|
|
|
|
? s/f10
|
|
|
|
? s/f9
|
|
|
|
$ hg add -S
|
|
|
|
adding f8
|
2017-12-11 06:50:57 +03:00
|
|
|
adding s/f10
|
|
|
|
adding s/f9
|
2011-11-02 07:53:29 +04:00
|
|
|
$ hg st -S
|
|
|
|
A f8
|
|
|
|
A s/f10
|
|
|
|
A s/f9
|
|
|
|
$ hg ci -R s -m3
|
|
|
|
$ hg ci -m4
|
|
|
|
Adding with a pattern silently ignores subrepos
|
|
|
|
$ echo c11 > fm11
|
|
|
|
$ echo c12 > fn12
|
|
|
|
$ echo c13 > s/fm13
|
|
|
|
$ echo c14 > s/fn14
|
|
|
|
$ hg st -S
|
|
|
|
? fm11
|
|
|
|
? fn12
|
|
|
|
? s/fm13
|
|
|
|
? s/fn14
|
|
|
|
$ hg add 'glob:**fm*'
|
|
|
|
adding fm11
|
|
|
|
$ hg st -S
|
|
|
|
A fm11
|
|
|
|
? fn12
|
|
|
|
? s/fm13
|
|
|
|
? s/fn14
|
|
|
|
$ hg ci -R s -Am4
|
|
|
|
adding fm13
|
|
|
|
adding fn14
|
|
|
|
$ hg ci -Am5
|
|
|
|
adding fn12
|
|
|
|
Adding with a pattern with -S also adds matches in subrepos
|
|
|
|
$ echo c15 > fm15
|
|
|
|
$ echo c16 > fn16
|
|
|
|
$ echo c17 > s/fm17
|
|
|
|
$ echo c18 > s/fn18
|
|
|
|
$ hg st -S
|
|
|
|
? fm15
|
|
|
|
? fn16
|
|
|
|
? s/fm17
|
|
|
|
? s/fn18
|
|
|
|
$ hg add -S 'glob:**fm*'
|
|
|
|
adding fm15
|
2017-12-11 06:50:57 +03:00
|
|
|
adding s/fm17
|
2011-11-02 07:53:29 +04:00
|
|
|
$ hg st -S
|
|
|
|
A fm15
|
|
|
|
A s/fm17
|
|
|
|
? fn16
|
|
|
|
? s/fn18
|
|
|
|
$ hg ci -R s -Am5
|
|
|
|
adding fn18
|
|
|
|
$ hg ci -Am6
|
|
|
|
adding fn16
|
2011-11-10 04:46:49 +04:00
|
|
|
|
|
|
|
Test behavior of forget for explicit path in subrepo:
|
2011-11-10 04:46:51 +04:00
|
|
|
Forgetting an explicit path in a subrepo untracks the file
|
2011-11-10 04:46:49 +04:00
|
|
|
$ echo c19 > s/f19
|
|
|
|
$ hg add s/f19
|
|
|
|
$ hg st -S
|
|
|
|
A s/f19
|
|
|
|
$ hg forget s/f19
|
2011-11-10 04:46:51 +04:00
|
|
|
$ hg st -S
|
|
|
|
? s/f19
|
2011-11-10 04:46:49 +04:00
|
|
|
$ rm s/f19
|
2012-06-11 03:38:32 +04:00
|
|
|
$ cd ..
|
2013-01-31 04:44:29 +04:00
|
|
|
|
|
|
|
Courtesy phases synchronisation to publishing server does not block the push
|
|
|
|
(issue3781)
|
|
|
|
|
2016-11-30 22:25:18 +03:00
|
|
|
$ cp -R main issue3781
|
|
|
|
$ cp -R main issue3781-dest
|
2013-01-31 04:44:29 +04:00
|
|
|
$ cd issue3781-dest/s
|
|
|
|
$ hg phase tip # show we have draft changeset
|
|
|
|
5: draft
|
|
|
|
$ chmod a-w .hg/store/phaseroots # prevent phase push
|
|
|
|
$ cd ../../issue3781
|
|
|
|
$ cat >> .hg/hgrc << EOF
|
|
|
|
> [paths]
|
|
|
|
> default=../issue3781-dest/
|
|
|
|
> EOF
|
2016-08-03 16:39:55 +03:00
|
|
|
$ hg push --config devel.legacy.exchange=bundle1
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/issue3781-dest
|
2015-05-27 16:08:14 +03:00
|
|
|
pushing subrepo s to $TESTTMP/issue3781-dest/s
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
|
|
|
# clean the push cache
|
|
|
|
$ rm s/.hg/cache/storehash/*
|
2016-08-03 16:52:11 +03:00
|
|
|
$ hg push # bundle2+
|
2017-12-11 06:50:57 +03:00
|
|
|
pushing to $TESTTMP/issue3781-dest
|
2013-01-31 04:44:29 +04:00
|
|
|
pushing subrepo s to $TESTTMP/issue3781-dest/s
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
[1]
|
2013-11-13 10:55:30 +04:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
Test phase choice for newly created commit with "phases.subrepochecks"
|
|
|
|
configuration
|
|
|
|
|
|
|
|
$ cd t
|
|
|
|
$ hg update -q -r 12
|
|
|
|
|
|
|
|
$ cat >> s/ss/.hg/hgrc <<EOF
|
|
|
|
> [phases]
|
|
|
|
> new-commit = secret
|
|
|
|
> EOF
|
|
|
|
$ cat >> s/.hg/hgrc <<EOF
|
|
|
|
> [phases]
|
|
|
|
> new-commit = draft
|
|
|
|
> EOF
|
|
|
|
$ echo phasecheck1 >> s/ss/a
|
|
|
|
$ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
|
|
|
|
committing subrepository ss
|
|
|
|
transaction abort!
|
|
|
|
rollback completed
|
|
|
|
abort: can't commit in draft phase conflicting secret from subrepository ss
|
|
|
|
[255]
|
|
|
|
$ echo phasecheck2 >> s/ss/a
|
|
|
|
$ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
|
|
|
|
committing subrepository ss
|
|
|
|
$ hg -R s/ss phase tip
|
|
|
|
3: secret
|
|
|
|
$ hg -R s phase tip
|
|
|
|
6: draft
|
|
|
|
$ echo phasecheck3 >> s/ss/a
|
|
|
|
$ hg -R s commit -S -m phasecheck3
|
|
|
|
committing subrepository ss
|
|
|
|
warning: changes are committed in secret phase from subrepository ss
|
|
|
|
$ hg -R s/ss phase tip
|
|
|
|
4: secret
|
|
|
|
$ hg -R s phase tip
|
|
|
|
7: secret
|
|
|
|
|
|
|
|
$ cat >> t/.hg/hgrc <<EOF
|
|
|
|
> [phases]
|
|
|
|
> new-commit = draft
|
|
|
|
> EOF
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [phases]
|
|
|
|
> new-commit = public
|
|
|
|
> EOF
|
|
|
|
$ echo phasecheck4 >> s/ss/a
|
|
|
|
$ echo phasecheck4 >> t/t
|
|
|
|
$ hg commit -S -m phasecheck4
|
|
|
|
committing subrepository s
|
2017-12-11 06:50:57 +03:00
|
|
|
committing subrepository s/ss
|
2013-11-13 10:55:30 +04:00
|
|
|
warning: changes are committed in secret phase from subrepository ss
|
|
|
|
committing subrepository t
|
|
|
|
warning: changes are committed in secret phase from subrepository s
|
|
|
|
$ hg -R s/ss phase tip
|
|
|
|
5: secret
|
|
|
|
$ hg -R s phase tip
|
|
|
|
8: secret
|
|
|
|
$ hg -R t phase tip
|
|
|
|
6: draft
|
|
|
|
$ hg phase tip
|
|
|
|
15: secret
|
2013-01-31 04:44:29 +04:00
|
|
|
|
2013-11-13 10:55:30 +04:00
|
|
|
$ cd ..
|
2014-03-17 22:57:13 +04:00
|
|
|
|
|
|
|
|
2014-04-13 21:01:00 +04:00
|
|
|
Test that commit --secret works on both repo and subrepo (issue4182)
|
2014-03-17 22:57:13 +04:00
|
|
|
|
|
|
|
$ cd main
|
|
|
|
$ echo secret >> b
|
|
|
|
$ echo secret >> s/b
|
|
|
|
$ hg commit --secret --subrepo -m "secret"
|
|
|
|
committing subrepository s
|
|
|
|
$ hg phase -r .
|
|
|
|
6: secret
|
|
|
|
$ cd s
|
|
|
|
$ hg phase -r .
|
|
|
|
6: secret
|
|
|
|
$ cd ../../
|
2014-06-19 19:41:31 +04:00
|
|
|
|
2014-07-15 18:34:13 +04:00
|
|
|
Test "subrepos" template keyword
|
|
|
|
|
|
|
|
$ cd t
|
|
|
|
$ hg update -q 15
|
|
|
|
$ cat > .hgsub <<EOF
|
|
|
|
> s = s
|
|
|
|
> EOF
|
|
|
|
$ hg commit -m "16"
|
|
|
|
warning: changes are committed in secret phase from subrepository s
|
|
|
|
|
|
|
|
(addition of ".hgsub" itself)
|
|
|
|
|
|
|
|
$ hg diff --nodates -c 1 .hgsubstate
|
|
|
|
diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/.hgsubstate
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
$ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
|
|
|
|
f7b1eb17ad24 000000000000
|
|
|
|
s
|
|
|
|
|
|
|
|
(modification of existing entry)
|
|
|
|
|
|
|
|
$ hg diff --nodates -c 2 .hgsubstate
|
|
|
|
diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
|
|
|
|
--- a/.hgsubstate
|
|
|
|
+++ b/.hgsubstate
|
|
|
|
@@ -1,1 +1,1 @@
|
|
|
|
-e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
+dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
|
|
|
|
$ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
|
|
|
|
7cf8cfea66e4 000000000000
|
|
|
|
s
|
|
|
|
|
|
|
|
(addition of entry)
|
|
|
|
|
|
|
|
$ hg diff --nodates -c 5 .hgsubstate
|
|
|
|
diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
|
|
|
|
--- a/.hgsubstate
|
|
|
|
+++ b/.hgsubstate
|
|
|
|
@@ -1,1 +1,2 @@
|
|
|
|
e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
+60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
|
|
|
|
$ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
|
|
|
|
7cf8cfea66e4 000000000000
|
|
|
|
t
|
|
|
|
|
|
|
|
(removal of existing entry)
|
|
|
|
|
|
|
|
$ hg diff --nodates -c 16 .hgsubstate
|
|
|
|
diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
|
|
|
|
--- a/.hgsubstate
|
|
|
|
+++ b/.hgsubstate
|
|
|
|
@@ -1,2 +1,1 @@
|
|
|
|
0731af8ca9423976d3743119d0865097c07bdc1b s
|
|
|
|
-e202dc79b04c88a636ea8913d9182a1346d9b3dc t
|
|
|
|
$ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
|
|
|
|
8bec38d2bd0b 000000000000
|
|
|
|
t
|
|
|
|
|
|
|
|
(merging)
|
|
|
|
|
|
|
|
$ hg diff --nodates -c 9 .hgsubstate
|
|
|
|
diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
|
|
|
|
--- a/.hgsubstate
|
|
|
|
+++ b/.hgsubstate
|
|
|
|
@@ -1,1 +1,2 @@
|
|
|
|
fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
|
|
|
|
+60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
|
|
|
|
$ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
|
|
|
|
f6affe3fbfaa 1f14a2e2d3ec
|
|
|
|
t
|
|
|
|
|
|
|
|
(removal of ".hgsub" itself)
|
|
|
|
|
|
|
|
$ hg diff --nodates -c 8 .hgsubstate
|
|
|
|
diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
|
|
|
|
--- a/.hgsubstate
|
|
|
|
+++ /dev/null
|
|
|
|
@@ -1,2 +0,0 @@
|
|
|
|
-e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
|
|
|
|
-7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
|
|
|
|
$ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
|
|
|
|
f94576341bcf 000000000000
|
|
|
|
|
2014-06-19 19:41:31 +04:00
|
|
|
Test that '[paths]' is configured correctly at subrepo creation
|
|
|
|
|
|
|
|
$ cd $TESTTMP/tc
|
|
|
|
$ cat > .hgsub <<EOF
|
|
|
|
> # to clear bogus subrepo path 'bogus=[boguspath'
|
|
|
|
> s = s
|
|
|
|
> t = t
|
|
|
|
> EOF
|
|
|
|
$ hg update -q --clean null
|
|
|
|
$ rm -rf s t
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [paths]
|
|
|
|
> default-push = /foo/bar
|
|
|
|
> EOF
|
|
|
|
$ hg update -q
|
|
|
|
$ cat s/.hg/hgrc
|
|
|
|
[paths]
|
|
|
|
default = $TESTTMP/t/s
|
|
|
|
default-push = /foo/bar/s
|
|
|
|
$ cat s/ss/.hg/hgrc
|
|
|
|
[paths]
|
|
|
|
default = $TESTTMP/t/s/ss
|
|
|
|
default-push = /foo/bar/s/ss
|
|
|
|
$ cat t/.hg/hgrc
|
|
|
|
[paths]
|
|
|
|
default = $TESTTMP/t/t
|
|
|
|
default-push = /foo/bar/t
|
scmutil: consistently return subrepos relative to ctx1 from itersubrepos()
Previously, if a subrepo was added in ctx2 and then compared to another without
it (ctx1), the subrepo for ctx2 was returned amongst all of the ctx1 based
subrepos, since no subrepo exists in ctx1 to replace it in the 'subpaths' dict.
The two callers of this, basectx.status() and cmdutil.diffordiffstat(), both
compare the yielded subrepo against ctx2, and thus saw no changes when ctx2's
subrepo was returned. The tests here previously didn't mention 's/a' for the
'p1()' case.
This appears to have been a known issue, because some diffordiffstat() comments
mention that the subpath disappeared, and "the best we can do is ignore it". I
originally ran into the issue with some custom convert code to flatten a tree of
subrepos causing hg.putcommit() to abort, but this new behavior seems like the
correct status and diff behavior regardless. (The abort in convert isn't
something users will see, because convert doesn't currently support subrepos in
the official repo.)
2015-06-03 21:21:15 +03:00
|
|
|
|
|
|
|
$ cd $TESTTMP/t
|
|
|
|
$ hg up -qC 0
|
|
|
|
$ echo 'bar' > bar.txt
|
|
|
|
$ hg ci -Am 'branch before subrepo add'
|
|
|
|
adding bar.txt
|
|
|
|
$ hg merge -r "first(subrepo('s'))"
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
(branch merge, don't forget to commit)
|
|
|
|
$ hg status -S -X '.hgsub*'
|
|
|
|
A s/a
|
|
|
|
? s/b
|
|
|
|
? s/c
|
|
|
|
? s/f1
|
|
|
|
$ hg status -S --rev 'p2()'
|
|
|
|
A bar.txt
|
|
|
|
? s/b
|
|
|
|
? s/c
|
|
|
|
? s/f1
|
|
|
|
$ hg diff -S -X '.hgsub*' --nodates
|
|
|
|
diff -r 000000000000 s/a
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/s/a
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+a
|
|
|
|
$ hg diff -S --rev 'p2()' --nodates
|
|
|
|
diff -r 7cf8cfea66e4 bar.txt
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/bar.txt
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+bar
|
|
|
|
|
2014-06-19 19:41:31 +04:00
|
|
|
$ cd ..
|
2017-08-01 02:04:44 +03:00
|
|
|
|
|
|
|
test for ssh exploit 2017-07-25
|
|
|
|
|
2017-08-07 16:22:28 +03:00
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [ui]
|
|
|
|
> ssh = sh -c "read l; read l; read l"
|
|
|
|
> EOF
|
|
|
|
|
2017-08-01 02:04:44 +03:00
|
|
|
$ hg init malicious-proxycommand
|
|
|
|
$ cd malicious-proxycommand
|
|
|
|
$ echo 's = [hg]ssh://-oProxyCommand=touch${IFS}owned/path' > .hgsub
|
|
|
|
$ hg init s
|
|
|
|
$ cd s
|
|
|
|
$ echo init > init
|
|
|
|
$ hg add
|
|
|
|
adding init
|
|
|
|
$ hg commit -m init
|
|
|
|
$ cd ..
|
|
|
|
$ hg add .hgsub
|
|
|
|
$ hg ci -m 'add subrepo'
|
|
|
|
$ cd ..
|
|
|
|
$ hg clone malicious-proxycommand malicious-proxycommand-clone
|
|
|
|
updating to branch default
|
|
|
|
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
|
|
|
|
[255]
|
|
|
|
|
|
|
|
also check that a percent encoded '-' (%2D) doesn't work
|
|
|
|
|
|
|
|
$ cd malicious-proxycommand
|
|
|
|
$ echo 's = [hg]ssh://%2DoProxyCommand=touch${IFS}owned/path' > .hgsub
|
|
|
|
$ hg ci -m 'change url to percent encoded'
|
|
|
|
$ cd ..
|
|
|
|
$ rm -r malicious-proxycommand-clone
|
|
|
|
$ hg clone malicious-proxycommand malicious-proxycommand-clone
|
|
|
|
updating to branch default
|
|
|
|
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' (in subrepository "s")
|
|
|
|
[255]
|
|
|
|
|
|
|
|
also check for a pipe
|
|
|
|
|
|
|
|
$ cd malicious-proxycommand
|
2017-08-07 16:22:28 +03:00
|
|
|
$ echo 's = [hg]ssh://fakehost|touch${IFS}owned/path' > .hgsub
|
2017-08-01 02:04:44 +03:00
|
|
|
$ hg ci -m 'change url to pipe'
|
|
|
|
$ cd ..
|
|
|
|
$ rm -r malicious-proxycommand-clone
|
|
|
|
$ hg clone malicious-proxycommand malicious-proxycommand-clone
|
|
|
|
updating to branch default
|
2017-08-07 16:22:28 +03:00
|
|
|
abort: no suitable response from remote hg!
|
2017-08-01 02:04:44 +03:00
|
|
|
[255]
|
2017-08-07 16:22:28 +03:00
|
|
|
$ [ ! -f owned ] || echo 'you got owned'
|
2017-08-01 02:04:44 +03:00
|
|
|
|
|
|
|
also check that a percent encoded '|' (%7C) doesn't work
|
|
|
|
|
|
|
|
$ cd malicious-proxycommand
|
2017-08-07 16:22:28 +03:00
|
|
|
$ echo 's = [hg]ssh://fakehost%7Ctouch%20owned/path' > .hgsub
|
2017-08-01 02:04:44 +03:00
|
|
|
$ hg ci -m 'change url to percent encoded pipe'
|
|
|
|
$ cd ..
|
|
|
|
$ rm -r malicious-proxycommand-clone
|
|
|
|
$ hg clone malicious-proxycommand malicious-proxycommand-clone
|
|
|
|
updating to branch default
|
2017-08-07 16:22:28 +03:00
|
|
|
abort: no suitable response from remote hg!
|
2017-08-01 02:04:44 +03:00
|
|
|
[255]
|
2017-08-07 16:22:28 +03:00
|
|
|
$ [ ! -f owned ] || echo 'you got owned'
|
2017-08-01 02:04:44 +03:00
|
|
|
|
|
|
|
and bad usernames:
|
|
|
|
$ cd malicious-proxycommand
|
|
|
|
$ echo 's = [hg]ssh://-oProxyCommand=touch owned@example.com/path' > .hgsub
|
|
|
|
$ hg ci -m 'owned username'
|
|
|
|
$ cd ..
|
|
|
|
$ rm -r malicious-proxycommand-clone
|
|
|
|
$ hg clone malicious-proxycommand malicious-proxycommand-clone
|
|
|
|
updating to branch default
|
|
|
|
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned@example.com/path' (in subrepository "s")
|
|
|
|
[255]
|