##// END OF EJS Templates
commit: factor out status printing into a helper function...
Kevin Bullock -
r18688:79107fad default
parent child Browse files
Show More
@@ -1821,6 +1821,52 def commitforceeditor(repo, ctx, subs):
1821
1821
1822 return text
1822 return text
1823
1823
1824 def commitstatus(repo, node, branch, bheads=None, opts={}):
1825 ctx = repo[node]
1826 parents = ctx.parents()
1827
1828 if (not opts.get('amend') and bheads and node not in bheads and not
1829 [x for x in parents if x.node() in bheads and x.branch() == branch]):
1830 repo.ui.status(_('created new head\n'))
1831 # The message is not printed for initial roots. For the other
1832 # changesets, it is printed in the following situations:
1833 #
1834 # Par column: for the 2 parents with ...
1835 # N: null or no parent
1836 # B: parent is on another named branch
1837 # C: parent is a regular non head changeset
1838 # H: parent was a branch head of the current branch
1839 # Msg column: whether we print "created new head" message
1840 # In the following, it is assumed that there already exists some
1841 # initial branch heads of the current branch, otherwise nothing is
1842 # printed anyway.
1843 #
1844 # Par Msg Comment
1845 # N N y additional topo root
1846 #
1847 # B N y additional branch root
1848 # C N y additional topo head
1849 # H N n usual case
1850 #
1851 # B B y weird additional branch root
1852 # C B y branch merge
1853 # H B n merge with named branch
1854 #
1855 # C C y additional head from merge
1856 # C H n merge with a head
1857 #
1858 # H H n head merge: head count decreases
1859
1860 if not opts.get('close_branch'):
1861 for r in parents:
1862 if r.closesbranch() and r.branch() == branch:
1863 repo.ui.status(_('reopening closed branch head %d\n') % r)
1864
1865 if repo.ui.debugflag:
1866 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
1867 elif repo.ui.verbose:
1868 repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
1869
1824 def revert(ui, repo, ctx, parents, *pats, **opts):
1870 def revert(ui, repo, ctx, parents, *pats, **opts):
1825 parent, p2 = parents
1871 parent, p2 = parents
1826 node = ctx.node()
1872 node = ctx.node()
@@ -1356,50 +1356,7 def commit(ui, repo, *pats, **opts):
1356 ui.status(_("nothing changed\n"))
1356 ui.status(_("nothing changed\n"))
1357 return 1
1357 return 1
1358
1358
1359 ctx = repo[node]
1359 cmdutil.commitstatus(repo, node, branch, bheads, opts)
1360 parents = ctx.parents()
1361
1362 if (not opts.get('amend') and bheads and node not in bheads and not
1363 [x for x in parents if x.node() in bheads and x.branch() == branch]):
1364 ui.status(_('created new head\n'))
1365 # The message is not printed for initial roots. For the other
1366 # changesets, it is printed in the following situations:
1367 #
1368 # Par column: for the 2 parents with ...
1369 # N: null or no parent
1370 # B: parent is on another named branch
1371 # C: parent is a regular non head changeset
1372 # H: parent was a branch head of the current branch
1373 # Msg column: whether we print "created new head" message
1374 # In the following, it is assumed that there already exists some
1375 # initial branch heads of the current branch, otherwise nothing is
1376 # printed anyway.
1377 #
1378 # Par Msg Comment
1379 # N N y additional topo root
1380 #
1381 # B N y additional branch root
1382 # C N y additional topo head
1383 # H N n usual case
1384 #
1385 # B B y weird additional branch root
1386 # C B y branch merge
1387 # H B n merge with named branch
1388 #
1389 # C C y additional head from merge
1390 # C H n merge with a head
1391 #
1392 # H H n head merge: head count decreases
1393
1394 if not opts.get('close_branch'):
1395 for r in parents:
1396 if r.closesbranch() and r.branch() == branch:
1397 ui.status(_('reopening closed branch head %d\n') % r)
1398
1399 if ui.debugflag:
1400 ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
1401 elif ui.verbose:
1402 ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
1403
1360
1404 @command('copy|cp',
1361 @command('copy|cp',
1405 [('A', 'after', None, _('record a copy that has already occurred')),
1362 [('A', 'after', None, _('record a copy that has already occurred')),
General Comments 0
You need to be logged in to leave comments. Login now