##// END OF EJS Templates
subrepos: abort commit by default if a subrepo is dirty (BC)...
Martin Geisler -
r15321:e174353e stable
parent child Browse files
Show More
@@ -1143,7 +1143,7 b' def clone(ui, source, dest=None, **opts)'
1143 1143 _('mark new/missing files as added/removed before committing')),
1144 1144 ('', 'close-branch', None,
1145 1145 _('mark a branch as closed, hiding it from the branch list')),
1146 ] + walkopts + commitopts + commitopts2,
1146 ] + walkopts + commitopts + commitopts2 + subrepoopts,
1147 1147 _('[OPTION]... [FILE]...'))
1148 1148 def commit(ui, repo, *pats, **opts):
1149 1149 """commit the specified files or all outstanding changes
@@ -1167,6 +1167,10 b' def commit(ui, repo, *pats, **opts):'
1167 1167
1168 1168 Returns 0 on success, 1 if nothing changed.
1169 1169 """
1170 if opts.get('subrepos'):
1171 # Let --subrepos on the command line overide config setting.
1172 ui.setconfig('ui', 'commitsubrepos', True)
1173
1170 1174 extra = {}
1171 1175 if opts.get('close_branch'):
1172 1176 if repo['.'].node() not in repo.branchheads():
@@ -1010,7 +1010,7 b' User interface controls.'
1010 1010 Whether to commit modified subrepositories when committing the
1011 1011 parent repository. If False and one subrepository has uncommitted
1012 1012 changes, abort the commit.
1013 Default is True.
1013 Default is False.
1014 1014
1015 1015 ``debug``
1016 1016 Print debugging information. True or False. Default is False.
@@ -1062,11 +1062,12 b' class localrepository(repo.repository):'
1062 1062 '.hgsubstate' not in changes[0] + changes[1] + changes[2]):
1063 1063 changes[2].insert(0, '.hgsubstate')
1064 1064
1065 if subs and not self.ui.configbool('ui', 'commitsubrepos', True):
1065 if subs and not self.ui.configbool('ui', 'commitsubrepos', False):
1066 1066 changedsubs = [s for s in subs if wctx.sub(s).dirty(True)]
1067 1067 if changedsubs:
1068 1068 raise util.Abort(_("uncommitted changes in subrepo %s")
1069 % changedsubs[0])
1069 % changedsubs[0],
1070 hint=_("use --subrepos for recursive commit"))
1070 1071
1071 1072 # make sure all explicit patterns are matched
1072 1073 if not force and match.files():
@@ -191,7 +191,7 b' Show all commands + options'
191 191 add: include, exclude, subrepos, dry-run
192 192 annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, include, exclude
193 193 clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure
194 commit: addremove, close-branch, include, exclude, message, logfile, date, user
194 commit: addremove, close-branch, include, exclude, message, logfile, date, user, subrepos
195 195 diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos
196 196 export: output, switch-parent, rev, text, git, nodates
197 197 forget: include, exclude
@@ -1,3 +1,5 b''
1 $ echo "[ui]" >> $HGRCPATH
2 $ echo "commitsubrepos = Yes" >> $HGRCPATH
1 3 $ echo "[extensions]" >> $HGRCPATH
2 4 $ echo "mq=" >> $HGRCPATH
3 5 $ echo "record=" >> $HGRCPATH
@@ -64,6 +64,7 b' help record (record)'
64 64 -l --logfile FILE read commit message from file
65 65 -d --date DATE record the specified date as commit date
66 66 -u --user USER record the specified user as committer
67 -S --subrepos recurse into subrepositories
67 68 -w --ignore-all-space ignore white space when comparing lines
68 69 -b --ignore-space-change ignore changes in the amount of white space
69 70 -B --ignore-blank-lines ignore changes whose lines are all blank
@@ -77,7 +77,7 b' debugsub output for main and sub1'
77 77 Modifying deeply nested 'sub2'
78 78
79 79 $ echo modified > cloned/sub1/sub2/sub2
80 $ hg commit -m "deep nested modif should trigger a commit" -R cloned
80 $ hg commit --subrepos -m "deep nested modif should trigger a commit" -R cloned
81 81 committing subrepository sub1
82 82 committing subrepository sub1/sub2
83 83
@@ -103,7 +103,7 b' clone root, make local change'
103 103 $ echo ggg >> s/g
104 104 $ hg status --subrepos
105 105 M s/g
106 $ hg commit -m ggg
106 $ hg commit --subrepos -m ggg
107 107 committing subrepository s
108 108 $ hg debugsub
109 109 path s
@@ -125,7 +125,7 b' clone root separately, make different lo'
125 125
126 126 $ hg status --subrepos
127 127 A s/f
128 $ hg commit -m f
128 $ hg commit --subrepos -m f
129 129 committing subrepository s
130 130 $ hg debugsub
131 131 path s
@@ -164,7 +164,7 b' user a pulls, merges, commits'
164 164 g
165 165 gg
166 166 ggg
167 $ hg commit -m 'merge'
167 $ hg commit --subrepos -m 'merge'
168 168 committing subrepository s
169 169 $ hg status --subrepos --rev 1:5
170 170 M .hgsubstate
@@ -294,7 +294,7 b' nested commit'
294 294 $ echo ffff >> inner/s/f
295 295 $ hg status --subrepos
296 296 M inner/s/f
297 $ hg commit -m nested
297 $ hg commit --subrepos -m nested
298 298 committing subrepository inner
299 299 committing subrepository inner/s
300 300
@@ -325,7 +325,7 b" Don't crash if the subrepo is missing"
325 325 $ hg push -q
326 326 abort: subrepo s is missing
327 327 [255]
328 $ hg commit -qm missing
328 $ hg commit --subrepos -qm missing
329 329 abort: subrepo s is missing
330 330 [255]
331 331 $ hg update -C
@@ -58,7 +58,14 b' Test recursive diff without committing a'
58 58
59 59 Commits:
60 60
61 $ hg commit -m 0-0-0
61 $ hg commit -m fails
62 abort: uncommitted changes in subrepo foo
63 (use --subrepos for recursive commit)
64 [255]
65
66 The --subrepos flag overwrite the config setting:
67
68 $ hg commit -m 0-0-0 --config ui.commitsubrepos=No --subrepos
62 69 committing subrepository foo
63 70 committing subrepository foo/bar
64 71
@@ -177,7 +184,7 b' Status with relative path:'
177 184 Cleanup and final commit:
178 185
179 186 $ rm -r dir
180 $ hg commit -m 2-3-2
187 $ hg commit --subrepos -m 2-3-2
181 188 committing subrepository foo
182 189 committing subrepository foo/bar
183 190
@@ -394,7 +401,7 b' Make nested change:'
394 401 y2
395 402 y3
396 403 +y4
397 $ hg commit -m 3-4-2
404 $ hg commit --subrepos -m 3-4-2
398 405 committing subrepository foo
399 406 $ hg outgoing -S
400 407 comparing with $TESTTMP/repo
@@ -105,7 +105,7 b' change file in svn and hg, commit'
105 105 branch: default
106 106 commit: 1 modified, 1 subrepos
107 107 update: (current)
108 $ hg commit -m 'Message!'
108 $ hg commit --subrepos -m 'Message!'
109 109 committing subrepository s
110 110 Sending*s/alpha (glob)
111 111 Transmitting file data .
@@ -171,7 +171,7 b' add a commit from svn'
171 171 this commit from hg will fail
172 172
173 173 $ echo zzz >> s/alpha
174 $ hg ci -m 'amend alpha from hg'
174 $ hg ci --subrepos -m 'amend alpha from hg'
175 175 committing subrepository s
176 176 abort: svn: Commit failed (details follow):
177 177 svn: (Out of date)?.*/src/alpha.*(is out of date)? (re)
@@ -182,7 +182,7 b' this commit fails because of meta change'
182 182
183 183 $ svn propset svn:mime-type 'text/html' s/alpha
184 184 property 'svn:mime-type' set on 's/alpha'
185 $ hg ci -m 'amend alpha from hg'
185 $ hg ci --subrepos -m 'amend alpha from hg'
186 186 committing subrepository s
187 187 abort: svn: Commit failed (details follow):
188 188 svn: (Out of date)?.*/src/alpha.*(is out of date)? (re)
@@ -192,7 +192,7 b' this commit fails because of meta change'
192 192 this commit fails because of externals changes
193 193
194 194 $ echo zzz > s/externals/other
195 $ hg ci -m 'amend externals from hg'
195 $ hg ci --subrepos -m 'amend externals from hg'
196 196 committing subrepository s
197 197 abort: cannot commit svn externals
198 198 [255]
@@ -214,7 +214,7 b' this commit fails because of externals m'
214 214
215 215 $ svn propset svn:mime-type 'text/html' s/externals/other
216 216 property 'svn:mime-type' set on 's/externals/other'
217 $ hg ci -m 'amend externals from hg'
217 $ hg ci --subrepos -m 'amend externals from hg'
218 218 committing subrepository s
219 219 abort: cannot commit svn externals
220 220 [255]
@@ -523,7 +523,7 b' This is surprising, but is also correct '
523 523 Point to a Subversion branch which has since been deleted and recreated
524 524 First, create that condition in the repository.
525 525
526 $ hg ci -m cleanup
526 $ hg ci --subrepos -m cleanup
527 527 committing subrepository obstruct
528 528 Sending obstruct/other
529 529 Transmitting file data .
@@ -1,3 +1,8 b''
1 Let commit recurse into subrepos by default to match pre-2.0 behavior:
2
3 $ echo "[ui]" >> $HGRCPATH
4 $ echo "commitsubrepos = Yes" >> $HGRCPATH
5
1 6 $ rm -rf sub
2 7 $ mkdir sub
3 8 $ cd sub
@@ -107,6 +112,7 b' leave sub dirty (and check ui.commitsubr'
107 112 $ echo c > s/a
108 113 $ hg --config ui.commitsubrepos=no ci -m4
109 114 abort: uncommitted changes in subrepo s
115 (use --subrepos for recursive commit)
110 116 [255]
111 117 $ hg ci -m4
112 118 committing subrepository s
General Comments 0
You need to be logged in to leave comments. Login now