annotate tests/test-subrepo-empty-commit.t @ 13155:f02d7a562a21

subrepo: avoids empty commit when .hgsubstate is dirty (issue2403) This patch avoids empty commit when .hgsubstate is dirty. Empty commit was caused by .hgsubstate being updated back to the state of the working copy parent when committing, if a user had changed it manually and not made any changes in subrepositories. The subrepository state from the working copies parent is compared with the state calculated as a result of trying to commit the subrepositories. If the two states are the same, then return None otherwise the commit is just done. The line: "committing subrepository x" will be written if there is nothing committed, but .hgsubstate is dirty for x subrepository.
author Erik Zielke <ez@aragost.com>
date Mon, 29 Nov 2010 09:37:23 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13155
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
1 $ hg init
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
2 $ hg init sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
3 $ echo 'sub = sub' > .hgsub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
4 $ hg add .hgsub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
5 $ echo c1 > f1
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
6 $ echo c2 > sub/f2
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
7 $ hg add -S
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
8 adding f1
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
9 adding sub/f2
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
10 $ hg commit -m0
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
11 committing subrepository sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
12
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
13 Make .hgsubstate dirty:
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
14
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
15 $ echo '0000000000000000000000000000000000000000 sub' > .hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
16 $ hg diff --nodates
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
17 diff -r 853ea21970bb .hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
18 --- a/.hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
19 +++ b/.hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
20 @@ -1,1 +1,1 @@
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
21 -5bbc614a5b06ad7f3bf7c2463d74b005324f34c1 sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
22 +0000000000000000000000000000000000000000 sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
23
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
24 trying to do an empty commit:
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
25
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
26 $ hg commit -m1
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
27 committing subrepository sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
28 nothing changed
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
29 [1]
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
30
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
31 an okay update of .hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
32 $ cd sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
33 $ echo c3 > f2
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
34 $ hg commit -m "Sub commit"
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
35 $ cd ..
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
36 $ hg commit -m "Updated sub"
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
37 committing subrepository sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
38
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
39 deleting again:
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
40 $ echo '' > .hgsub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
41 $ hg commit -m2
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
42 $ cat .hgsub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
43
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
44 $ cat .hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
45
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
46 an okay commit, but with a dirty .hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
47 $ echo 'sub = sub' > .hgsub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
48 $ hg commit -m3
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
49 committing subrepository sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
50 $ echo '0000000000000000000000000000000000000000 sub' > .hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
51 $ hg diff --nodates
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
52 diff -r 41e1dee3d5d9 .hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
53 --- a/.hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
54 +++ b/.hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
55 @@ -1,1 +1,1 @@
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
56 -fe0229ee9a0a38b43163c756bb51b94228b118e7 sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
57 +0000000000000000000000000000000000000000 sub
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
58 $ echo c4 > f3
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
59 $ hg add f3
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
60 $ hg status
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
61 M .hgsubstate
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
62 A f3
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
63 $ hg commit -m4
f02d7a562a21 subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
Erik Zielke <ez@aragost.com>
parents:
diff changeset
64 committing subrepository sub