Skip to content

Instantly share code, notes, and snippets.

@torus
Forked from halcat0x15a/vcs
Created May 13, 2012 09:32
Show Gist options
  • Save torus/2687168 to your computer and use it in GitHub Desktop.
Save torus/2687168 to your computer and use it in GitHub Desktop.
start alloy
sig Repository {
file: set File
}
fact {
all rep: Repository |
no disj f1, f2: rep.file | f1.path = f2.path
}
sig Local {
file: set File
}
sig Path {}
sig Content {}
sig File {
path: Path,
content: Content
}
fact {
all l: Local |
all disj f1, f2: l.file |
not (f1.path = f2.path)
}
run {}
pred commit (rep, rep': Repository, l: Local, f: File) {
f in l.file
rep'.file = rep.file ++ f
}
run commit
pred commitTest (rep, rep': Repository, l: Local, f: File) {
commit [rep, rep', l, f]
rep != rep'
}
run commitTest
pred update (rep: Repository, l: Local) {
l.file = rep.file
}
run update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment