Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 5757:c5793dada959
Clarify some messages during commit:
- use "branch 'foo'" to distinguish from "branch merge".
- commit messags can be empty (to abort commits)
- Added value for editor message: Tell about HG: lines like CVS does.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Dec 2007 17:10:25 +0100 |
parents | 6183df642f95 |
children | 0145f9afb0e7 |
comparison
equal
deleted
inserted
replaced
5756:6183df642f95 | 5757:c5793dada959 |
---|---|
797 if (not empty_ok and not text) or force_editor: | 797 if (not empty_ok and not text) or force_editor: |
798 edittext = [] | 798 edittext = [] |
799 if text: | 799 if text: |
800 edittext.append(text) | 800 edittext.append(text) |
801 edittext.append("") | 801 edittext.append("") |
802 edittext.append(_("HG: Please write and save a commit message")) | 802 edittext.append(_("HG: Enter commit message." |
803 " Lines beginning with 'HG:' are removed.")) | |
803 edittext.append("HG: --") | 804 edittext.append("HG: --") |
804 edittext.append("HG: user: %s" % user) | 805 edittext.append("HG: user: %s" % user) |
805 if p2 != nullid: | 806 if p2 != nullid: |
806 edittext.append("HG: branch merge") | 807 edittext.append("HG: branch merge") |
807 if branchname: | 808 if branchname: |
808 edittext.append("HG: branch %s" % util.tolocal(branchname)) | 809 edittext.append("HG: branch '%s'" % util.tolocal(branchname)) |
809 edittext.extend(["HG: changed %s" % f for f in changed]) | 810 edittext.extend(["HG: changed %s" % f for f in changed]) |
810 edittext.extend(["HG: removed %s" % f for f in removed]) | 811 edittext.extend(["HG: removed %s" % f for f in removed]) |
811 if not changed and not remove: | 812 if not changed and not remove: |
812 edittext.append("HG: no files changed") | 813 edittext.append("HG: no files changed") |
813 edittext.append("") | 814 edittext.append("") |
823 if use_dirstate: | 824 if use_dirstate: |
824 lines = [line.rstrip() for line in text.rstrip().splitlines()] | 825 lines = [line.rstrip() for line in text.rstrip().splitlines()] |
825 while lines and not lines[0]: | 826 while lines and not lines[0]: |
826 del lines[0] | 827 del lines[0] |
827 if not lines: | 828 if not lines: |
828 raise util.Abort(_("commit message cannot be left blank")) | 829 raise util.Abort(_("empty commit message")) |
829 text = '\n'.join(lines) | 830 text = '\n'.join(lines) |
830 | 831 |
831 n = self.changelog.add(mn, changed + removed, text, trp, p1, p2, | 832 n = self.changelog.add(mn, changed + removed, text, trp, p1, p2, |
832 user, date, extra) | 833 user, date, extra) |
833 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, | 834 self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1, |