def _rebase(orig, ui, repo, **opts): if not opts.get('date') and not ui.configbool('tweakdefaults', 'rebasekeepdate'): opts['date'] = currentdate() if opts.get('continue') or opts.get('abort') or opts.get('restack'): return orig(ui, repo, **opts) # 'hg rebase' w/o args should do nothing if not opts.get('dest'): raise error.Abort("you must specify a destination (-d) for the rebase") # 'hg rebase' can fast-forward bookmark prev = repo['.'] dest = scmutil.revsingle(repo, opts.get('dest')) # Only fast-forward the bookmark if no source nodes were explicitly # specified. if not (opts.get('base') or opts.get('source') or opts.get('rev')): common = dest.ancestor(prev) if prev == common: result = hg.update(repo, dest.node()) if bmactive(repo): with repo.wlock(): bookmarks.update(repo, [prev.node()], dest.node()) return result return orig(ui, repo, **opts)
def docommit(rev): cctx = context.memctx(repo, parents=[rev, None], text=message, files=[], filectxfn=None, user=opts.get('user'), date=opts.get('date'), extra=extra) tr = repo.transaction('commit') ret = repo.commitctx(cctx, True) bookmarks.update(repo, [rev, None], ret) cctx.markcommitted(ret) tr.close()
def pullrebase(orig, ui, repo, *args, **opts): 'Call rebase after pull if the latter has been invoked with --rebase' if opts.get('rebase'): if opts.get('update'): del opts['update'] ui.debug('--update and --rebase are not compatible, ignoring ' 'the update flag\n') movemarkfrom = repo['.'].node() cmdutil.bailifchanged(repo) revsprepull = len(repo) origpostincoming = commands.postincoming def _dummy(*args, **kwargs): pass commands.postincoming = _dummy try: orig(ui, repo, *args, **opts) finally: commands.postincoming = origpostincoming revspostpull = len(repo) if revspostpull > revsprepull: rebase(ui, repo, **opts) branch = repo[None].branch() dest = repo[branch].rev() if dest != repo['.'].rev(): # there was nothing to rebase we force an update hg.update(repo, dest) if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) else: if opts.get('tool'): raise util.Abort(_('--tool can only be used with --rebase')) orig(ui, repo, *args, **opts)
def rebaseorfastforward(orig, ui, repo, dest, **args): """Wrapper for rebasemodule.rebase that fast-forwards the working directory and any active bookmark to the rebase destination if there is actually nothing to rebase. """ prev = repo['.'] destrev = scmutil.revsingle(repo, dest) common = destrev.ancestor(prev) if prev == common and destrev != prev: result = hg.update(repo, destrev.node()) if bmactive(repo): with repo.wlock(): bookmarks.update(repo, [prev.node()], destrev.node()) ui.status(_("nothing to rebase - fast-forwarded to %s\n") % dest) return result return orig(ui, repo, dest=dest, **args)
def pullrebase(orig, ui, repo, *args, **opts): 'Call rebase after pull if the latter has been invoked with --rebase' ret = None if opts.get('rebase'): wlock = lock = None try: wlock = repo.wlock() lock = repo.lock() if opts.get('update'): del opts['update'] ui.debug('--update and --rebase are not compatible, ignoring ' 'the update flag\n') movemarkfrom = repo['.'].node() revsprepull = len(repo) origpostincoming = commands.postincoming def _dummy(*args, **kwargs): pass commands.postincoming = _dummy try: ret = orig(ui, repo, *args, **opts) finally: commands.postincoming = origpostincoming revspostpull = len(repo) if revspostpull > revsprepull: # --rev option from pull conflict with rebase own --rev # dropping it if 'rev' in opts: del opts['rev'] # positional argument from pull conflicts with rebase's own # --source. if 'source' in opts: del opts['source'] rebase(ui, repo, **opts) branch = repo[None].branch() dest = repo[branch].rev() if dest != repo['.'].rev(): # there was nothing to rebase we force an update hg.update(repo, dest) if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): ui.status(_("updating bookmark %s\n") % repo._activebookmark) finally: release(lock, wlock) else: if opts.get('tool'): raise error.Abort(_('--tool can only be used with --rebase')) ret = orig(ui, repo, *args, **opts) return ret
def pullrebase(orig, ui, repo, *args, **opts): 'Call rebase after pull if the latter has been invoked with --rebase' if opts.get('rebase'): wlock = lock = None try: wlock = repo.wlock() lock = repo.lock() if opts.get('update'): del opts['update'] ui.debug('--update and --rebase are not compatible, ignoring ' 'the update flag\n') movemarkfrom = repo['.'].node() revsprepull = len(repo) origpostincoming = commands.postincoming def _dummy(*args, **kwargs): pass commands.postincoming = _dummy try: orig(ui, repo, *args, **opts) finally: commands.postincoming = origpostincoming revspostpull = len(repo) if revspostpull > revsprepull: # --rev option from pull conflict with rebase own --rev # dropping it if 'rev' in opts: del opts['rev'] # positional argument from pull conflicts with rebase's own # --source. if 'source' in opts: del opts['source'] rebase(ui, repo, **opts) branch = repo[None].branch() dest = repo[branch].rev() if dest != repo['.'].rev(): # there was nothing to rebase we force an update hg.update(repo, dest) if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): ui.status(_("updating bookmark %s\n") % repo._activebookmark) finally: release(lock, wlock) else: if opts.get('tool'): raise util.Abort(_('--tool can only be used with --rebase')) orig(ui, repo, *args, **opts)
def pullrebase(orig, ui, repo, *args, **opts): "Call rebase after pull if the latter has been invoked with --rebase" if opts.get("rebase"): if opts.get("update"): del opts["update"] ui.debug("--update and --rebase are not compatible, ignoring " "the update flag\n") movemarkfrom = repo["."].node() revsprepull = len(repo) origpostincoming = commands.postincoming def _dummy(*args, **kwargs): pass commands.postincoming = _dummy try: orig(ui, repo, *args, **opts) finally: commands.postincoming = origpostincoming revspostpull = len(repo) if revspostpull > revsprepull: # --rev option from pull conflict with rebase own --rev # dropping it if "rev" in opts: del opts["rev"] # positional argument from pull conflicts with rebase's own # --source. if "source" in opts: del opts["source"] rebase(ui, repo, **opts) branch = repo[None].branch() dest = repo[branch].rev() if dest != repo["."].rev(): # there was nothing to rebase we force an update hg.update(repo, dest) if bookmarks.update(repo, [movemarkfrom], repo["."].node()): ui.status(_("updating bookmark %s\n") % repo._activebookmark) else: if opts.get("tool"): raise util.Abort(_("--tool can only be used with --rebase")) orig(ui, repo, *args, **opts)
def pullrebase(orig, ui, repo, *args, **opts): 'Call rebase after pull if the latter has been invoked with --rebase' if opts.get('rebase'): if opts.get('update'): del opts['update'] ui.debug('--update and --rebase are not compatible, ignoring ' 'the update flag\n') movemarkfrom = repo['.'].node() cmdutil.bailifchanged(repo) revsprepull = len(repo) origpostincoming = commands.postincoming def _dummy(*args, **kwargs): pass commands.postincoming = _dummy try: orig(ui, repo, *args, **opts) finally: commands.postincoming = origpostincoming revspostpull = len(repo) if revspostpull > revsprepull: rebase(ui, repo, **opts) branch = repo[None].branch() dest = repo[branch].rev() if dest != repo['.'].rev(): # there was nothing to rebase we force an update hg.update(repo, dest) if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): ui.status( _("updating bookmark %s\n") % repo._bookmarkcurrent) else: if opts.get('tool'): raise util.Abort(_('--tool can only be used with --rebase')) orig(ui, repo, *args, **opts)