##// END OF EJS Templates
rebase: factor out nothing to rebase return code...
Ryan McElroy -
r26671:66dc39cd default
parent child Browse files
Show More
@@ -41,6 +41,9 b' command = cmdutil.command(cmdtable)'
41 # leave the attribute unspecified.
41 # leave the attribute unspecified.
42 testedwith = 'internal'
42 testedwith = 'internal'
43
43
44 def _nothingtorebase():
45 return 1
46
44 def _savegraft(ctx, extra):
47 def _savegraft(ctx, extra):
45 s = ctx.extra().get('source', None)
48 s = ctx.extra().get('source', None)
46 if s is not None:
49 if s is not None:
@@ -290,13 +293,13 b' def rebase(ui, repo, **opts):'
290 if not rebaseset:
293 if not rebaseset:
291 ui.status(_('empty "rev" revision set - '
294 ui.status(_('empty "rev" revision set - '
292 'nothing to rebase\n'))
295 'nothing to rebase\n'))
293 return 1
296 return _nothingtorebase()
294 elif srcf:
297 elif srcf:
295 src = scmutil.revrange(repo, [srcf])
298 src = scmutil.revrange(repo, [srcf])
296 if not src:
299 if not src:
297 ui.status(_('empty "source" revision set - '
300 ui.status(_('empty "source" revision set - '
298 'nothing to rebase\n'))
301 'nothing to rebase\n'))
299 return 1
302 return _nothingtorebase()
300 rebaseset = repo.revs('(%ld)::', src)
303 rebaseset = repo.revs('(%ld)::', src)
301 assert rebaseset
304 assert rebaseset
302 else:
305 else:
@@ -304,7 +307,7 b' def rebase(ui, repo, **opts):'
304 if not base:
307 if not base:
305 ui.status(_('empty "base" revision set - '
308 ui.status(_('empty "base" revision set - '
306 "can't compute rebase set\n"))
309 "can't compute rebase set\n"))
307 return 1
310 return _nothingtorebase()
308 commonanc = repo.revs('ancestor(%ld, %d)', base, dest).first()
311 commonanc = repo.revs('ancestor(%ld, %d)', base, dest).first()
309 if commonanc is not None:
312 if commonanc is not None:
310 rebaseset = repo.revs('(%d::(%ld) - %d)::',
313 rebaseset = repo.revs('(%d::(%ld) - %d)::',
@@ -337,7 +340,7 b' def rebase(ui, repo, **opts):'
337 else: # can it happen?
340 else: # can it happen?
338 ui.status(_('nothing to rebase from %s to %s\n') %
341 ui.status(_('nothing to rebase from %s to %s\n') %
339 ('+'.join(str(repo[r]) for r in base), dest))
342 ('+'.join(str(repo[r]) for r in base), dest))
340 return 1
343 return _nothingtorebase()
341
344
342 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
345 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
343 if (not (keepf or allowunstable)
346 if (not (keepf or allowunstable)
@@ -365,7 +368,7 b' def rebase(ui, repo, **opts):'
365 if not result:
368 if not result:
366 # Empty state built, nothing to rebase
369 # Empty state built, nothing to rebase
367 ui.status(_('nothing to rebase\n'))
370 ui.status(_('nothing to rebase\n'))
368 return 1
371 return _nothingtorebase()
369
372
370 root = min(rebaseset)
373 root = min(rebaseset)
371 if not keepf and not repo[root].mutable():
374 if not keepf and not repo[root].mutable():
General Comments 0
You need to be logged in to leave comments. Login now