comparison hgext/rebase.py @ 20249:dc5157841361

rebase: improve error message for --base being empty or causing emptiness Before it just said 'nothing to rebase'. Now 'if "base" is an empty set: abort: empty "base" revision set - can't compute rebase set If the set of changesets to rebase can't be found from "base", it will fail as before but with more explanation of what the problem was. The name of the "base" option is not obvious - it is more like "samples identifying the branch to rebase". The error messages for problems with the specified "base" value will use that term and might thus also not be obvious, but at least they are consistent with the option name. The name "base" will not be used if the base only was specified implicitly as the working directory parent.
author Mads Kiilerich <madski@unity3d.com>
date Sun, 17 Nov 2013 18:21:58 -0500
parents 3bff26f67169
children f380b191e085
comparison
equal deleted inserted replaced
20248:3bff26f67169 20249:dc5157841361
231 'nothing to rebase')) 231 'nothing to rebase'))
232 rebaseset = repo.revs('(%ld)::', src) 232 rebaseset = repo.revs('(%ld)::', src)
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:
242 root = None 268 root = None
243 269