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 git+ssh://g...@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://h...@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 git+ssh://g...@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
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@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial

Reply via email to