##// END OF EJS Templates
make commit fail when committing unresolved files
Stefano Tortarolo -
r6888:7c36a4fb default
parent child Browse files
Show More
@@ -0,0 +1,40 b''
1 #!/bin/sh
2
3 echo "[extensions]" >> $HGRCPATH
4 echo "graphlog=" >> $HGRCPATH
5
6 function addcommit {
7 echo $1 > $1
8 hg add $1
9 hg commit -d "${2} 0" -u test -m $1
10 }
11 function commit {
12 hg commit -d "${2} 0" -u test -m $1
13 }
14
15 hg init a
16 cd a
17 addcommit "A" 0
18 addcommit "B" 1
19 echo "C" >> A
20 commit "C" 2
21
22 hg update -C 0
23 echo "D" >> A
24 commit "D" 3
25
26 echo
27 echo "% Merging a conflict araises"
28 hg merge
29
30 echo
31 echo "% Correct the conflict without marking the file as resolved"
32 echo "ABCD" > A
33 hg commit -m "Merged"
34
35 echo
36 echo "% Mark the conflict as resolved and commit"
37 hg resolve -m A
38 hg commit -m "Merged"
39
40 exit 0
@@ -0,0 +1,14 b''
1 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
2 created new head
3
4 % Merging a conflict araises
5 merging A
6 warning: conflicts during merge.
7 merging A failed!
8 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
9 use 'hg resolve' to retry unresolved file merges
10
11 % Correct the conflict without marking the file as resolved
12 abort: unresolved merge conflicts (see hg resolve)
13
14 % Mark the conflict as resolved and commit
@@ -12,6 +12,7 b' import changelog, dirstate, filelog, man'
12 import lock, transaction, stat, errno, ui, store
12 import lock, transaction, stat, errno, ui, store
13 import os, revlog, time, util, extensions, hook, inspect
13 import os, revlog, time, util, extensions, hook, inspect
14 import match as match_
14 import match as match_
15 import merge as merge_
15
16
16 class localrepository(repo.repository):
17 class localrepository(repo.repository):
17 capabilities = util.set(('lookup', 'changegroupsubset'))
18 capabilities = util.set(('lookup', 'changegroupsubset'))
@@ -777,6 +778,11 b' class localrepository(repo.repository):'
777 update_dirstate = (self.dirstate.parents()[0] == p1)
778 update_dirstate = (self.dirstate.parents()[0] == p1)
778 changes = [files, [], [], [], []]
779 changes = [files, [], [], [], []]
779
780
781 ms = merge_.mergestate(self)
782 for f in changes[0]:
783 if f in ms and ms[f] == 'u':
784 raise util.Abort(_("unresolved merge conflicts "
785 "(see hg resolve)"))
780 wctx = context.workingctx(self, (p1, p2), text, user, date,
786 wctx = context.workingctx(self, (p1, p2), text, user, date,
781 extra, changes)
787 extra, changes)
782 return self._commitctx(wctx, force, force_editor, empty_ok,
788 return self._commitctx(wctx, force, force_editor, empty_ok,
@@ -32,6 +32,7 b' hg st'
32 echo % should fail
32 echo % should fail
33 hg add a
33 hg add a
34 hg st
34 hg st
35 hg resolve -m a
35 hg ci -m merge
36 hg ci -m merge
36
37
37 echo % issue683
38 echo % issue683
@@ -128,6 +128,7 b" hg --cwd b ci -d '4 0' -Amright-2"
128 hg --cwd b up -C 2
128 hg --cwd b up -C 2
129 hg --cwd b merge
129 hg --cwd b merge
130 hg --cwd b revert -r 2 b
130 hg --cwd b revert -r 2 b
131 hg resolve -m b
131 hg --cwd b ci -d '5 0' -m 'merge'
132 hg --cwd b ci -d '5 0' -m 'merge'
132
133
133 hg convert -d svn b
134 hg convert -d svn b
@@ -43,6 +43,7 b' two-point-five'
43 three
43 three
44 EOF
44 EOF
45 rm -f *.orig
45 rm -f *.orig
46 hg resolve -m test.txt
46 hg commit -m "Merge 1" -d "1000000 0"
47 hg commit -m "Merge 1" -d "1000000 0"
47
48
48 # change test-a again
49 # change test-a again
General Comments 0
You need to be logged in to leave comments. Login now