Mercurial API push bookmark

PIERRE AUGIER pierre.augier at univ-grenoble-alpes.fr
Sat Feb 22 20:50:40 UTC 2020


Hi,

I try to run something like `hg push git+ssh://git@github.com/fluiddyn/fluiddyn -B master` in a Mercurial extension.

Please can anyone explain why it does not work with

commands.push(ui, repo, dest=path_github, bookmark="master")

whereas it works well with

subprocess.call(["hg", "push", path_github, "-B", "master"])

???

----- Mail original -----
> De: "PIERRE AUGIER" <pierre.augier at univ-grenoble-alpes.fr>
> À: "mercurial" <mercurial at mercurial-scm.org>
> Envoyé: Mardi 11 Février 2020 12:21:29
> Objet: Mercurial API push bookmark

> Hi,
> 
> I try to write a small Mercurial extension. One of the command would have to do
> something like
> hg pull
> hg up default
> hg bookmark master
> hg sum
> hg push [ mailto:git+ssh://git@github.com/fluiddyn/fluiddyn |
> git+ssh://git@github.com/fluiddyn/fluiddyn ] hg bookmark master -d
> 
> 
> These commands work fine (with hg-git). However, when I try to write this with
> the Mercurial API, i.e.
> @command(b"fluiddyn-push-github", [])
> def fluiddyn_push_github(ui, repo, **opts):
>    commands.pull(ui, repo)
>    commands.update(ui, repo, "default")
>    commands.bookmark(ui, repo, "master")
>    commands.summary(ui, repo)
>    default = dict(repo.ui.configitems(b"paths", untrusted=False))["default"]
>    if "foss.heptapod.net" not in default:
>        ui.write("default points to a wrong path")
>        return
>    package_name = os.path.split(default)[1]
>    path_github = os.path.join(github_base, package_name)
>    commands.push(ui, repo, dest=path_github, bookmark="master")
>    commands.bookmark(ui, repo, "master", delete=True)
> 
> 
> I get
> pulling from ssh://hg@foss.heptapod.net/fluiddyn/fluiddyn
> searching for changes
> no changes found
> 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> (leaving bookmark master)
> parent: 551:177f8acf6d42 tip
> Try to understand the problem with SKIP_SHTNS
> branch: default
> bookmarks: *master
> commit: (clean)
> update: (current)
> pushing to [ mailto:git+ssh://git@github.com/fluiddyn/fluiddyn |
> git+ssh://git@github.com/fluiddyn/fluiddyn ] searching for changes
> abort: revision 000000000000 cannot be pushed since it doesn't have a bookmark
> 
> 
> I don't understand why Mercurial tells me something about revision 000000000000
> as if it was trying to push this revision when
> commands.push(ui, repo, dest=path_github, bookmark="master")
> 
> 
> is called.
> 
> Help would be greatly appreciated.
> --
> Pierre Augier - CR CNRS [ http://www.legi.grenoble-inp.fr/ |
> http://www.legi.grenoble-inp.fr ] LEGI (UMR 5519) Laboratoire des Ecoulements
> Geophysiques et Industriels
> BP53, 38041 Grenoble Cedex, France                tel:+33.4.56.52.86.16
> 
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial



More information about the Mercurial mailing list