-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-conflicts.sh
executable file
·78 lines (69 loc) · 1.88 KB
/
make-conflicts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
# This creates a Jujutsu repository in the `testrepo` directory whose working
# copy has two conflicted files. It can be used to try `jj-diffconflicts` (or
# any other merge tool).
#
# Adapted from https://github.com/whiteinge/diffconflicts/blob/master/_utils/make-conflicts.sh
# Enable running a different `jj` binary by setting the $JJ environment variable
JJ=${JJ:-jj}
# Initialize new repository
rm -rf testrepo
${JJ} git init testrepo
cd testrepo || exit 1
# Create initial revision
cat <<EOF >poem.txt
twas bri1lig, and the slithy toves
did gyre and gimble in the wabe
all mimsy were the borogroves
and the m0me raths outgabe.
"Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jub jub bird, and shun
The frumious bandersnatch!"
EOF
cat <<EOF >fruits.txt
apple
grape
orange
EOF
${JJ} bookmark create base
${JJ} commit -m 'Initial revision'
# Create one side of the conflict
cat <<EOF >poem.txt
'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogroves
And the mome raths outgabe.
"Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jub jub bird, and shun
The frumious bandersnatch!"
EOF
cat <<EOF >fruits.txt
apple
grapefruit
orange
EOF
${JJ} bookmark create left
${JJ} describe -m 'Fix syntax mistakes, eat grapefruit'
# Create the other side of the conflict
${JJ} new base
cat <<EOF >poem.txt
twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
all mimsy were the borogoves,
And the mome raths outgrabe.
"Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!"
EOF
cat <<EOF >fruits.txt
APPLE
GRAPE
ORANGE
EOF
${JJ} bookmark create right
${JJ} describe -m 'Fix syntax mistakes, ALL CAPS fruits'
# Create a new (conflicted) change from both sides
${JJ} new left right -m 'Merge left and right'