##// END OF EJS Templates
commit: enable --secret option...
Jordi Gutiérrez Hermoso -
r19440:4a0d0616 default
parent child Browse files
Show More
@@ -1285,6 +1285,7 b' def clone(ui, source, dest=None, **opts)'
1285 ('', 'close-branch', None,
1285 ('', 'close-branch', None,
1286 _('mark a branch as closed, hiding it from the branch list')),
1286 _('mark a branch as closed, hiding it from the branch list')),
1287 ('', 'amend', None, _('amend the parent of the working dir')),
1287 ('', 'amend', None, _('amend the parent of the working dir')),
1288 ('s', 'secret', None, _('use the secret phase for committing')),
1288 ] + walkopts + commitopts + commitopts2 + subrepoopts,
1289 ] + walkopts + commitopts + commitopts2 + subrepoopts,
1289 _('[OPTION]... [FILE]...'))
1290 _('[OPTION]... [FILE]...'))
1290 def commit(ui, repo, *pats, **opts):
1291 def commit(ui, repo, *pats, **opts):
@@ -1329,6 +1330,9 b' def commit(ui, repo, *pats, **opts):'
1329 # Let --subrepos on the command line override config setting.
1330 # Let --subrepos on the command line override config setting.
1330 ui.setconfig('ui', 'commitsubrepos', True)
1331 ui.setconfig('ui', 'commitsubrepos', True)
1331
1332
1333 # Save this for restoring it later
1334 oldcommitphase = ui.config('phases', 'new-commit')
1335
1332 if repo.vfs.exists('graftstate'):
1336 if repo.vfs.exists('graftstate'):
1333 raise util.Abort(_('cannot commit an interrupted graft operation'),
1337 raise util.Abort(_('cannot commit an interrupted graft operation'),
1334 hint=_('use "hg graft -c" to continue graft'))
1338 hint=_('use "hg graft -c" to continue graft'))
@@ -1370,12 +1374,18 b' def commit(ui, repo, *pats, **opts):'
1370 if not message:
1374 if not message:
1371 message = old.description()
1375 message = old.description()
1372 editor = cmdutil.commitforceeditor
1376 editor = cmdutil.commitforceeditor
1373 return repo.commit(message,
1377 try:
1374 opts.get('user') or old.user(),
1378 if opts.get('secret'):
1375 opts.get('date') or old.date(),
1379 ui.setconfig('phases', 'new-commit', 'secret')
1376 match,
1380
1377 editor=editor,
1381 return repo.commit(message,
1378 extra=extra)
1382 opts.get('user') or old.user(),
1383 opts.get('date') or old.date(),
1384 match,
1385 editor=editor,
1386 extra=extra)
1387 finally:
1388 ui.setconfig('phases', 'new-commit', oldcommitphase)
1379
1389
1380 current = repo._bookmarkcurrent
1390 current = repo._bookmarkcurrent
1381 marks = old.bookmarks()
1391 marks = old.bookmarks()
@@ -1398,8 +1408,15 b' def commit(ui, repo, *pats, **opts):'
1398 e = cmdutil.commitforceeditor
1408 e = cmdutil.commitforceeditor
1399
1409
1400 def commitfunc(ui, repo, message, match, opts):
1410 def commitfunc(ui, repo, message, match, opts):
1401 return repo.commit(message, opts.get('user'), opts.get('date'),
1411 try:
1402 match, editor=e, extra=extra)
1412 if opts.get('secret'):
1413 ui.setconfig('phases', 'new-commit', 'secret')
1414
1415 return repo.commit(message, opts.get('user'), opts.get('date'),
1416 match, editor=e, extra=extra)
1417 finally:
1418 ui.setconfig('phases', 'new-commit', oldcommitphase)
1419
1403
1420
1404 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
1421 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
1405
1422
General Comments 0
You need to be logged in to leave comments. Login now