scm-correctness /

# -*- coding: UTF-8 -*-
# A test suite to validate the correctness of merging after incompatible changes.
# Written by Ringo De Smet
# Released in the public domain
# Published at:
# Based on the SCM scripts written by Maciej Bliziński
# found at:

    pushd "$1" > /dev/null

POPD() {
    popd > /dev/null

    darcs "$@" > /dev/null

# Make sure it's all clean
rm -rf darcs-branch-{a,b,c} darcs-wc

# Create the initial repo
mkdir darcs-wc
PUSHD darcs-wc
DARCS initialize
mkdir dir-a
DARCS add dir-a
PUSHD dir-a
echo foo > foo.txt
DARCS add foo.txt
DARCS record -m "A dir and a file added" -a -A "Original creator" # rev 1

# Developer A renames a directory
DARCS get darcs-wc darcs-branch-a
PUSHD darcs-branch-a
DARCS mv dir-a dir-b
DARCS record -m "Directory renamed" -a -A "Branch A Guy" # rev 2

# Developer B adds a file to the same directory, before A's changes are
# merged
DARCS get darcs-wc darcs-branch-b
PUSHD darcs-branch-b
PUSHD dir-a
echo baz >> foo.txt
echo bar > bar.txt
DARCS add bar.txt
DARCS record -m "Foo modified, bar added." -a -A "Branch B Guy" # rev 2

# Developer C edits the foo file first, then merges A's, then B's
DARCS get darcs-wc darcs-branch-c
PUSHD darcs-branch-c
DARCS pull -a ../darcs-branch-a
DARCS pull -a ../darcs-branch-b

# Look at the results
tree -I _darcs
echo "foo.txt:"
cat darcs-branch-c/dir-b/foo.txt
echo "bar.txt:"
cat darcs-branch-c/dir-b/bar.txt
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.