How to use cookiecutter from foss.heptapod.net

How can I use the command:
cookiecutter hg+https://hg.tryton.org/cookiecutter ?

You can no more.
But you can use the provided example of the tutorial: Setup — Tryton server

I I get an error:

cookiecutter hg+https://code.tryton.org/tryton --directory cookiecutter-module

RESULT:

adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0]
** Mercurial Distributed SCM (version 6.7)
** Extensions loaded: 
Traceback (most recent call last):
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/bin/hg", line 59, in <module>
    dispatch.run()
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 142, in run
    status = dispatch(req)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 231, in dispatch
    status = _rundispatch(req)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 275, in _rundispatch
    ret = _runcatch(req) or 0
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 456, in _runcatch
    return _callcatch(ui, _runcatchfunc)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 466, in _callcatch
    return scmutil.callcatch(ui, func)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/scmutil.py", line 152, in callcatch
    return func()
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 446, in _runcatchfunc
    return _dispatch(req)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 1271, in _dispatch
    return runcommand(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 904, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 1283, in _runcommand
    return cmdfunc()
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/dispatch.py", line 1269, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/util.py", line 1878, in check
    return func(*args, **kwargs)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/commands.py", line 2033, in clone
    r = hg.clone(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/hg.py", line 1016, in clone
    exchange.pull(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/exchange.py", line 1709, in pull
    _maybeapplyclonebundle(pullop)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/exchange.py", line 2837, in _maybeapplyclonebundle
    if trypullbundlefromurl(repo.ui, repo, url, remote):
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/exchange.py", line 2879, in trypullbundlefromurl
    bundle2.applybundle(repo, cg, tr, b'clonebundles', url)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/bundle2.py", line 383, in applybundle
    return processbundle(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/bundle2.py", line 508, in processbundle
    processparts(repo, op, unbundler)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/bundle2.py", line 516, in processparts
    _processpart(op, part)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/bundle2.py", line 594, in _processpart
    handler(op, part)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/bundle2.py", line 2092, in handlechangegroup
    ret = _processchangegroup(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/bundle2.py", line 524, in _processchangegroup
    ret = cg.apply(op.repo, tr, source, url, **kwargs)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/changegroup.py", line 633, in apply
    newrevs, newfiles = _addchangegroupfiles(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/changegroup.py", line 2405, in _addchangegroupfiles
    added = fl.addgroup(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/filelog.py", line 182, in addgroup
    return self._revlog.addgroup(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/revlog.py", line 3452, in addgroup
    rev = self._addrevision(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/revlog.py", line 3187, in _addrevision
    deltainfo = deltacomputer.finddeltainfo(revinfo)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/revlogutils/deltas.py", line 1749, in finddeltainfo
    search.next_group(deltainfo)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/mercurial/revlogutils/deltas.py", line 879, in next_group
    next_idx = self._internal_idx + self._group_chunk_size
AttributeError: '_SparseDeltaSearch' object has no attribute '_group_chunk_size'

Traceback (most recent call last):
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/bin/cookiecutter", line 8, in <module>
    sys.exit(main())
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/cookiecutter/cli.py", line 203, in main
    cookiecutter(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/cookiecutter/main.py", line 80, in cookiecutter
    base_repo_dir, cleanup_base_repo_dir = determine_repo_dir(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/cookiecutter/repository.py", line 108, in determine_repo_dir
    cloned_repo = clone(
  File "/home/trytond/projects/docker-tryton-off-7/custom_modules/.venv/lib/python3.8/site-packages/cookiecutter/vcs.py", line 105, in clone
    subprocess.check_output(  # nosec
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['hg', 'clone', 'https://foss.heptapod.net/tryton/tryton']' returned non-zero exit status 1.

Looks like a mercurial bug, it should be reported to the project.

For the record: https://bz.mercurial-scm.org/show_bug.cgi?id=6869

You may want to use the cookiecutter template from Tryton Community. It is prepared for 3rd-party modules and reduces the boilerplate by using trytoncommunity-setuptools.

  cookiecutter --output-dir WHERE-YOUR-MODULES-ARE \
     https://foss.heptapod.net/tryton-community/cookiecutter-module.git

Thanks, the cookiecutter you mentioned works fine!

1 Like

The bug report has been updated. An MR (draft) has been created for testing.

https://bz.mercurial-scm.org/show_bug.cgi?id=6869

Fixed in version 6.7.1

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.