##// END OF EJS Templates
subrepo: dirtiness checks should iterate over subrepos
Edouard Gomez -
r11110:22f5ad0b default
parent child Browse files
Show More
@@ -0,0 +1,57 b''
1 #!/bin/sh
2
3 echo % Preparing the subrepository 'sub2'
4 hg init sub2
5 echo sub2 > sub2/sub2
6 hg add -R sub2
7 hg commit -R sub2 -m "sub2 import"
8
9 echo % Preparing the 'sub1' repo which depends on the subrepo 'sub2'
10 hg init sub1
11 echo sub1 > sub1/sub1
12 echo "sub2 = ../sub2" > sub1/.hgsub
13 hg clone sub2 sub1/sub2 | sed 's/ .*sub/ ...sub/g'
14 hg add -R sub1
15 hg commit -R sub1 -m "sub1 import"
16
17 echo % Preparing the 'main' repo which depends on the subrepo 'sub1'
18 hg init main
19 echo main > main/main
20 echo "sub1 = ../sub1" > main/.hgsub
21 hg clone sub1 main/sub1 | sed 's/ .*sub/ ...sub/g'
22 hg add -R main
23 hg commit -R main -m "main import"
24
25 echo % Cleaning both repositories, just as a clone -U
26 hg up -C -R sub2 null
27 hg up -C -R sub1 null
28 hg up -C -R main null
29 rm -rf main/sub1
30 rm -rf sub1/sub2
31
32 echo % Clone main
33 hg clone main cloned | sed 's/ .*sub/ ...sub/g'
34
35 echo % Checking cloned repo ids
36 printf "cloned " ; hg id -R cloned
37 printf "cloned/sub1 " ; hg id -R cloned/sub1
38 printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2
39
40 echo % debugsub output for main and sub1
41 hg debugsub -R cloned
42 hg debugsub -R cloned/sub1
43
44 echo % Modifying deeply nested 'sub2'
45 echo modified > cloned/sub1/sub2/sub2
46 hg commit -m "deep nested modif should trigger a commit" -R cloned
47
48 echo % Checking modified node ids
49 printf "cloned " ; hg id -R cloned
50 printf "cloned/sub1 " ; hg id -R cloned/sub1
51 printf "cloned/sub1/sub2 " ; hg id -R cloned/sub1/sub2
52
53 echo % debugsub output for main and sub1
54 hg debugsub -R cloned
55 hg debugsub -R cloned/sub1
56
57 exit 0
@@ -0,0 +1,64 b''
1 % Preparing the subrepository sub2
2 adding sub2/sub2
3 % Preparing the sub1 repo which depends on the subrepo sub2
4 updating to branch default
5 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
6 adding sub1/.hgsub
7 adding sub1/sub1
8 committing subrepository sub2
9 % Preparing the main repo which depends on the subrepo sub1
10 updating to branch default
11 pulling ...sub2
12 requesting all changes
13 adding changesets
14 adding manifests
15 adding file changes
16 added 1 changesets with 1 changes to 1 files
17 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 adding main/.hgsub
19 adding main/main
20 committing subrepository sub1
21 % Cleaning both repositories, just as a clone -U
22 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
23 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
24 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
25 % Clone main
26 updating to branch default
27 pulling ...sub1
28 requesting all changes
29 adding changesets
30 adding manifests
31 adding file changes
32 added 1 changesets with 3 changes to 3 files
33 pulling ...sub2
34 requesting all changes
35 adding changesets
36 adding manifests
37 adding file changes
38 added 1 changesets with 1 changes to 1 files
39 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 % Checking cloned repo ids
41 cloned 7f491f53a367 tip
42 cloned/sub1 fc3b4ce2696f tip
43 cloned/sub1/sub2 c57a0840e3ba tip
44 % debugsub output for main and sub1
45 path sub1
46 source ../sub1
47 revision fc3b4ce2696f7741438c79207583768f2ce6b0dd
48 path sub2
49 source ../sub2
50 revision c57a0840e3badd667ef3c3ef65471609acb2ba3c
51 % Modifying deeply nested sub2
52 committing subrepository sub1
53 committing subrepository sub2
54 % Checking modified node ids
55 cloned ffe6649062fe tip
56 cloned/sub1 2ecb03bf44a9 tip
57 cloned/sub1/sub2 53dd3430bcaf tip
58 % debugsub output for main and sub1
59 path sub1
60 source ../sub1
61 revision 2ecb03bf44a94e749e8669481dd9069526ce7cb9
62 path sub2
63 source ../sub2
64 revision 53dd3430bcaf5ab4a7c48262bcad6d441f510487
@@ -752,7 +752,11 b' class workingctx(changectx):'
752
752
753 def dirty(self, missing=False):
753 def dirty(self, missing=False):
754 "check whether a working directory is modified"
754 "check whether a working directory is modified"
755
755 # check subrepos first
756 for s in self.substate:
757 if self.sub(s).dirty():
758 return True
759 # check current working dir
756 return (self.p2() or self.branch() != self.p1().branch() or
760 return (self.p2() or self.branch() != self.p1().branch() or
757 self.modified() or self.added() or self.removed() or
761 self.modified() or self.added() or self.removed() or
758 (missing and self.deleted()))
762 (missing and self.deleted()))
General Comments 0
You need to be logged in to leave comments. Login now