AnatomicMaps / flatmap-maker

Make anatomical flatmaps from SVG diagrams, Powerpoint slides, and other sources.
Apache License 2.0
2 stars 6 forks source link

Mapmaker crashing with 'Head' reference error #32

Closed keeran97 closed 1 year ago

keeran97 commented 1 year ago

Mapmaker v1.5.5-b.2 crashes with ERROR: Ref 'Head' did not resolve to an object. The output is copied below. The sources used are at the head of the main branch of the rat flatmap repo.

FYI, when testing out the documentation, Mabelle also experienced this bug.

2023-01-20 15:45:26,672 INFO: Mapmaker 1.5.5-b.2
2023-01-20 15:45:26,765 ERROR: Ref 'Head' did not resolve to an object
Traceback (most recent call last):
  File "/home/keeran/flatmap-maker/mapmaker/__main__.py", line 101, in main
    mapmaker = MapMaker(vars(args))
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 329, in __init__
    self.__manifest = Manifest(options['source'], single_file=options.get('singleFile'), id=options.get('id'))
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 144, in __init__
    self.__repo = MapRepository(pathlib.Path(manifest_path).parent)
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 82, in __init__
    self.__staged_items = [ item.a_path for item in self.__repo.index.diff('Head') ]
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/index/base.py", line 1386, in diff
    other = self.repo.rev_parse(other)
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/repo/fun.py", line 377, in rev_parse
    obj = cast(Commit_ish, name_to_object(repo, rev))
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/repo/fun.py", line 183, in name_to_object
    raise BadName(name)
gitdb.exc.BadName: Ref 'Head' did not resolve to an object

image

dbrnz commented 1 year ago

What does git status show in your map source working directory?

keeran97 commented 1 year ago
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

image

dbrnz commented 1 year ago

@keeran97 could you please test this using the HEAD of the v1.5 branch. Thanks.

keeran97 commented 1 year ago

@dbrnz i am unable to poetry update or spawn a shell. I am getting Invalid PEP 440 version: '1.5.5-devel'

image

dbrnz commented 1 year ago

Thanks! Please git pull and try again.

BTW, you could copy-and-paste error messages from your console window rather than taking screenshots...

keeran97 commented 1 year ago

@dbrnz ran into this bug. source is still the head of the main branch of rat flatmap. command line is python runmaker.py --source ../flatmap-sources/new-rat/manifest.json --output ../flatmaps --debug

Traceback (most recent call last):
  File "/home/keeran/flatmap-maker/runmaker.py", line 21, in <module>
    from mapmaker.__main__ import main
  File "/home/keeran/flatmap-maker/mapmaker/__init__.py", line 36, in <module>
    from .maker import MapMaker
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 52, in <module>
    from .output.tilemaker import RasterTileMaker
  File "/home/keeran/flatmap-maker/mapmaker/output/tilemaker.py", line 37, in <module>
    from mapmaker.sources import add_alpha, blank_image, mask_image, not_empty
  File "/home/keeran/flatmap-maker/mapmaker/sources/__init__.py", line 264, in <module>
    from .fc_powerpoint import FCPowerpoint
  File "/home/keeran/flatmap-maker/mapmaker/sources/fc_powerpoint/__init__.py", line 48
    from .json_annotator import JsonAnnotator
    ^^^^
SyntaxError: invalid syntax
dbrnz commented 1 year ago

Hmm, my unreleased, WIP code getting in the way... Please test again, but using HEAD of the main branch (instead of v1.5).

keeran97 commented 1 year ago

I am getting the 'Head' ref error again.

2023-01-23 10:56:37,604 INFO: Mapmaker 1.5.5-dev0
2023-01-23 10:56:37,697 ERROR: Ref 'Head' did not resolve to an object
Traceback (most recent call last):
  File "/home/keeran/flatmap-maker/mapmaker/__main__.py", line 101, in main
    mapmaker = MapMaker(vars(args))
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 336, in __init__
    self.__manifest = Manifest(options['source'], single_file=options.get('singleFile'), id=options.get('id'))
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 147, in __init__
    self.__repo = MapRepository(pathlib.Path(manifest_path).parent)
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 82, in __init__
    self.__staged_items = [ item.a_path for item in self.__repo.index.diff('Head') ]
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/index/base.py", line 1386, in diff
    other = self.repo.rev_parse(other)
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/repo/fun.py", line 377, in rev_parse
    obj = cast(Commit_ish, name_to_object(repo, rev))
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/repo/fun.py", line 183, in name_to_object
    raise BadName(name)
gitdb.exc.BadName: Ref 'Head' did not resolve to an object
dbrnz commented 1 year ago

Would you run Python (in mapmaker's virtual environment) and:

import git
print(git.__version__)

Thanks.

dbrnz commented 1 year ago

Also could you checkout the issue-32 branch and try that. It will print out a line of information before failing.

keeran97 commented 1 year ago

output of the git version is 3.1.30

output of using branch issue-32 is below

2023-01-23 12:52:16,945 INFO: Mapmaker 1.5.5-dev0
WD: ../flatmap-sources/new-rat, /home/keeran/flatmap-sources/new-rat
2023-01-23 12:52:17,041 ERROR: Ref 'Head' did not resolve to an object
Traceback (most recent call last):
  File "/home/keeran/flatmap-maker/mapmaker/__main__.py", line 101, in main
    mapmaker = MapMaker(vars(args))
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 342, in __init__
    self.__manifest = Manifest(options['source'], single_file=options.get('singleFile'), id=options.get('id'))
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 153, in __init__
    self.__repo = MapRepository(pathlib.Path(manifest_path).parent)
  File "/home/keeran/flatmap-maker/mapmaker/maker.py", line 85, in __init__
    self.__staged_items = [ item.a_path for item in self.__repo.index.diff('Head') ]
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/index/base.py", line 1386, in diff
    other = self.repo.rev_parse(other)
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/repo/fun.py", line 377, in rev_parse
    obj = cast(Commit_ish, name_to_object(repo, rev))
  File "/home/keeran/.cache/pypoetry/virtualenvs/mapmaker-NDtPvMnW-py3.10/lib/python3.10/site-packages/git/repo/fun.py", line 183, in name_to_object
    raise BadName(name)
gitdb.exc.BadName: Ref 'Head' did not resolve to an object
dbrnz commented 1 year ago

Could you try:

  1. Changing Head to HEAD in line 85 of ./mapmaker/maker.py and seeing if things work.
  2. In /home/keeran/flatmap-sources/new-rat do both get diff Head and git diff HEAD.

Thanks.

keeran97 commented 1 year ago

yup, changing Head to HEAD fixed things. I've successfully generated the map now.

output of git diff Head is below. git diff HEAD has no output

fatal: ambiguous argument 'Head': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
dbrnz commented 1 year ago

Fixed with commit 7c4b550 in main.