Pijul

Git-pijul python module

I created a python module called git-pijul. It does a similar thing as pijul git. Unfortunately pijul git still crashes for my repos. Since I am to only user you can expect bugs. For example I never use the arguments --head/--base, so this is more or less untested.

git-pijul create finds an ancestry-path with git rev-list --ancestry-path --no-merges --topo-order. It will then checkout each revision into a temp directory and add it to pijul. Non-linear history is dropped. The last revision/patchset will be forked into a channel.

git-pijul update finds in git the shortest path from the current git-revision to a existing channel and updates pijul from that channel.

git-pijul shallow create a new pijul repository from the current revision without history.

I didn’t find git-pijul in my google search, but there is a topic called Adventures in converting: git-pijul. Which discovered a minute ago. Let me know if git-pijul is a thing. I choose the name so is can type git pijul which updates pijul up to my current revision.

Updates

  • 0.3.0 git-pijul now creates a work and an internal channel. The internal channel should not be used by the user. I think this is the first step to allow back-sync.

  • 0.4.0 stop using .ignore, instead add root directory items one by one, ignoring .git

  • 0.5.0 allow to plot changes with git pijul plot | dot -Txlib

  • 0.6.0 git-pijul plot plots dependencies of all changes, with -i you can exclude changes from a channel, usually the main channel that contains published changes. This allows you to select the changes you want to publish.

Cool! Can you tell which repos pijul git crashes on? Is there a public one I could use to try and debug?

Some still crash, like the linux kernel, but I am not interested in that repo. For the ones I use, I get:

$> pijul git
[2021-07-27T23:05:07Z ERROR pijul::commands::git] While adding [".isort.cfg", ".travis.yml", "caluma/conftest.py", "caluma/form/factories.py", "caluma/form/filters.py", "caluma/form/migrations/0001_initial.py", "caluma/form/models.py", "caluma/form/schema.py", "caluma/form/serializers.py", "caluma/form/tests/test_user.py", "caluma/form/urls.py", "caluma/form/views.py", "caluma/schema.py", "caluma/settings.py", "caluma/urls.py", "pytest.ini", "requirements-dev.txt", "requirements.txt"]: No such file or directory (os error 2)

and these files will be missing. To reproduce:

git clone https://github.com/projectcaluma/caluma/
cd caluma
pijul init
pijul git

Infos

$> uname -a
Linux host 5.10.52-1-MANJARO #1 SMP PREEMPT Tue Jul 20 20:32:02 UTC 2021 x86_64 GNU/Linux

$> pijul --version
pijul 1.0.0-alpha.52

$> cargo --version
cargo 1.51.0 (43b129a20 2021-03-16)

Installed with:

cargo install pijul --version "~1.0.0-alpha" --features "git git2"

I also added an interesting feature pijul git misses. create a new pijul repository from current revision without history:

$> git pijul shallow

$> git pull
Updating 17cfd71..fef6483
Fast-forward
.....

$> git pijul update
Using head: fef6483a69163b119eb741ddc70030c2acad93c0 (HEAD)
Using base from previous update: 17cfd718dfd62ed9a9b318854a8f9815a485edb5
100%|██████████████████████████████████████████| 69/69 [00:04<00:00, 13.96it/s]

I use (better, I will use) pijul ad-hoc because everything is on git. This way I can just read the latest revision without history, but I can still update the “commit-channels” and apply changes to my channel.

I am trying this with your repository, and getting multiple errors about missing files. They all seem to be when “adding”, so I wonder if the command doesn’t extract the file in order to add it.
So, it finished, and I used
pijul archive -o ~/caluma-p.zip
git archive -o ~/caluma-g.zip HEAD
Then I unzipped both into their own folders and used Meld to see what was different. There was one file that had two lines in Pijul that the Git version didn’t have, and several folders and files that were in one folder but not in the other. When I looked them up in GitHub in the browser, the Pijul version was always wrong and the Git version matched.

By the way, I just pushed a patch to fix these errors in pijul git. Thanks for the bug report.

@ganwell I just tried importing your repository and checked using rm -R *, followed by pijul reset and git diff after the import. It worked!

@joyously @pmeunier Nice, thanks to both of you.

I was able recreate the workflow described by author of hikari wm, he is using darcs:

I like that one doesn’t have to worry about feature branches and rebasing as much. They display a graph to see what changes depend and they base decisions on what to release on the graph.

git pijul plot --no-rank-LR | dot -T png -o everything.png

git pijul plot --not-in work_7ec741d | dot -Tpng -o difference.png

The second graph shows what changes aren’t published and independent. I can create merge-requests for these earlier, getting changes into main incrementally.

I was thinking about using pijul ad-hoc like that since I heard about pijul. Using pijul at work as the main VCS wont happen too soon.

Update

  • 0.7.0 There are also set opertions on sets of changes in channels. Typical usage is
    applying changes after a git pijul update:
git pijul set-diff -l  work_9189af5 | xargs pijul apply
  • 0.8.0 do not switch channels, use --channel for all operations