133 In the end we'll record interesting changes, and everything else |
133 In the end we'll record interesting changes, and everything else |
134 will be left in place, so the user can continue working. |
134 will be left in place, so the user can continue working. |
135 """ |
135 """ |
136 |
136 |
137 checkunfinished(repo, commit=True) |
137 checkunfinished(repo, commit=True) |
138 merge = len(repo[None].parents()) > 1 |
138 wctx = repo[None] |
|
139 merge = len(wctx.parents()) > 1 |
139 if merge: |
140 if merge: |
140 raise error.Abort(_('cannot partially commit a merge ' |
141 raise error.Abort(_('cannot partially commit a merge ' |
141 '(use "hg commit" instead)')) |
142 '(use "hg commit" instead)')) |
142 |
143 |
|
144 def fail(f, msg): |
|
145 raise error.Abort('%s: %s' % (f, msg)) |
|
146 |
|
147 force = opts.get('force') |
|
148 if not force: |
|
149 vdirs = [] |
|
150 match.explicitdir = vdirs.append |
|
151 match.bad = fail |
|
152 |
143 status = repo.status(match=match) |
153 status = repo.status(match=match) |
|
154 if not force: |
|
155 repo.checkcommitpatterns(wctx, vdirs, match, status, fail) |
144 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) |
156 diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) |
145 diffopts.nodates = True |
157 diffopts.nodates = True |
146 diffopts.git = True |
158 diffopts.git = True |
147 diffopts.showfunc = True |
159 diffopts.showfunc = True |
148 originaldiff = patch.diff(repo, changes=status, opts=diffopts) |
160 originaldiff = patch.diff(repo, changes=status, opts=diffopts) |