##// END OF EJS Templates
rebase: abort if the user tries to rebase the working copy...
Martin von Zweigbergk -
r44716:130e27fc default draft
parent child Browse files
Show More
@@ -37,6 +37,7 b' from mercurial import ('
37 hg,
37 hg,
38 merge as mergemod,
38 merge as mergemod,
39 mergeutil,
39 mergeutil,
40 node as nodemod,
40 obsolete,
41 obsolete,
41 obsutil,
42 obsutil,
42 patch,
43 patch,
@@ -1265,8 +1266,7 b' def _definedestmap('
1265 if not src:
1266 if not src:
1266 ui.status(_(b'empty "source" revision set - nothing to rebase\n'))
1267 ui.status(_(b'empty "source" revision set - nothing to rebase\n'))
1267 return None
1268 return None
1268 rebaseset = repo.revs(b'(%ld)::', src)
1269 rebaseset = repo.revs(b'(%ld)::', src) or src
1269 assert rebaseset
1270 else:
1270 else:
1271 base = scmutil.revrange(repo, [basef or b'.'])
1271 base = scmutil.revrange(repo, [basef or b'.'])
1272 if not base:
1272 if not base:
@@ -1341,6 +1341,8 b' def _definedestmap('
1341 )
1341 )
1342 return None
1342 return None
1343
1343
1344 if nodemod.wdirrev in rebaseset:
1345 raise error.Abort(_(b'cannot rebase the working copy'))
1344 rebasingwcp = repo[b'.'].rev() in rebaseset
1346 rebasingwcp = repo[b'.'].rev() in rebaseset
1345 ui.log(
1347 ui.log(
1346 b"rebase",
1348 b"rebase",
@@ -93,11 +93,12 b' These fail:'
93 [1]
93 [1]
94
94
95 $ hg rebase --rev 'wdir()' --dest 6
95 $ hg rebase --rev 'wdir()' --dest 6
96 abort: working directory revision cannot be specified
96 abort: cannot rebase the working copy
97 [255]
97 [255]
98
98
99 $ hg rebase --source 'wdir()' --dest 6 2>&1 | grep assert
99 $ hg rebase --source 'wdir()' --dest 6
100 assert rebaseset
100 abort: cannot rebase the working copy
101 [255]
101
102
102 $ hg rebase --source '1 & !1' --dest 8
103 $ hg rebase --source '1 & !1' --dest 8
103 empty "source" revision set - nothing to rebase
104 empty "source" revision set - nothing to rebase
General Comments 0
You need to be logged in to leave comments. Login now