##// END OF EJS Templates
rebase: improve error message for --base being empty or causing emptiness...
Mads Kiilerich -
r20249:dc515784 default
parent child Browse files
Show More
@@ -233,9 +233,35 b' def rebase(ui, repo, **opts):'
233 assert rebaseset
233 assert rebaseset
234 else:
234 else:
235 base = scmutil.revrange(repo, [basef or '.'])
235 base = scmutil.revrange(repo, [basef or '.'])
236 if not base:
237 raise util.Abort(_('empty "base" revision set - '
238 "can't compute rebase set"))
236 rebaseset = repo.revs(
239 rebaseset = repo.revs(
237 '(children(ancestor(%ld, %d)) and ::(%ld))::',
240 '(children(ancestor(%ld, %d)) and ::(%ld))::',
238 base, dest, base)
241 base, dest, base)
242 if not rebaseset:
243 if base == [dest.rev()]:
244 if basef:
245 ui.status(_('nothing to rebase - %s is both "base"'
246 ' and destination\n') % dest)
247 else:
248 ui.status(_('nothing to rebase - working directory '
249 'parent is also destination\n'))
250 elif not repo.revs('%ld - ::%d', base, dest):
251 if basef:
252 ui.status(_('nothing to rebase - "base" %s is '
253 'already an ancestor of destination '
254 '%s\n') %
255 ('+'.join(str(repo[r]) for r in base),
256 dest))
257 else:
258 ui.status(_('nothing to rebase - working '
259 'directory parent is already an '
260 'ancestor of destination %s\n') % dest)
261 else: # can it happen?
262 ui.status(_('nothing to rebase from %s to %s\n') %
263 ('+'.join(str(repo[r]) for r in base), dest))
264 return 1
239 if rebaseset:
265 if rebaseset:
240 root = min(rebaseset)
266 root = min(rebaseset)
241 else:
267 else:
@@ -977,7 +977,7 b' rebased or not.'
977 M sub2/large6
977 M sub2/large6
978 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
978 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob)
979 0 largefiles cached
979 0 largefiles cached
980 nothing to rebase
980 nothing to rebase - working directory parent is also destination
981 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
981 $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ]
982 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
982 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
983 9:598410d3eb9a modify normal file largefile in repo d
983 9:598410d3eb9a modify normal file largefile in repo d
@@ -87,14 +87,26 b' These fail:'
87 abort: empty "source" revision set - nothing to rebase
87 abort: empty "source" revision set - nothing to rebase
88 [255]
88 [255]
89
89
90 $ hg rebase --base '1 & !1'
91 abort: empty "base" revision set - can't compute rebase set
92 [255]
93
90 $ hg rebase
94 $ hg rebase
91 nothing to rebase
95 nothing to rebase - working directory parent is also destination
96 [1]
97
98 $ hg rebase -b.
99 nothing to rebase - e7ec4e813ba6 is both "base" and destination
92 [1]
100 [1]
93
101
94 $ hg up -q 7
102 $ hg up -q 7
95
103
96 $ hg rebase --traceback
104 $ hg rebase --traceback
97 nothing to rebase
105 nothing to rebase - working directory parent is already an ancestor of destination e7ec4e813ba6
106 [1]
107
108 $ hg rebase -b.
109 nothing to rebase - "base" 02de42196ebe is already an ancestor of destination e7ec4e813ba6
98 [1]
110 [1]
99
111
100 $ hg rebase --dest '1 & !1'
112 $ hg rebase --dest '1 & !1'
@@ -137,7 +149,6 b' Try to rollback after a rebase (fail):'
137
149
138 $ cd ..
150 $ cd ..
139
151
140
141 Rebase with base == '.' => same as no arguments (from 3 onto 8):
152 Rebase with base == '.' => same as no arguments (from 3 onto 8):
142
153
143 $ hg clone -q -u 3 a a2
154 $ hg clone -q -u 3 a a2
@@ -84,7 +84,7 b' Invoke pull --rebase and nothing to reba'
84 adding manifests
84 adding manifests
85 adding file changes
85 adding file changes
86 added 1 changesets with 1 changes to 1 files
86 added 1 changesets with 1 changes to 1 files
87 nothing to rebase
87 nothing to rebase - working directory parent is already an ancestor of destination 77ae9631bcca
88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 updating bookmark norebase
89 updating bookmark norebase
90
90
@@ -235,7 +235,7 b' These will abort gracefully (using --bas'
235 G onto G - rebase onto same changeset:
235 G onto G - rebase onto same changeset:
236
236
237 $ hg rebase -b 6 -d 6
237 $ hg rebase -b 6 -d 6
238 nothing to rebase
238 nothing to rebase - eea13746799a is both "base" and destination
239 [1]
239 [1]
240
240
241 G onto F - rebase onto an ancestor:
241 G onto F - rebase onto an ancestor:
@@ -247,7 +247,7 b' G onto F - rebase onto an ancestor:'
247 F onto G - rebase onto a descendant:
247 F onto G - rebase onto a descendant:
248
248
249 $ hg rebase -b 5 -d 6
249 $ hg rebase -b 5 -d 6
250 nothing to rebase
250 nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a
251 [1]
251 [1]
252
252
253 C onto A - rebase onto an ancestor:
253 C onto A - rebase onto an ancestor:
General Comments 0
You need to be logged in to leave comments. Login now