##// END OF EJS Templates
commands.resolve: don't allow users to mark or unmark driver-resolved files...
Siddharth Agarwal -
r26784:c0aab596 default
parent child Browse files
Show More
@@ -5617,6 +5617,19 b' def resolve(ui, repo, *pats, **opts):'
5617 5617
5618 5618 didwork = True
5619 5619
5620 # don't let driver-resolved files be marked
5621 if ms[f] == "d":
5622 exact = m.exact(f)
5623 if mark:
5624 if exact:
5625 ui.warn(_('not marking %s as it is driver-resolved\n')
5626 % f)
5627 elif unmark:
5628 if exact:
5629 ui.warn(_('not unmarking %s as it is driver-resolved\n')
5630 % f)
5631 continue
5632
5620 5633 if mark:
5621 5634 ms.mark(f, "r")
5622 5635 elif unmark:
@@ -53,6 +53,58 b' resolving an unknown path should emit a '
53 53 arguments do not match paths that need resolving
54 54 $ hg resolve -l does-not-exist
55 55
56 don't allow marking or unmarking driver-resolved files
57
58 $ cat > $TESTTMP/markdriver.py << EOF
59 > '''mark and unmark files as driver-resolved'''
60 > from mercurial import cmdutil, merge, scmutil
61 > cmdtable = {}
62 > command = cmdutil.command(cmdtable)
63 > @command('markdriver',
64 > [('u', 'unmark', None, '')],
65 > 'FILE...')
66 > def markdriver(ui, repo, *pats, **opts):
67 > wlock = repo.wlock()
68 > try:
69 > ms = merge.mergestate(repo)
70 > m = scmutil.match(repo[None], pats, opts)
71 > for f in ms:
72 > if not m(f):
73 > continue
74 > if not opts['unmark']:
75 > ms.mark(f, 'd')
76 > else:
77 > ms.mark(f, 'u')
78 > ms.commit()
79 > finally:
80 > wlock.release()
81 > EOF
82 $ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver file1
83 $ hg resolve --list
84 D file1
85 U file2
86 $ hg resolve --mark file1
87 not marking file1 as it is driver-resolved
88 this should not print out file1
89 $ hg resolve --mark --all
90 (no more unresolved files -- run "hg resolve --all" to conclude)
91 $ hg resolve --mark 'glob:file*'
92 (no more unresolved files -- run "hg resolve --all" to conclude)
93 $ hg resolve --list
94 D file1
95 R file2
96 $ hg resolve --unmark file1
97 not unmarking file1 as it is driver-resolved
98 (no more unresolved files -- run "hg resolve --all" to conclude)
99 $ hg resolve --unmark --all
100 $ hg resolve --list
101 D file1
102 U file2
103 $ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver --unmark file1
104 $ hg resolve --list
105 U file1
106 U file2
107
56 108 resolve the failure
57 109
58 110 $ echo resolved > file1
General Comments 0
You need to be logged in to leave comments. Login now