One of the really cool features of Pijul (IMO) is a good internal representation of conflicts. But I find myself searching for conflicts after a pull by grepping for something like
>>>>>> to find files with conflicts.
I’m posting it here, because I’d love to get some feedback - I basically looked at how files are output in
libpijul/src/graph.rs:output_file(). From my understanding conflicts are identified from the internal graph representation of files by a combination of a DFS and identifying the strongly-connected components. If I’m reading the code right, the SCCs are used to determine cyclical conflicts.
This brings me to another question: Are there more than one type of conflict? It would seem that there is a difference between cyclical and acyclical conflicts, but I’m not sure if there is any reason to present them differently to the user (just knowing which files contains conflicts might be enough).
I have an example (that I want to turn into a bats test):
#!/bin/bash set -e REPO=conflicts TODO=todo.txt rm -rf $REPO pijul init $REPO cd $REPO cat > $TODO <<EOF TODO * brush teeth EOF pijul add $TODO pijul record -a -m "Initial commit" pijul fork --branch master shower pijul checkout shower # Just to be sure sed -i '2i* take a shower' $TODO pijul record -a -m "Add shower to $TODO" pijul fork --branch master shoes pijul checkout shoes sed -i '2i* Put on shoes' $TODO pijul record -a -m "Add shoes to $TODO" # Merge branches 'shoes' and 'shower' pijul pull -a --from-branch shower .
todo.txt file contains a conflict and checkout file contains:
$ cat todo.txt TODO >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> * Put on shoes ================================ * take a shower <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< * brush teeth
pijul status shows
$ pijul status On branch shoes Unresolved conflicts: (fix conflicts and record the resolution with "pijul record ...") todo.txt
Let me know what you think! Thanks