def restore(): """Rewrite .hg/store/{bookmarks,remotenames} with backup""" for name in ["bookmarks", "remotenames"]: path = ".hg/store/%s" % name sh.cp("%s.bak" % path, path)
sh % "hg add -q" sh % "hg commit -q -m base" sh % "echo 'new content'" > "file" sh % "hg mv file file_new" sh % "hg commit -m a" sh % "hg book -r . a" # Recreate the same commit: sh % "hg up -q '.~1'" sh % "echo 'new content'" > "file" sh % "hg mv file file_new" sh % "hg commit -m b" sh % "hg book -r . b" reponame = "../without-imm-%s" % userustmanifest sh.cp("-R", ".", reponame) # Rebase one version onto the other, confirm it gets rebased out: sh % "hg rebase -r b -d a" == r""" rebasing in-memory! rebasing 811ec875201f "b" (b) note: rebase of 2:811ec875201f created no changes to commit""" # Without IMM, this behavior is semi-broken: the commit is not rebased out and the # created commit is empty. (D8676355) sh.cd(reponame) sh % "setconfig 'rebase.experimental.inmemory=0'" sh % "hg rebase -r b -d a" == r""" rebasing 811ec875201f "b" (b) warning: can't find ancestor for 'file_new' copied from 'file'!"""
def backup(): """Backup .hg/store/{bookmarks,remotenames}""" for name in ["bookmarks", "remotenames"]: path = ".hg/store/%s" % name sh.cp(path, "%s.bak" % path)