comparison mercurial/commands.py @ 3660:d793e09e1b71

refactor rawcommit
author Matt Mackall <mpm@selenic.com>
date Wed, 15 Nov 2006 15:51:58 -0600
parents f4dece0f7016
children c15c5aedaf47
comparison
equal deleted inserted replaced
3659:f4dece0f7016 3660:d793e09e1b71
1776 if opts['rev']: 1776 if opts['rev']:
1777 revs = [repo.lookup(rev) for rev in opts['rev']] 1777 revs = [repo.lookup(rev) for rev in opts['rev']]
1778 r = repo.push(other, opts['force'], revs=revs) 1778 r = repo.push(other, opts['force'], revs=revs)
1779 return r == 0 1779 return r == 0
1780 1780
1781 def rawcommit(ui, repo, *flist, **rc): 1781 def rawcommit(ui, repo, *pats, **opts):
1782 """raw commit interface (DEPRECATED) 1782 """raw commit interface (DEPRECATED)
1783 1783
1784 (DEPRECATED) 1784 (DEPRECATED)
1785 Lowlevel commit, for use in helper scripts. 1785 Lowlevel commit, for use in helper scripts.
1786 1786
1791 release, please use debugsetparents and commit instead. 1791 release, please use debugsetparents and commit instead.
1792 """ 1792 """
1793 1793
1794 ui.warn(_("(the rawcommit command is deprecated)\n")) 1794 ui.warn(_("(the rawcommit command is deprecated)\n"))
1795 1795
1796 message = rc['message'] 1796 message = logmessage(opts)
1797 if not message and rc['logfile']: 1797
1798 try: 1798 files, match, anypats = cmdutil.matchpats(repo, pats, opts)
1799 message = open(rc['logfile']).read() 1799 if opts['files']:
1800 except IOError: 1800 files += open(opts['files']).read().splitlines()
1801 pass 1801
1802 if not message and not rc['logfile']: 1802 parents = [repo.lookup(p) for p in opts['parent']]
1803 raise util.Abort(_("missing commit message"))
1804
1805 files = relpath(repo, list(flist))
1806 if rc['files']:
1807 files += open(rc['files']).read().splitlines()
1808
1809 rc['parent'] = map(repo.lookup, rc['parent'])
1810 1803
1811 try: 1804 try:
1812 repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent']) 1805 repo.rawcommit(files, message,
1806 opts['user'], opts['date'], *parents)
1813 except ValueError, inst: 1807 except ValueError, inst:
1814 raise util.Abort(str(inst)) 1808 raise util.Abort(str(inst))
1815 1809
1816 def recover(ui, repo): 1810 def recover(ui, repo):
1817 """roll back an interrupted transaction 1811 """roll back an interrupted transaction