initialcommit-com / git-sim Goto Github PK
View Code? Open in Web Editor NEWVisually simulate Git operations in your own repos with a single terminal command.
License: GNU General Public License v2.0
Visually simulate Git operations in your own repos with a single terminal command.
License: GNU General Public License v2.0
I wanted to give git-sim
a go, because it seems interesting. I therefore installed it on my windows machine, like this:
choco install manimce
pip install git-sim
I have python 3.10. Now, I wanted to quickly check if it works and in one of my repositories, I ran
git-sim reset -h
which tells me that the reset works like this:
git-sim reset [-h] [--mode MODE] [--soft] [--mixed] [--hard] [commit]
So essentially all options are optional, i.e. I should be able to run git-sim reset
, which I did, with the following result:
$ git-sim reset
Simulating: git reset HEAD
Traceback (most recent call last):
File "C:\Users\lmichel\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\lmichel\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\lmichel\AppData\Local\Programs\Python\Python310\Scripts\git-sim.exe\__main__.py", line 7, in <module>
File "C:\Users\lmichel\AppData\Local\Programs\Python\Python310\lib\site-packages\git_sim\__main__.py", line 89, in main
scene.render()
File "C:\tools\Manim\Lib\site-packages\manim\scene\scene.py", line 223, in render
self.construct()
File "C:\Users\lmichel\AppData\Local\Programs\Python\Python310\lib\site-packages\git_sim\git_sim.py", line 56, in construct
self.command.execute()
File "C:\Users\lmichel\AppData\Local\Programs\Python\Python310\lib\site-packages\git_sim\git_sim_reset.py", line 41, in execute
self.parse_commits(self.commits[self.i])
File "C:\Users\lmichel\AppData\Local\Programs\Python\Python310\lib\site-packages\git_sim\git_sim_base_command.py", line 77, in parse_commits
commitId, circle, arrow, hide_refs = self.draw_commit(commit, prevCircle, shift, dots)
File "C:\Users\lmichel\AppData\Local\Programs\Python\Python310\lib\site-packages\git_sim\git_sim_base_command.py", line 173, in draw_commit
commitId, commitMessage, commit, hide_refs = self.build_commit_id_and_message(commit, dots)
TypeError: GitSimReset.build_commit_id_and_message() takes 2 positional arguments but 3 were given
Sounds crazy, not sure I will continue to git-sim
if I get such an issue after the first command. I also tried git-sim tag
. That one seems fine.
I can't reopen the previous issue, so I'm opening a new one ๐
Thanks for the quick fix! Now it looks like this:
Much more manageable. But... I think it should use all the available space if possible. What do you think about it?
Originally posted by @eltoncezar in #25 (comment)
I observed one thing when I run git-sim add , and if we have files in working mods and untracked files, the arrow from column 1 to column 3 is drawn over the file names in column 2. This is not definitive, but running the same command multiple times gives the problematic visualization.
Filing an issue so that we can keep a track and fix it in the future.
It would be nice with support for outputting .webm
videos.
A git branch name can include slash symbol(/).
e.g) feature/feature-A
However, git-sim
throws KeyError
if the branches's name include slash.
There is the reason most likely in following lines.
git-sim/git_sim/git_sim_base_command.py
Lines 319 to 327 in 84811ee
This if-statement conditional branch is insufficient.
If possible, could you consider other means of determining whether a branch is a remote branch or not?
I also try to explore the way. (I am not familiar with Python and Git, so it is perhaps difficult for me to make Pull Request about this issue.)
Trying to use git-sim add
on a newly created repository with no commits throws a git-sim error: "No commits in current Git repository". git add
should not depend on any commits currently existing in the repository.
Btw, I love this project and am really excited to see where it will go in the future :)
I have successfully installed manim
, but running pip3 install git-sim
yields the following error:
...
Requirement already satisfied: six in c:\tools\manim\lib\site-packages (from multipledispatch->pyrr<1,>=0.10.3->moderngl-window<3.0.0,>=2.3.0->manim->git-sim) (1.16.0)
Installing collected packages: git-sim
WARNING: Failed to write executable - trying to use .deleteme logic
ERROR: Could not install packages due to an OSError: [WinError 2] The system cannot find the file specified: 'C:\\Python310\\Scripts\\git-sim.exe' -> 'C:\\Python310\\Scripts\\git-sim.exe.deleteme'
I am not familiar with Python, maybe this is a newbie error of some sort. What should I do?
Try using git-sim (great idea btw ;) on Windows 10 with Python 3.11 and get:
RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
Manim Community v0.17.2
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python311\Scripts\git-sim.exe\__main__.py", line 7, in <module>
File "C:\Python311\Lib\site-packages\git_sim\__main__.py", line 248, in main
scene = gs.GitSim(args)
^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\git_sim\git_sim.py", line 20, in __init__
super().__init__()
File "C:\Python311\Lib\site-packages\manim\scene\moving_camera_scene.py", line 92, in __init__
super().__init__(camera_class=camera_class, **kwargs)
File "C:\Python311\Lib\site-packages\manim\scene\scene.py", line 141, in __init__
self.renderer.init_scene(self)
File "C:\Python311\Lib\site-packages\manim\renderer\cairo_renderer.py", line 49, in init_scene
self.file_writer: Any = self._file_writer_class(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\manim\scene\scene_file_writer.py", line 88, in __init__
raise RuntimeError(
RuntimeError: Manim could not find ffmpeg, which is required for generating video output.
For installing ffmpeg please consult https://docs.manim.community/en/stable/installation.html
Make sure to either add ffmpeg to the PATH environment variable
or set path to the ffmpeg executable under the ffmpeg header in Manim's configuration.
I think it is easy to fix by myself - but maybe if you want to share your project you should know about it.
The switch
command is generally recommended over checkout
for a few years now (as far as I know at least), so it would be nice if git-sim
could also support switch
.
Tried 'git-sim merge master':
(process:37120): GLib-GIO-WARNING **: 09:43:15.672: Unexpectedly, UWP app `Clipchamp.Clipchamp_2.5.15.0_neutral__yxz26nhyzhsrt' (AUMId `Clipchamp.Clipchamp_yxz26nhyzhsrt!App') supports 41 extensions but has no verbs
Traceback (most recent call last):
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Python310\Scripts\git-sim.exe\__main__.py", line 7, in <module>
File "C:\Python310\lib\site-packages\git_sim\__main__.py", line 89, in main
scene.render()
File "C:\Python310\lib\site-packages\manim\scene\scene.py", line 223, in render
self.construct()
File "C:\Python310\lib\site-packages\git_sim\git_sim.py", line 56, in construct
self.command.execute()
File "C:\Python310\lib\site-packages\git_sim\git_sim_merge.py", line 67, in execute
self.draw_arrow_between_commits("abcdef", self.commits[0].hexsha)
File "C:\Python310\lib\site-packages\git_sim\git_sim_base_command.py", line 486, in draw_arrow_between_commits
end = self.drawnCommits[endsha].get_center()
KeyError: 'f54faa9550d5141eddac736b3f27214f8181aba0'
I installed the package on a mac M1, following the required dependencies and no errors.
When running git-sim -h
:
Traceback (most recent call last):
File "/opt/homebrew/anaconda3/envs/git-sim/bin/git-sim", line 5, in
from git_sim.main import main
File "/opt/homebrew/anaconda3/envs/git-sim/lib/python3.11/site-packages/git_sim/main.py", line 1, in
import git_sim.git_sim as gs
File "/opt/homebrew/anaconda3/envs/git-sim/lib/python3.11/site-packages/git_sim/git_sim.py", line 1, in
from manim import *
File "/opt/homebrew/anaconda3/envs/git-sim/lib/python3.11/site-packages/manim/init.py", line 26, in
from .animation.composition import *
File "/opt/homebrew/anaconda3/envs/git-sim/lib/python3.11/site-packages/manim/animation/composition.py", line 16, in
from ..scene.scene import Scene
File "/opt/homebrew/anaconda3/envs/git-sim/lib/python3.11/site-packages/manim/scene/scene.py", line 38, in
from ..camera.camera import Camera
File "/opt/homebrew/anaconda3/envs/git-sim/lib/python3.11/site-packages/manim/camera/camera.py", line 16, in
import cairo
File "/opt/homebrew/anaconda3/envs/git-sim/lib/python3.11/site-packages/cairo/init.py", line 1, in
from ._cairo import * # noqa: F401,F403
^^^^^^^^^^^^^^^^^^^^^
ImportError: dlopen(/opt/homebrew/anaconda3/envs/git-sim/lib/python3.11/site-packages/cairo/_cairo.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace '_cairo_append_path'
Here is a simple reproducer of an error for a simple rebase (one root commit, two branches with one commit in each, rebase on on the other).
> git init
Initialized empty Git repository in /home/demarteaub/projects/version-sample/.git/
> git commit --allow-empty -m "initial commit"
[main (root-commit) d41bc20] initial commit
> git switch -c dev
> git commit --allow-empty -m "some development"
[dev 938ab0b] some development
> git switch main
Switched to branch 'main'
> git commit --allow-empty -m "bugfix"
[main bd7e0e7] bugfix
> git switch dev
Switched to branch 'dev'
> git_sim_media_dir=../version-sample.git-sim git-sim rebase main
Simulating: git rebase main
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/rebase.py:191 โ
โ in rebase โ
โ โ
โ 188 โ ) โ
โ 189 ): โ
โ 190 โ scene = Rebase(branch=branch) โ
โ โฑ 191 โ handle_animations(scene=scene) โ
โ 192 โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ branch = 'main' โ โ
โ โ scene = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/animations.py:1 โ
โ 7 in handle_animations โ
โ โ
โ 14 โ
โ 15 โ
โ 16 def handle_animations(scene: Scene) -> None: โ
โ โฑ 17 โ scene.render() โ
โ 18 โ โ
โ 19 โ if settings.video_format == "webm": โ
โ 20 โ โ webm_file_path = str(scene.renderer.file_writer.movie_file_path)[:-3] + "webm" โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ scene = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/manim/scene/scene.py:22 โ
โ 3 in render โ
โ โ
โ 220 โ โ """ โ
โ 221 โ โ self.setup() โ
โ 222 โ โ try: โ
โ โฑ 223 โ โ โ self.construct() โ
โ 224 โ โ except EndSceneEarlyException: โ
โ 225 โ โ โ pass โ
โ 226 โ โ except RerunSceneException as e: โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ preview = False โ โ
โ โ self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/rebase.py:72 in โ
โ construct โ
โ โ
โ 69 โ โ head_commit = self.get_commit() โ
โ 70 โ โ โ
โ 71 โ โ reached_base = False โ
โ โฑ 72 โ โ for commit in self.get_default_commits(): โ
โ 73 โ โ โ if commit != "dark" and self.branch in self.repo.git.branch( โ
โ 74 โ โ โ โ "--contains", commit โ
โ 75 โ โ โ ): โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ branch_commit = <git.Commit "bd7e0e7e24bc655b1e25f73645a5b24f5823058b"> โ โ
โ โ head_commit = <git.Commit "938ab0b25e2e6f0ed9b3b6f40be43ad2b6409f64"> โ โ
โ โ reached_base = False โ โ
โ โ self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /home/demarteaub/.local/pipx/venvs/git-sim/lib64/python3.9/site-packages/git_sim/git_sim_base_co โ
โ mmand.py:68 in get_default_commits โ
โ โ
โ 65 โ def get_default_commits(self): โ
โ 66 โ โ defaultCommits = [self.get_commit()] โ
โ 67 โ โ for x in range(self.n_default - 1): โ
โ โฑ 68 โ โ โ defaultCommits.append(defaultCommits[-1].parents[0]) โ
โ 69 โ โ return defaultCommits โ
โ 70 โ โ
โ 71 โ def parse_commits( โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ defaultCommits = [ โ โ
โ โ โ <git.Commit "938ab0b25e2e6f0ed9b3b6f40be43ad2b6409f64">, โ โ
โ โ โ <git.Commit "d41bc20b7c357301d89b3c3c515b1122850864d2"> โ โ
โ โ ] โ โ
โ โ self = <git_sim.rebase.Rebase object at 0x7f0ff5ab3520> โ โ
โ โ x = 1 โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
IndexError: tuple index out of range
This didn't work at all:
git-sim rebase main
Simulating: git rebase main
Traceback (most recent call last):
File "/usr/local/bin/git-sim", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/site-packages/git_sim/__main__.py", line 261, in main
scene.render()
File "/usr/local/lib/python3.10/site-packages/manim/scene/scene.py", line 223, in render
self.construct()
File "/usr/local/lib/python3.10/site-packages/git_sim/git_sim.py", line 56, in construct
self.command.execute()
File "/usr/local/lib/python3.10/site-packages/git_sim/git_sim_rebase.py", line 73, in execute
if self.scene.args.branch[0] in self.repo.git.branch("--contains", commit):
File "/usr/local/lib/python3.10/site-packages/git/cmd.py", line 741, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/git/cmd.py", line 1315, in _call_process
return self.execute(call, **exec_kwargs)
File "/usr/local/lib/python3.10/site-packages/git/cmd.py", line 1109, in execute
raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(129)
cmdline: git branch --contains dark
stderr: 'error: malformed object name dark'
I created a local test repo to create some illustrations, but couldn't even get the basic example to work. I got two branches in my repo called *feature/1
and main
.
First off, this is a very cool project. Thank you for it!
One thing I don't like is that git-sim stores it's media files in the local project directory, and it's easy to accidentally commit them to the git repo if it hasn't been added to the .gitignore file. Most of the time I think the images/videos are only needed temporarily, and could be deleted. There is the --media-dir
parameter, but having to provide it every time you use git-sim is cumbersome.
There's a few different ways you could tackle this problem. Some thoughts I had were:
Maybe you (or others) have other suggestions?
Hi, I just installed git-sim on my Ubuntu 20.04.5, following the Quickstart guide, but when I try to run it, I get this error on the terminal:
command not found: git-sim
.
How can I manually add git-sim to my path?
The documentation says it will generate images unless --animate
is provided to the command line, I can't seem to not generate videos.
> git-sim -d --img-format=png --no-animate --low-quality --media-dir=../version-sample.git-sim --all merge dev
Simulating: git merge dev
Output image location: ../version-sample.git-sim/git-sim_media/version-sample/images/git-sim-merge_03-15-23_14-55-45.png
> find ../version-sample.git-sim
../version-sample.git-sim
../version-sample.git-sim/git-sim_media
../version-sample.git-sim/git-sim_media/version-sample
../version-sample.git-sim/git-sim_media/version-sample/videos
../version-sample.git-sim/git-sim_media/version-sample/videos/480p15
../version-sample.git-sim/git-sim_media/version-sample/videos/480p15/git-sim-merge_03-15-23_14-55-45.mp4
../version-sample.git-sim/git-sim_media/version-sample/videos/480p15/partial_movie_files
../version-sample.git-sim/git-sim_media/version-sample/videos/480p15/partial_movie_files/Merge
../version-sample.git-sim/git-sim_media/version-sample/videos/480p15/partial_movie_files/Merge/1559455761_51972775_1184456380.mp4
../version-sample.git-sim/git-sim_media/version-sample/videos/480p15/partial_movie_files/Merge/partial_movie_file_list.txt
../version-sample.git-sim/git-sim_media/version-sample/texts
../version-sample.git-sim/git-sim_media/version-sample/texts/eb86629d54dd331d.svg
../version-sample.git-sim/git-sim_media/version-sample/texts/06ce9cf5e00359e1.svg
../version-sample.git-sim/git-sim_media/version-sample/texts/bae3cfb60178f8cf.svg
../version-sample.git-sim/git-sim_media/version-sample/texts/177c442328e6a07a.svg
../version-sample.git-sim/git-sim_media/version-sample/texts/642cbb1c7323e76e.svg
../version-sample.git-sim/git-sim_media/version-sample/texts/18448f657b077afa.svg
../version-sample.git-sim/git-sim_media/version-sample/texts/d7e7e68bfe087ec3.svg
../version-sample.git-sim/git-sim_media/version-sample/images
../version-sample.git-sim/git-sim_media/version-sample/images/git-sim-merge_03-15-23_14-55-45.png
System infos:
> cat /etc/system-release
Rocky Linux release 8.7 (Green Obsidian)
> uname -r
5.15.90.1-microsoft-standard-WSL2
> dnf list --installed ffmpeg cairo pango | cat
Installed Packages
cairo.x86_64 1.15.12-6.el8 @appstream
ffmpeg.x86_64 4.2.8-1.el8 @rpmfusion-free-updates
pango.x86_64 1.42.4-8.el8 @appstream
> pipx list
venvs are in /home/demarteaub/.local/pipx/venvs
apps are exposed on your $PATH at /home/demarteaub/.local/bin
package git-sim 0.2.7, installed using Python 3.9.13
- git-dummy
- git-sim
Currently only git commit
is supported.
Amending would be quite easy to show, I think.
When I find the time, I might try to implement it, but if anybody feels the urge, feel free to do it. (;
From my first foray through the code, it would be similar to the additional flags in reset
.
I have just installed git-sim v0.2.3 on Windows 10 v10.0.19044 via pip3 install git-sim
after installing Manim with choco install manimce
. Chocolatey installed the following packages:
- manimce v0.17.2
- python v3.10.8
- python3 v3.10.8
- ffmpeg v5.1.2
- vcredist2015 v14.0.24215.20170201
For python3 Chocolatey output the following log entries:
Installing 64-bit python3...
python3 has been installed.
WARNING: Provided python InstallDir was ignored by the python installer
WARNING: Its probable that you had pre-existing python installation
WARNING: Python installed to: 'C:\Program Files\Python310'
WARNING: Installation folder is not the default. Not changing permissions. Please ensure your installation is secure.
For python Chocolatey output these log entries:
Found Python 3.10 from Registry
Found Install Path - C:\Program Files\Python310\python.exe
Found python at 'C:\Program Files\Python310\python.exe' using it.
Using python version Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
When I run git-sim log
the following text is output and git-sim seems to hang. I.e. nothing happens for several minutes.
Simulating: git log
(process:2796): GLib-GIO-WARNING **: 22:04:04.968: Unexpectedly, UWP app50582LuanNguyen.NuGetPackageExplorer_6.0.64.0_x64__w6y2tyx5bpzwa' (AUMId
50582LuanNguyen.NuGetPackageExplorer_w6y2tyx5bpzwa!App') supports 3 extensions but has no verbs
After a few minutes I hit Ctrl+C and git-sim output Aborted.
to the terminal and then exited.
After aborting the following directories were created:
git-sim_media\Apps.Bison\images
git-sim_media\Apps.Bison\texts
git-sim_media\Apps.Bison\videos
I ran git-sim from the directory \Dev\Apps.Bison\GlobalPlatform\PlatformAddins\GlobalPlatformAddin
. The images and videos directories are empty but the texts directory contains 10 .svg files.
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmp7na_a560 get_requires_for_build_wheel /tmp/tmp06pru30b
cwd: /tmp/pip-install-yv59yffo/manimpango
Complete output (28 lines):
Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangocairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pangocairo' found
Traceback (most recent call last):
File "", line 136, in check_min_version
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['pkg-config', '--print-errors', '--atleast-version', '1.30.0', 'pangocairo']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
ERROR: Command errored out with exit status 1: /usr/bin/python3 /tmp/tmp7na_a560 get_requires_for_build_wheel /tmp/tmp06pru30b Check the logs for full command output.
administrator@Koper:~$
I want to add git-dummy as a dependency for Git-Sim so that we can add a --generate
flag to enable the creation of a dummy Git repo to run the simulation on with a single command, something like this:
$ git-sim --generate --branches=2 --commits=10 log
I set this up locally by updating the setup.py
to add the git-dummy
package into install_requires
, and also added a new entry point for it so that it can be called as a subprocess:
entry_points={
"console_scripts": [
"git-sim=git_sim.__main__:app",
"git-dummy=git_dummy.__main__:app",
],
},
I added some code into main to call git-dummy to create the new repo when the --generate
flag is set:
if settings.generate:
subprocess.call("git-dummy --no-subdir", shell=True)
This works, but I wonder if we can clean it up so we don't need a separate git-dummy
endpoint and can just call methods within the git-dummy package. This would also avoid the need to call subprocess
.
Also, I wonder if there is a nifty way to handle the git-dummy command line arguments, like --branches, --commit, --diverge-at
without redefining them in Git-Sim.
@paketb0te Any thoughts on this?
Even after following installation directions and restart computer I cannot use git-sim.
I don't know how the images are rendered, but it looks like the fonts are not specified and it picks up default from somewhere. I have large fonts enabled anywhere I can for reasons. This is the output generated right after install with no customization applied yet:
System infos:
> cat /etc/system-release
Rocky Linux release 8.7 (Green Obsidian)
> uname -r
5.15.90.1-microsoft-standard-WSL2
> dnf list --installed ffmpeg cairo pango | cat
Installed Packages
cairo.x86_64 1.15.12-6.el8 @appstream
ffmpeg.x86_64 4.2.8-1.el8 @rpmfusion-free-updates
pango.x86_64 1.42.4-8.el8 @appstream
> pipx list
venvs are in /home/demarteaub/.local/pipx/venvs
apps are exposed on your $PATH at /home/demarteaub/.local/bin
package git-sim 0.2.7, installed using Python 3.9.13
- git-dummy
- git-sim
Hi @initialcommit-io , it's me again ๐
With the inheritance model simplified, I think there is one other thing we could greatly improve - the way the command line arguments are handled.
I am a big fan of Typer, that tool makes it super easy to manage all that stuff - and it gives type hints!
The docs are also great and explain the whole concept better than I could ever do here, so maybe you want to have a look at that :)
I have worked on a branch showcasing the concept for some of the commands (log
and status
for now), check it out: typer
The basic idea is that each command is a function, and the function arguments are the corresponding CLI arguments / flags / options. But we don't have to do all that argparse
stuff (setting up parsers and subparsers in main()
, and having to sync that with the args.subcommand
in the actual Command classes ...).
Let me know if you like it!
I want to play around with the source code a little bit, so I've cloned the repository locally.
What do I do in order to run my local version? I don't see anything in README.md
about this.
Hi, when trying to simulate the pop operation, i am getting the following error.
โฏ git-sim stash push my-file.py
git-sim error: No modified or staged file with name: 'push'
Although, not using the push
command and giving the file name directly seems to work
โฏ git-sim stash my-file.py
Simulating: git stash my-file.py
Same happens with pop command.
how do i install with homebrew
in mac os ?
Hi, I found out about this project a couple of days ago, I wanted to help package it for my distro but while doing so I noticed two issues.
The first one is pretty minor, when you run git-sim --show-completion SHELL
the output is padded by Manim Community v0.16.0.post0
using it for packaging is a little awkward, needing to pipe it through sed '1,2d'
.
The second issue is that auto-completion is really slow, making it quite annoying to use. I have included a video showcasing it
It would be nice if there was a way to include branches that won't be changed by the command being simulated to help the user of the tool visualize which commits those branches reference in addition to the ones that will change.
For example, I have might have a main
branch along with two feature branches MessagePost
and PhotoPost
, which share a common parent, and have a single commit that is not yet merged into main
.
If I git switch main
and then execute git-sim merge MessagePost
, the simulation very nicely shows me that the MessagePost
and main
pointers now point to the same commit, the one added to the MessagePost
branch. The PhotoPost
tip will still point at a commit whose parent is the original common parent of MessagePost
and PhotoPost
. It would be instructional to see that PhotoPost
doesn't move.
Maybe add an option to git-sim
that allows the user to specify additional branches besides HEAD
and any branches that are actually involved in the simulated operation.
For context, I am teaching a university class on Git, and I think my students could really benefit from seeing this information. It's available using git log --graph --all
, but the visualizations provided by git-sim
are much nicer.
@paketb0te I think maybe you can help me with this since I haven't had too much time to research it.
Basically, for local testing of Git-Sim I like to directly run the __main__.py
file with python like this:
python __main__.py log
But the problem is since it's not running as a package I end up getting errors like:
ModuleNotFoundError: No module named 'git_sim.git_sim_add'; 'git_sim' is not a package
I can get around this by removing the package prefix git_sim.
in all the imports, but its very annoying because I need to remember to stash those changes before building the code for release, and I need to make sure not to commit that by accident.
Do you have any thoughts on how I can test locally without having to mess with the imports like that?
I installed ffmpeg
(manually) and manim
, and they both work, but when I try to run git-sim merge develop
, I get an error about importing cv2:
> git-sim merge develop
Manim Community v0.17.2
Traceback (most recent call last):
File "c:\users\me\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\me\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\me\Documents\workspace\my-project\venv\Scripts\git-sim.exe\__main__.py", line 4, in <module>
File "C:\Users\me\Documents\workspace\my-project\venv\lib\site-packages\git_sim\__main__.py", line 6, in <module>
import cv2
ModuleNotFoundError: No module named 'cv2'
Installing git-sim
correctly installed opencv-python-headless, from what I see in the output of pip install git-sim:
pip install git-sim
(...)
Requirement already satisfied: opencv-python-headless in c:\users\me\documents\workspace\my-project\venv\lib\site-packages (from git-sim) (4.7.0.68)
(...)
As asked by the contributing guidelines:
Currently cherry-pick is only supported for the following command.
git cherry-pick
git cherry-pick -e <message>
command not supported.
So, I'm suggest the above mention command as a new feature.
Tilde expansion is not supported. For example, consider the following command:
git-sim --media-dir=~/temp log
The expectation is that media-dir
will map to $HOME/temp
, for example /Users/foo/temp
. Instead it maps to the current directory and creates a sub-directory with the literal name ~
, e.g. ./~/temp
:
โโโ ~
โโโ temp
โโโ git-sim_media
โโโ images
โโโ texts
โโโ videos
โโโ 1080p60
โโโ partial_movie_files
โโโ GitSim
This was tested on macOS using both ZSH and fish for the shell, using python 3.11.1.
The problem appears to be here:
Line 79 in c2effc2
Using os.path.expanduser
will allow tilde expansion.
Would you consider adding an option like --stdout
which would write the image data directly to stdout so that it can be displayed directly by imgcat, w3m or viu?
This project is a cool idea! I thought it might help folks understand and feel more comfortable with a rebase.
Unfortunately, I get this error when trying to rebase my branch against the main branch:
site-packages/git_sim/git_sim_rebase.py", line 48, in execute
current = self.commits[i]
IndexError: list index out of range
I install all the depencies , and i want to execute the command git-sim -h I get the following Error: No module named git-sim.
It'd be cool to visualise a rebase
using the --rebase-merges
and --onto
options. Looks like it's not yet supported.
git-sim rebase --rebase-merges 185d138a --onto another-branch
usage: git-sim [-h] [--title TITLE] [--logo LOGO] [--outro-top-text OUTRO_TOP_TEXT] [--outro-bottom-text OUTRO_BOTTOM_TEXT] [--show-intro] [--show-outro] [--media-dir MEDIA_DIR] [--low-quality] [--light-mode]
[--speed SPEED] [--animate] [--max-branches-per-commit MAX_BRANCHES_PER_COMMIT] [--max-tags-per-commit MAX_TAGS_PER_COMMIT] [-d] [-r] [--video-format VIDEO_FORMAT]
{log,status,add,restore,commit,stash,branch,tag,reset,revert,merge,rebase,cherry-pick} ...
git-sim: error: unrecognized arguments: --rebase-merges --onto another-branch
Currently only one argument for rebase
is supported: branch
:
$ git-sim rebase -h
usage: git-sim rebase [-h] branch
positional arguments:
branch The branch to simulate rebasing the checked-out commit onto
options:
-h, --help show this help message and exit
Hi, I have been following this project for some time since its release. Great Work.
But support for several git features coming in, is there any plans or ideas on testing the features. I would like to work on this.
For Manim based tests, we can have a look at the same way manimCE tests their own code. https://docs.manim.community/en/stable/contributing/testing.html and https://github.com/ManimCommunity/manim/tree/main/tests
Hi, @initialcommit-io , is there any test design you have in mind.?
Some of my ideas:
Once done we can add an actions pipeline to ensure continuous integration.
I am working on this, let me know if there are any existing plans on this.
Once again, Thank You for this wonderful project.
Tools built in Python are quite tricky for me to run on macOS and I know many other people struggle with it too, would you consider publishing a Docker image to make consuming this awesome looking utility easier? It looks really great!
Thank you for developing git-sim
.
I request you to make CHENGELOG.md in this repository.
Now, it is hard to check the diff from previous version to current version.
If you can, please do it.
Best regards,
I'm really excited to try this package out. However, I'm having a hard time getting it to work. First, I discovered that it needed libpango1.0-dev
installed by the operating system to even install. Then I tried to run it and it gave a warning that it also needed ffmpeg or avconv. So, I installed ffmpeg. Then I ran git-sim status
and got some weird messages about jpeg mimetypes.
Error: no "view" mailcap rules found for type "image/jpeg"
A google search turned up this heavily downvoted stackoverflow question. This may be related to the following perl error message:
Use of uninitialized value $file in open at /usr/share/perl5/File/MimeInfo/Applications.pm line 140.
I also see:
Use of uninitialized value in subroutine entry at /usr/share/perl5/File/BaseDir.pm line 105.
Finally, there is a summary:
No applications found for mimetype: image/jpeg
I'm trying to run git-sim from inside a python virtual environment installed inside of Ubuntu 22.04. All of that is being access from a funky RStudio terminal running inside of a web browser. Since I've never gotten this package to work, it's not clear what I should expect. I guess I thought it would just create an animation and point me to where it got saved so I could read it with an image viewer. I think maybe the program is not yet smart enough to understand that if it's assumptions are not met, that it should just make the image/video file, write it to disk, and then tell the user the path to that file. I could be completely wrong about this, but that's what it seems like to me.
This is a really cool project and I#d like to contribute where I can!
One thing that struck me while looking at the code was that there seem to be quite a lot of "star imports" (from foo import *
), which are considered bad practice AFAIK.
They also make it much more difficult to infer what the exact types of the different objects are (since you can't have any type hints).
Would you mind if I clean those up a little bit and replace them with explicit imports?
IMO a formatter like black
improves readability and consistency of the code, maybe that could be something to adopt?
Just an idea, let me know what you think @initialcommit-io
(most editors / IDEs support some sort of "format-on-save" functionality AFAIK, or it could be set up as a pre-commit hook I guess...)
I have a clone of the phoronix-test-suite repository with no modifications of my own and it is currently a few commits behind upstream. The following gitk screenshot shows the situation:
With git if I run git merge origin/master
from this situation it will do a fast forward and just update the master
branch to point to exactly the same as origin/master
. When I ran git-sim merge origin/master
it produced the following result:
which incorrectly suggest that a merge commit would be created. If I try to force fast forward git-sim complains:
$ย git-sim merge --ff origin/master
usage: git-sim [-h] [--title TITLE] [--logo LOGO] [--outro-top-text OUTRO_TOP_TEXT] [--outro-bottom-text OUTRO_BOTTOM_TEXT] [--show-intro] [--show-outro] [--media-dir MEDIA_DIR] [--low-quality] [--light-mode] [--speed SPEED]
[--animate] [--max-branches-per-commit MAX_BRANCHES_PER_COMMIT] [--max-tags-per-commit MAX_TAGS_PER_COMMIT] [-d] [-r]
{log,status,add,restore,commit,stash,branch,tag,reset,revert,merge,rebase,cherry-pick} ...
git-sim: error: unrecognized arguments: --ff
$
I installed (latest) git-sim for the first time today with pip, Fedora 36.
Hi,
Thanks for the time you invest in that project. It will help a lot to explain concept.
What could be really cool would be to be able to chain many command and display an image with all those steps and not each step in individual image.
"Basic exemple" would be to have checkout
a new branch, add
, commit
+ merge in previous branch in the same image.
I followed the Docker installation instructions.
$ docker run --rm -v $(pwd):/usr/src/git-sim git-sim log
Simulating: git log
โญโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/local/lib/python3.11/site-packages/git_sim/log.py:65 in log โ
โ โ
โ 62 โ ), โ
โ 63 ): โ
โ 64 โ scene = Log(ctx=ctx, n=n, all=all) โ
โ โฑ 65 โ handle_animations(scene=scene) โ
โ 66 โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ all = False โ โ
โ โ ctx = <click.core.Context object at 0x7fb5eaabbcd0> โ โ
โ โ n = None โ โ
โ โ scene = <git_sim.log.Log object at 0x7fb5ea5260d0> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git_sim/animations.py:17 in โ
โ handle_animations โ
โ โ
โ 14 โ
โ 15 โ
โ 16 def handle_animations(scene: Scene) -> None: โ
โ โฑ 17 โ scene.render() โ
โ 18 โ โ
โ 19 โ if settings.video_format == "webm": โ
โ 20 โ โ webm_file_path = str(scene.renderer.file_writer.movie_file_path โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ scene = <git_sim.log.Log object at 0x7fb5ea5260d0> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/manim/scene/scene.py:223 in render โ
โ โ
โ 220 โ โ """ โ
โ 221 โ โ self.setup() โ
โ 222 โ โ try: โ
โ โฑ 223 โ โ โ self.construct() โ
โ 224 โ โ except EndSceneEarlyException: โ
โ 225 โ โ โ pass โ
โ 226 โ โ except RerunSceneException as e: โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ preview = False โ โ
โ โ self = <git_sim.log.Log object at 0x7fb5ea5260d0> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git_sim/log.py:42 in construct โ
โ โ
โ 39 โ โ โ โ f"{settings.INFO_STRING} {type(self).__name__.lower()}{ โ
โ 40 โ โ โ ) โ
โ 41 โ โ self.show_intro() โ
โ โฑ 42 โ โ self.parse_commits() โ
โ 43 โ โ self.parse_all() โ
โ 44 โ โ self.recenter_frame() โ
โ 45 โ โ self.scale_frame() โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ self = <git_sim.log.Log object at 0x7fb5ea5260d0> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git_sim/git_sim_base_command.py:78 โ
โ in parse_commits โ
โ โ
โ 75 โ โ prevCircle=None, โ
โ 76 โ โ shift=numpy.array([0.0, 0.0, 0.0]), โ
โ 77 โ ): โ
โ โฑ 78 โ โ commit = commit or self.get_commit() โ
โ 79 โ โ โ
โ 80 โ โ isNewCommit = commit.hexsha not in self.drawnCommits โ
โ 81 โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ commit = None โ โ
โ โ i = 0 โ โ
โ โ prevCircle = None โ โ
โ โ self = <git_sim.log.Log object at 0x7fb5ea5260d0> โ โ
โ โ shift = array([0., 0., 0.]) โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git_sim/git_sim_base_command.py:63 โ
โ in get_commit โ
โ โ
โ 60 โ โ self.show_outro() โ
โ 61 โ โ
โ 62 โ def get_commit(self, sha_or_ref="HEAD"): โ
โ โฑ 63 โ โ return self.repo.commit(sha_or_ref) โ
โ 64 โ โ
โ 65 โ def get_default_commits(self): โ
โ 66 โ โ defaultCommits = [self.get_commit()] โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ self = <git_sim.log.Log object at 0x7fb5ea5260d0> โ โ
โ โ sha_or_ref = 'HEAD' โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/repo/base.py:614 in commit โ
โ โ
โ 611 โ โ """ โ
โ 612 โ โ if rev is None: โ
โ 613 โ โ โ return self.head.commit โ
โ โฑ 614 โ โ return self.rev_parse(str(rev) + "^0") โ
โ 615 โ โ
โ 616 โ def iter_trees(self, *args: Any, **kwargs: Any) -> Iterator["Tree โ
โ 617 โ โ """:return: Iterator yielding Tree objects โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ rev = 'HEAD' โ โ
โ โ self = <git.repo.base.Repo '/usr/src/git-sim/.git'> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/repo/fun.py:250 in rev_parse โ
โ โ
โ 247 โ โ โ โ if token == "@": โ
โ 248 โ โ โ โ โ ref = cast("Reference", name_to_object(repo, rev[: โ
โ 249 โ โ โ โ else: โ
โ โฑ 250 โ โ โ โ โ obj = cast(Commit_ish, name_to_object(repo, rev[:s โ
โ 251 โ โ โ โ # END handle token โ
โ 252 โ โ โ # END handle refname โ
โ 253 โ โ else: โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ lr = 6 โ โ
โ โ obj = None โ โ
โ โ output_type = 'commit' โ โ
โ โ parsed_to = 0 โ โ
โ โ ref = None โ โ
โ โ repo = <git.repo.base.Repo '/usr/src/git-sim/.git'> โ โ
โ โ rev = 'HEAD^0' โ โ
โ โ start = 4 โ โ
โ โ token = '^' โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/repo/fun.py:187 in โ
โ name_to_object โ
โ โ
โ 184 โ โ raise BadName(name) โ
โ 185 โ # END assert hexsha was found โ
โ 186 โ โ
โ โฑ 187 โ return Object.new_from_sha(repo, hex_to_bin(hexsha)) โ
โ 188 โ
โ 189 โ
โ 190 def deref_tag(tag: "Tag") -> "TagObject": โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ base = '%s' โ โ
โ โ hexsha = '0f1e3537ffa30234f208a6e9a390bcb603e25b4f' โ โ
โ โ name = 'HEAD' โ โ
โ โ repo = <git.repo.base.Repo '/usr/src/git-sim/.git'> โ โ
โ โ return_ref = False โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/objects/base.py:94 in โ
โ new_from_sha โ
โ โ
โ 91 โ โ โ # the NULL binsha is always the root commit โ
โ 92 โ โ โ return get_object_type_by_name(b"commit")(repo, sha1) โ
โ 93 โ โ # END handle special case โ
โ โฑ 94 โ โ oinfo = repo.odb.info(sha1) โ
โ 95 โ โ inst = get_object_type_by_name(oinfo.type)(repo, oinfo.binsha) โ
โ 96 โ โ inst.size = oinfo.size โ
โ 97 โ โ return inst โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ cls = <class 'git.objects.base.Object'> โ โ
โ โ repo = <git.repo.base.Repo '/usr/src/git-sim/.git'> โ โ
โ โ sha1 = b'\x0f\x1e57\xff\xa3\x024\xf2\x08\xa6\xe9\xa3\x90\xbc\xb6\x03\xeโฆ โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/db.py:40 in info โ
โ โ
โ 37 โ โ self._git = git โ
โ 38 โ โ
โ 39 โ def info(self, binsha: bytes) -> OInfo: โ
โ โฑ 40 โ โ hexsha, typename, size = self._git.get_object_header(bin_to_hex โ
โ 41 โ โ return OInfo(hex_to_bin(hexsha), typename, size) โ
โ 42 โ โ
โ 43 โ def stream(self, binsha: bytes) -> OStream: โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ binsha = b'\x0f\x1e57\xff\xa3\x024\xf2\x08\xa6\xe9\xa3\x90\xbc\xb6\x03\โฆ โ โ
โ โ self = <git.db.GitCmdObjectDB object at 0x7fb5ea538a10> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/cmd.py:1383 in get_object_header โ
โ โ
โ 1380 โ โ โ
โ 1381 โ โ :return: (hexsha, type_string, size_as_int)""" โ
โ 1382 โ โ cmd = self._get_persistent_cmd("cat_file_header", "cat_file", โ
โ โฑ 1383 โ โ return self.__get_object_header(cmd, ref) โ
โ 1384 โ โ
โ 1385 โ def get_object_data(self, ref: str) -> Tuple[str, str, int, bytes โ
โ 1386 โ โ """As get_object_header, but returns object data as well โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ cmd = <git.cmd.Git.AutoInterrupt object at 0x7fb5e9297b00> โ โ
โ โ ref = b'0f1e3537ffa30234f208a6e9a390bcb603e25b4f' โ โ
โ โ self = <git.cmd.Git object at 0x7fb5ea520c40> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/cmd.py:1370 in โ
โ __get_object_header โ
โ โ
โ 1367 โ โ if cmd.stdin and cmd.stdout: โ
โ 1368 โ โ โ cmd.stdin.write(self._prepare_ref(ref)) โ
โ 1369 โ โ โ cmd.stdin.flush() โ
โ โฑ 1370 โ โ โ return self._parse_object_header(cmd.stdout.readline()) โ
โ 1371 โ โ else: โ
โ 1372 โ โ โ raise ValueError("cmd stdin was empty") โ
โ 1373 โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ cmd = <git.cmd.Git.AutoInterrupt object at 0x7fb5e9297b00> โ โ
โ โ ref = b'0f1e3537ffa30234f208a6e9a390bcb603e25b4f' โ โ
โ โ self = <git.cmd.Git object at 0x7fb5ea520c40> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/cmd.py:1329 in โ
โ _parse_object_header โ
โ โ
โ 1326 โ โ tokens = header_line.split() โ
โ 1327 โ โ if len(tokens) != 3: โ
โ 1328 โ โ โ if not tokens: โ
โ โฑ 1329 โ โ โ โ raise ValueError("SHA could not be resolved, git retu โ
โ 1330 โ โ โ else: โ
โ 1331 โ โ โ โ raise ValueError("SHA %s could not be resolved, git r โ
โ 1332 โ โ โ # END handle actual return value โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ header_line = b'' โ โ
โ โ self = <git.cmd.Git object at 0x7fb5ea520c40> โ โ
โ โ tokens = [] โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
ValueError: SHA could not be resolved, git returned: b''
$ docker run --rm -v $(pwd):/usr/src/git-sim git-sim log
โญโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/local/lib/python3.11/site-packages/git_sim/log.py:64 in log โ
โ โ
โ 61 โ โ help="Display all local branches in the log output", โ
โ 62 โ ), โ
โ 63 ): โ
โ โฑ 64 โ scene = Log(ctx=ctx, n=n, all=all) โ
โ 65 โ handle_animations(scene=scene) โ
โ 66 โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ all = False โ โ
โ โ ctx = <click.core.Context object at 0x7fc7c9ace610> โ โ
โ โ n = None โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git_sim/log.py:32 in __init__ โ
โ โ
โ 29 โ โ self.all = all โ
โ 30 โ โ โ
โ 31 โ โ try: โ
โ โฑ 32 โ โ โ self.selected_branches.append(self.repo.active_branch.name) โ
โ 33 โ โ except TypeError: โ
โ 34 โ โ โ pass โ
โ 35 โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ all = False โ โ
โ โ all_command = False โ โ
โ โ ctx = <click.core.Context object at 0x7fc7c9ace610> โ โ
โ โ n = 5 โ โ
โ โ n_command = 5 โ โ
โ โ self = <git_sim.log.Log object at 0x7fc7c958ef90> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/repo/base.py:896 in โ
โ active_branch โ
โ โ
โ 893 โ โ :raises TypeError: If HEAD is detached โ
โ 894 โ โ :return: Head to the active branch""" โ
โ 895 โ โ # reveal_type(self.head.reference) # => Reference โ
โ โฑ 896 โ โ return self.head.reference โ
โ 897 โ โ
โ 898 โ def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: โ
โ 899 โ โ """Iterator for blame information for the given file at the g โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ self = <git.repo.base.Repo '/usr/src/0/.git/worktrees/1'> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/refs/symbolic.py:307 in โ
โ _get_reference โ
โ โ
โ 304 โ โ """:return: Reference Object we point to โ
โ 305 โ โ :raise TypeError: If this symbolic reference is detached, henc โ
โ 306 โ โ โ to a reference, but to a commit""" โ
โ โฑ 307 โ โ sha, target_ref_path = self._get_ref_info(self.repo, self.path โ
โ 308 โ โ if target_ref_path is None: โ
โ 309 โ โ โ raise TypeError("%s is a detached symbolic reference as it โ
โ 310 โ โ return self.from_path(self.repo, target_ref_path) โ
โ โ
โ โญโโโโโโโโโ locals โโโโโโโโโโฎ โ
โ โ self = <git.HEAD "HEAD"> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/refs/symbolic.py:210 in โ
โ _get_ref_info โ
โ โ
โ 207 โ โ """Return: (str(sha), str(target_ref_path)) if available, the โ
โ 208 โ โ rela_path points to, or None. target_ref_path is the reference โ
โ 209 โ โ point to, or None""" โ
โ โฑ 210 โ โ return cls._get_ref_info_helper(repo, ref_path) โ
โ 211 โ โ
โ 212 โ def _get_object(self) -> Commit_ish: โ
โ 213 โ โ """ โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ cls = <class 'git.refs.head.HEAD'> โ โ
โ โ ref_path = 'HEAD' โ โ
โ โ repo = <git.repo.base.Repo '/usr/src/0/.git/worktrees/1'> โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โ โ
โ /usr/local/lib/python3.11/site-packages/git/refs/symbolic.py:193 in โ
โ _get_ref_info_helper โ
โ โ
โ 190 โ โ โ # END for each packed ref โ
โ 191 โ โ # END handle packed refs โ
โ 192 โ โ if tokens is None: โ
โ โฑ 193 โ โ โ raise ValueError("Reference at %r does not exist" % ref_pa โ
โ 194 โ โ โ
โ 195 โ โ # is it a reference ? โ
โ 196 โ โ if tokens[0] == "ref:": โ
โ โ
โ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโ locals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ cls = <class 'git.refs.head.HEAD'> โ โ
โ โ ref_path = 'HEAD' โ โ
โ โ repo = <git.repo.base.Repo '/usr/src/0/.git/worktrees/1'> โ โ
โ โ repodir = '/usr/src/0/.git/worktrees/1' โ โ
โ โ tokens = None โ โ
โ โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
ValueError: Reference at 'HEAD' does not exist
I had no problem getting everything installed in a venv
now running python 3.10.9 but it just hangs for minutes and just says simulating and sometimes will eventually generate an image.
Any ideas how to debug this issue?
@initialcommit-io Following our discussion in #8, I have created an example of what I think would be a simpler way of handling class inheritance - see my branch inheritance (only git-sim log
for now).
Basically I did the following:
GitSimBaseCommand
a Manim MovingCameraScene
self.scene
in GitSimBaseCommand
with self.
GitSimBaseCommand
takes args
instead of scene
as argument to its __init__()
GitSimLog
passes args
instead of scene
to its super().__init__()
GitSim
class to select the correct subclass for each commandNot sure if that makes sense, but at least my brain can process it better like this ๐
Using Typer to make the whole argument- and option-handling easier could be a next step, but I think this would be a great starting point, if you are interested / if it makes sense to you.
Obviously there is no point in changing that up only so that I understand it better, so I'd highly appreciate any feedback!
Once again, this is a great tool!
Can I interest you in using poetry
for packaging and dependency management?
I had pretty good experiences with it, can definitely recommend.
If you prefer a simpler approach like requirements.txt
that's fine too (but I really recommend to take a look at poetry ๐)
(Would look something like THAT)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.