Issue2022

Title subrepos update : main repo update doesn't update nested repo
Priority urgent Status resolved
Superseder Nosy List ArneBab, SaintGermain, ThomasAH, hgbot, kiilerix
Assigned To Topics subrepositories diff

Created on 2010-02-04.17:35:57 by SaintGermain, last changed 2010-07-23.18:40:45 by mpm.

Files
File name Uploaded Type Edit Remove
merge.patch SaintGermain, 2010-02-06.13:33:48 text/x-diff
Messages
msg12970 (view) Author: hgbot Date: 2010-07-01.21:00:07
Fixed by http://hg.intevation.org/mercurial/crew/rev/34e33d50c26b
(subrepo: correctly handle update -C with modified subrepos (issue2022))
msg12698 (view) Author: ArneBab Date: 2010-05-27.09:08:05
Likely related: Issue2217: http://mercurial.selenic.com/bts/issue2217 
‘subrepo “unknown revision” when updating with changes in sub’

The .hgsubstate gets merged with the update instead of merging the
subrepository changes.
msg11959 (view) Author: ThomasAH Date: 2010-03-09.09:06:13
The patch is not yet in main or crew, so removing testing
msg11616 (view) Author: SaintGermain Date: 2010-02-06.13:33:48
Hello,

I think that solve the 'update' issue in case of 'overwrite' (with -C flag).
could it be included in the next release ?

--- merge.py.old	2010-02-06 14:29:13.000000000 +0100
+++ merge.py	2010-02-06 14:31:00.000000000 +0100
@@ -184,6 +184,12 @@
             if n == m2[f] or m2[f] == a: # same or local newer
                 if m1.flags(f) != rflags:
                     act("update permissions", "e", f, rflags)
+                # in case of subrepos, update if overwrite and subrepos is
dirty
+                if overwrite and f == '.hgsubstate':
+                    for s in p1.substate:
+                        if p1.sub(s).dirty(): # if dirty, force update
+                            act("remote is newer", "g", f, rflags)
+                            break
             elif n == a: # remote newer
                 act("remote is newer", "g", f, rflags)
             else: # both changed
msg11604 (view) Author: SaintGermain Date: 2010-02-04.19:31:54
Just tried with Mercurial version 1.4.3, same problem.

Although main repo update doesn't trigger subrepos update, it automatically
trigger merge ! I don't think that it is a desired feature.

Test case:
hg init main
cd main
hg init nested
echo test > nested/foo
hg -R nested add nested/foo
echo nested = nested > .hgsub
hg add .hgsub
hg ci -mtest
cd ..
hg clone main main2
cd main
echo modification > nested/foo
hg ci -mmodif
cd ..
cd main2
echo modification2 > nested/foo
hg -R nested commit -mmodif2
hg pull ../main
hg update
msg11602 (view) Author: SaintGermain Date: 2010-02-04.18:01:05
Forgot to note that test was done on Mercurial 1.4.2 on SUSE Linux
Enterprise Server 10.2
msg11601 (view) Author: SaintGermain Date: 2010-02-04.17:35:57
While using subrepositories, it seems that updating the main repository
doesn't trigger the subrepositories updating process.

Test Case :
After a commit on the main repositories, change the subrepository and try to
update to the previous state.

hg init main
cd main
hg init nested
echo test > nested/foo
hg -R nested add nested/foo
echo nested = nested > .hgsub
hg add .hgsub
hg ci -mtest
echo modification > nested/foo
hg -R nested commit -mmodif
hg update
hg update -C -r 0

Nothing is updated.
History
Date User Action Args
2010-07-23 18:40:45mpmsetstatus: testing -> resolved
nosy: ThomasAH, kiilerix, ArneBab, SaintGermain, hgbot
2010-07-01 21:00:07hgbotsetstatus: in-progress -> testing
nosy: + hgbot
messages: + msg12970
2010-05-27 09:08:05ArneBabsetnosy: + ArneBab
messages: + msg12698
2010-03-09 09:06:13ThomasAHsetstatus: testing -> in-progress
nosy: + ThomasAH
messages: + msg11959
2010-02-06 13:33:48SaintGermainsetstatus: chatting -> testing
files: + merge.patch
messages: + msg11616
2010-02-04 22:24:31kiilerixsetnosy: + kiilerix
2010-02-04 19:31:54SaintGermainsetmessages: + msg11604
2010-02-04 18:01:05SaintGermainsetstatus: unread -> chatting
messages: + msg11602
2010-02-04 17:35:57SaintGermaincreate