SlideShare uma empresa Scribd logo
1 de 49
Manchester
                                                             July 2009



                               darcs
    An introduction to a fully-distributed
           revision control system



                                                         Ashley Moran
Creative Commons Attribution-Noncommercial-Share Alike
2.0 UK: England & Wales License                          PatchSpace Ltd
What is darcs?

distributed
interactive
smart
patch-based, not revision/history based
written in Haskell
Presentation goals

To show how darcs makes revision control
easy, interactive, and intuitive
To show you how to think in terms of
patches, not revisions
To help you compare darcs to git (in the
narration, a video, and questions)
Presentation non-goals
 To show every last feature of darcs
  Even some really cool ones are omitted
 To show "best practice" workflows
 To explain the patch theory that
 underpins darcs
 To convince you that darcs is better than
 git/hg/bzr/svn
Initialising a repository
% mkdir repo_a

% cd repo_a

repo_a % darcs init

repo_a % ls
_darcs

repo_a % darcs changes
                         No patches yet
Adding a file
repo_a % echo "Hello, darcs" > hi.txt

repo_a % darcs whatsnew
No changes!

repo_a % darcs whatsnew --look-for-adds
a ./hi.txt

repo_a % darcs add hi.txt

repo_a % darcs whatsnew
addfile ./hi.txt
hunk ./hi.txt 1
+Hello, darcs
Recording a patch
repo_a % darcs record
addfile ./hi.txt
Shall I record this change? (1/2)
[ynWsfvplxdaqjk], or ? for help: y
hunk ./hi.txt 1
+Hello, darcs
Shall I record this change? (2/2)
[ynWsfvplxdaqjk], or ? for help: y
What is the patch name? Say hello to darcs
Do you want to add a long comment? [yn]n
Finished recording patch 'Say hello to darcs'
Listing patches
repo_a % darcs changes
Mon Jul 13 12:31:48 BST 2009
ashley.moran@patchspace.co.uk
  * Say hello to darcs

                  darcs got my email address from the
                  DARCS_EMAIL environment variable
Cloning a repository
repo_a % cd ..

% darcs get repo_a repo_b

% cd repo_b

repo_b % darcs changes
Mon Jul 13 12:31:48 BST 2009    ashley.moran@patch…
  * Say hello to darcs
                               Repo B is a clone of Repo A
Modifying a file
repo_b % echo "How are you?" >> hi.txt
repo_b % darcs whatsnew
hunk ./hi.txt 2
+How are you?
repo_b % darcs diff --unified
diff -rN -u old-repo_b/hi.txt new-repo_b/hi.txt
--- old-repo_b/hi.txt
2009-07-13
14:55:21.000000000 +0100
+++ new-repo_b/hi.txt
2009-07-13
14:55:21.000000000 +0100
@@ -1 +1,2 @@
 Hello, darcs
+How are you?
Adding a directory
repo_b % mkdir src

repo_b % echo 'puts "Hi"' > src/hi.rb

repo_b % darcs add -r src

repo_b % darcs whatsnew --summary
M ./hi.txt +1
A ./src/
A ./src/hi.rb
Record interactively
repo_b % darcs record
hunk ./hi.txt 2
+How are you?
Shall I record this change? (1/4)
[ynWsfvplxdaqjk], or ? for help: n
adddir ./src
Shall I record this change? (2/4)
[ynWsfvplxdaqjk], or ? for help: a
What is the patch name? Added application source
Do you want to add a long comment? [yn]n
Finished recording patch 'Added application
source'
Record all
repo_b % darcs record -a -m 'More hellos'
Finished recording patch 'More hellos'

repo_b % darcs changes
Mon Jul 13 15:51:26 BST 2009   ashley.moran@patch…
  * More hellos

Mon Jul 13 15:17:36 BST 2009   ashley.moran@patch…
  * Added application source

Mon Jul 13 12:31:48 BST 2009   ashley.moran@patch…
  * Say hello to darcs
Showing patch contents
repo_b % darcs annotate -p 'More'
[More hellos
ashley.moran@patchspace.co.uk**20090713145126
 Ignore-this: 27105a11a78c889107399e21d7b9dea0
] hunk ./hi.txt 2
+How are you?         darcs annotate has another    use -
                      the name is not very intuitive here


                             This named patch contains
                                   only one change
More patch contents
                       Regex example to locate the patch
repo_b % darcs annotate -p '^Added.*source$'
[Added application source
ashley.moran@patchspace.co.uk**20090713141736
 Ignore-this: 7403e5fb594ec9403d26d8c01ffdcb3c
] adddir ./src
addfile ./src/hi.rb
hunk ./src/hi.rb 1          This named patch contains
+puts "Hi"                   three "primitive patches"
Pushing patches
repo_b % darcs push
Pushing to "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch…
  * Added application source
Shall I push this patch? (1/2) [ynWvplxdaqjk],
or ? for help: y
Mon Jul 13 15:51:26 BST 2009 ashley.moran@patch…
  * More hellos
Shall I push this patch? (2/2) [ynWsfvplxdaqjk],
or ? for help: n
Finished applying...
Push successful.
View remote patches
repo_b % darcs changes --repo=../repo_a
Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch…
  * Added application source

Mon Jul 13 12:31:48 BST 2009   ashley.moran@patch…
  * Say hello to darcs
Spot a recorded mistake
repo_b % darcs whatsnew --summary hi.txt
What's new in "hi.txt": No changes!
repo_b % cat hi.txt
Hello, darcs            Already recorded this   in a patch
How are you?

repo_b % sed -ie 's/you/you today/' hi.txt
repo_b % cat hi.txt
Hello, darcs
How are you today?

repo_b % darcs whatsnew
hunk ./hi.txt 2
-How are you?               We want this patch instead
+How are you today?
Amend-record a patch
repo_b % darcs amend-record
Mon Jul 13 15:51:26 BST 2009 ashley.moran@patch…
  * More hellos
Shall I amend this patch? [yNvpxq], or ? for
help: y
hunk ./hi.txt 2         You can amend-record any patch
-How are you?               that isn't depended upon
+How are you today?
Shall I add this change? (1/1) [ynWsfvplxdaqjk],
or ? for help: y
Finished amending patch:
Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch…
  * More hellos
View amended patch
                                 Before amend-record
repo_b % darcs annotate -p 'More'
[More hellos
ashley.moran@patchspace.co.uk**20090713145126
 Ignore-this: 27105a11a78c889107399e21d7b9dea0
] hunk ./hi.txt 2
+How are you?
                                  After amend-record
repo_b % darcs annotate -p 'More hellos'
[More hellos
ashley.moran@patchspace.co.uk**20090713154227
 Ignore-this: 3c7d315c69e36a3f3faad64e9074b6e9
] hunk ./hi.txt 2
+How are you today?
Push remaining patches
repo_b % darcs push -a
Pushing to "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
Finished applying...
Push successful.
                     Once you've pushed a patch it would
                      be considered "wild". Don't amend-
                    record a patch that has been pushed!
Recording unwanted…
repo_b % echo 'exit false' >> src/hi.rb
repo_b % cat src/hi.rb
puts "Hi"
exit false
repo_b % darcs whatsnew
hunk ./src/hi.rb 2
+exit false
repo_b % darcs record -a -m 'Make hi.rb fail'
Finished recording patch 'Make hi.rb fail'
repo_b % darcs changes --last 1
Mon Jul 13 17:02:07 BST 2009 ashley.moran@patch…
  * Make hi.rb fail
repo_b % darcs whatsnew
No changes!
…so unrecording…
repo_b % darcs unrecord
Mon Jul 13 17:02:07 BST 2009 ashley.moran@patch…
  * Make hi.rb fail
Shall I unrecord this patch? (1/4)
[ynWsfvplxdaqjk], or ? for help: y
Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch…
  * More hellos
Shall I unrecord this patch? (2/4)
[ynWsfvplxdaqjk], or ? for help: d
Finished unrecording.
                                  d for "done" - skip
                                 remaining patches
…and carrying on.
repo_b % darcs changes --last 1
                                      Patch removed
Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch…
  * More hellos

repo_b % cat src/hi.rb
puts "Hi"                   Working copy unmodified
exit false

repo_b % darcs whatsnew
hunk ./src/hi.rb 2         Change can be re-recorded
+exit false
Recording unwanted…
repo_b % darcs record -a -m 'Make hi.rb fail'
Finished recording patch 'Make hi.rb fail'

repo_b % darcs changes -p 'fail'
Mon Jul 13 17:15:08 BST 2009 ashley.moran@patch…
  * Make hi.rb fail
                          To save making a new patch,
                          I'm just re-recording the last
…REALLY unwanted…
repo_b % darcs obliterate
Mon Jul 13 17:15:08 BST 2009 ashley.moran@patch…
  * Make hi.rb fail
Shall I obliterate this patch? (1/4)
[ynWsfvplxdaqjk], or ? for help: y
Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch…
  * More hellos
Shall I obliterate this patch? (2/4)
[ynWsfvplxdaqjk], or ? for help: d
Finished obliterating.
…and it's REALLY gone.
repo_b % darcs changes --last 1
Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch…
  * More hellos

repo_b % darcs changes -p 'fail'

repo_b % cat src/hi.rb
puts "Hi"                          Patch never existed!
Check repos are in sync
repo_b % darcs push --dry-run ../repo_a
Would push to "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
No recorded local changes to push!

repo_b % darcs pull --dry-run ../repo_a
Would pull from "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
No remote changes to pull in!

                  --dry-run is useful for seeing changes
Record a change in repo A
repo_b % cd ../repo_a

repo_a % echo 'Yo dude' > hi.txt

repo_a % darcs record -a -m 'Change greeting'
Finished recording patch 'Change greeting'

repo_a % darcs annotate -p 'greet'
[Change greeting
ashley.moran@patchspace.co.uk**20090713171149
 Ignore-this: b41771e45b0a2277729dae96768e232b
] hunk ./hi.txt 1
-Hello, darcs
-How are you today?
+Yo dude
Record a change in repo B
repo_a % cd ../repo_b

repo_b % echo 'Aup youth' > hi.txt

repo_b % darcs record -a -m 'Update salutation'
Finished recording patch 'Update salutation'

repo_b % darcs annotate -p 'salut'
[Update salutation
ashley.moran@patchspace.co.uk**20090713171522
 Ignore-this: cfe070e308bb4a14e010a6ea0d15be72
] hunk ./hi.txt 1
-Hello, darcs
-How are you today?
+Aup youth
Pull in the change: conflict!
repo_b % darcs pull
                    darcs remembers remote repos used
Pulling from "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
Mon Jul 13 18:11:49 BST 2009 ashley.moran@patch…
  * Change greeting
Shall I pull this patch? (1/1) [ynWsfvplxdaqjk],
or ? for help: y
Backing up ./hi.txt(-darcs-backup0)
We have conflicts in the following files:
./hi.txt
Finished pulling and applying.
Repo in conflict state
repo_b % ls
_darcs
 
 
 hi.txt-darcs-backup0
 src
hi.txt
 
 
 hi.txte
repo_b % cat hi.txt
v v v v v v v
Aup youth                   Conflicted working copy file
*************
Yo dude
^ ^ ^ ^ ^ ^ ^
repo_b % cat hi.txt-darcs-backup0     Original local file
Aup youth
repo_b % cat hi.txte
Hello, darcs
                                       Pre-conflict file
How are you?
         The darcs team wants to improve conflict marking
Resolve the conflict
                             After much discussion, the
                               correct form is found
repo_b % echo 'Aup dude' > hi.txt

repo_b % darcs record -a -m 'Correct greeting'
Finished recording patch 'Correct greeting'

repo_b % rm hi.txt-darcs-backup0 hi.txte

                   The 'Correct greeting' patch depends
                  upon the conflicting primitive patches,
                         and resolves the conflict
What's new w.r.t. repo A?
repo_b % darcs push --dry-run
Would push to "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
Would push the following changes:
Mon Jul 13 18:15:22 BST 2009 ashley.moran@patch…
  * Update salutation

Mon Jul 13 18:32:57 BST 2009    ashley.moran@patch…
  * Correct greeting

Making no changes:   this is a dry run.

                     Repo A needs our original patch and
                      also the conflict resolution patch
Resolve the conflict
repo_b % darcs push -a
Pushing to "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
Finished applying...
Push successful.
Creating a fresh repo
repo_b % mkdir ../repo_c
repo_b % cd ../repo_c
repo_c % darcs init
Pulling from Repo A
repo_c % darcs pull ../repo_a
Pulling from "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
Mon Jul 13 12:31:48 BST 2009 ashley.moran@patch…
  * Say hello to darcs
Shall I pull this patch? (1/6) [ynWsfvplxdaqjk],
or ? for help: y
Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch…
  * Added application source
Shall I pull this patch? (2/6) [ynWvplxdaqjk],
or ? for help: d
Finished pulling and applying.

                    Repo C is now 'primed' to pull from
                   repositories generated from Repo A
Pulling from Repo B
repo_c % darcs pull ../repo_b
Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch…
  * Added application source
Shall I pull this patch? (1/5) [ynWvplxdaqjk],
or ? for help: y
Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch…
  * More hellos
Shall I pull this patch? (2/5) [ynWsfvplxdaqjk],
or ? for help: d
Finished pulling and applying.

              I didn't need to pull the first patch. I could
             have pulled any patch without dependencies.
                       This will be explained later.
What's left in Repo A?
repo_c % darcs pull --dry-run ../repo_a
Would pull from "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
Would pull the following changes:
Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch…
  * More hellos
Mon Jul 13 18:11:49 BST 2009 ashley.moran@patch…
  * Change greeting
Mon Jul 13 18:15:22 BST 2009 ashley.moran@patch…
  * Update salutation
Mon Jul 13 18:32:57 BST 2009 ashley.moran@patch…
  * Correct greeting
Making no changes: this is a dry run.
         We can push and pull from Repo A, B or C in any
          direction - none of them are special to darcs
A depended-on patch
repo_c % darcs pull ../repo_a
Pulling from "/Users/ashleymoran/Documents/
PatchSpace/Presentations/darcs/repos/repo_a"...
Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch…
  * More hellos
Shall I pull this patch? (1/4) [ynWsfvplxdaqjk],
or ? for help: n
Skipped pull of 3 changes.
You don't want to pull any patches, and that's
fine with me!


                  darcs knows that all the remaining
                 patches depend on this one, so doesn't
                         attempt to pull them
The future of darcs
Ian Lynagh is doing a re-implementation
of the darcs patch algebra (and proof of
the patch theory) under the project name
Camp
 http://projects.haskell.org/camp/
Camp has a good demonstration to
visualise patch vs chronological history
 http://projects.haskell.org/camp/unique
Let's watch the video =)
What's not covered? (1)

Deleting files - just throw away and darcs
sees they should be removed
darcs mv - renaming files
darcs revert - discarding your working
copy changes
darcs unrevert - getting them back!
What's not covered? (2)
 darcs rollback - generating a patch to
 undo a change
 darcs tag - marking a snapshot version of
 a repository you can easily get back to
 darcs send - generating a patch bundle file
 you can send by email etc
 darcs apply - applying a patch bundle
Repositories vs branches
 In darcs, a branch and a repository are the
 same thing
 You can also have "branches" identified by
 patch keywords, eg "[BUG61] ..."
 You can view this presentation as if
  Repo A is remote; Repo B is local
  Repo A is local; Repo B is a branch
 Replace repo_a with user@remote:repo_a
Centralised repositories

 You can nominate repositories as a
 "central repository", but this is only for
 convenience
 Hosting is available:
                   http://patch-tag.com/
darcs limitations
Some darcs operations are much slower
than the equivalents in other revision
control systems
 Could be a problem with very large repos
Patch theory is still not fully understood,
so edge case bugs may be lurking
Mainly suitable for small-medium teams,
or where a small team can help integrate
patches (eg OSS projects)
Why I use darcs
Conceptually simple - it's just repositories
and patches
Smart - handles complex merge problems
Easy to use - hides the complexity with a
friendly interface
Interactive - always presents me with the
choices I need
Flat learning cur ve - took no time to learn
References

http://nwrug.org/events/july09/
http://darcs.net/manual/
http://wiki.darcs.net/
http://blog.interlinked.org/tutorials/
darcs.html
Contact

Slides prepared by Ashley Moran
 ashley.moran@patchspace.co.uk
 www.patchspace.co.uk
Creative Commons licensed - contact me
for commercial use

Mais conteúdo relacionado

Mais procurados

Arp Dan Ipconfig Syntax
Arp Dan Ipconfig  SyntaxArp Dan Ipconfig  Syntax
Arp Dan Ipconfig Syntaxguestcc37e8c
 
FreeBSD Document Project
FreeBSD Document ProjectFreeBSD Document Project
FreeBSD Document ProjectChinsan Huang
 
mapserver_install_linux
mapserver_install_linuxmapserver_install_linux
mapserver_install_linuxtutorialsruby
 
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...Dexter Horthy
 

Mais procurados (9)

Adb instructions
Adb instructionsAdb instructions
Adb instructions
 
Arp Dan Ipconfig Syntax
Arp Dan Ipconfig  SyntaxArp Dan Ipconfig  Syntax
Arp Dan Ipconfig Syntax
 
Git::Hooks
Git::HooksGit::Hooks
Git::Hooks
 
FreeBSD Document Project
FreeBSD Document ProjectFreeBSD Document Project
FreeBSD Document Project
 
mapserver_install_linux
mapserver_install_linuxmapserver_install_linux
mapserver_install_linux
 
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
More than Applications: (Ab)using Docker to Improve the Portability of Everyt...
 
PHP 5.3/6
PHP 5.3/6PHP 5.3/6
PHP 5.3/6
 
Blist
BlistBlist
Blist
 
Troubleshooting Puppet
Troubleshooting PuppetTroubleshooting Puppet
Troubleshooting Puppet
 

Semelhante a NWRUG July 2009 - Darcs

Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciBecoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciAtlassian
 
Docker Demo @ IuK Seminar
Docker Demo @ IuK SeminarDocker Demo @ IuK Seminar
Docker Demo @ IuK SeminarMartin Scharm
 
Composer is the new Drush - Drupal Developer Training (internal)
Composer is the new Drush - Drupal Developer Training (internal)Composer is the new Drush - Drupal Developer Training (internal)
Composer is the new Drush - Drupal Developer Training (internal)Exove
 
The History of React-Hot-Loader
The History of React-Hot-LoaderThe History of React-Hot-Loader
The History of React-Hot-LoaderAnton Korzunov
 
Git Pro Tips
Git Pro TipsGit Pro Tips
Git Pro Tipsthehoagie
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitaminAlex Hillman
 
Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Thomas Chacko
 
Simplify writing code with deliberate commits
Simplify writing code with deliberate commitsSimplify writing code with deliberate commits
Simplify writing code with deliberate commitsJoel Chippindale
 
Source Code Management systems
Source Code Management systemsSource Code Management systems
Source Code Management systemsxSawyer
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
A Quick Start - Version Control with Git
A Quick Start - Version Control with GitA Quick Start - Version Control with Git
A Quick Start - Version Control with GitDmitry Sheiko
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to youguestdd9d06
 
Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)Ubuntu Korea Community
 

Semelhante a NWRUG July 2009 - Darcs (20)

GIT Basics
GIT BasicsGIT Basics
GIT Basics
 
Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciBecoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola Paolucci
 
Go 1.8 Release Party
Go 1.8 Release PartyGo 1.8 Release Party
Go 1.8 Release Party
 
Docker Demo @ IuK Seminar
Docker Demo @ IuK SeminarDocker Demo @ IuK Seminar
Docker Demo @ IuK Seminar
 
Composer is the new Drush - Drupal Developer Training (internal)
Composer is the new Drush - Drupal Developer Training (internal)Composer is the new Drush - Drupal Developer Training (internal)
Composer is the new Drush - Drupal Developer Training (internal)
 
The History of React-Hot-Loader
The History of React-Hot-LoaderThe History of React-Hot-Loader
The History of React-Hot-Loader
 
Git Pro Tips
Git Pro TipsGit Pro Tips
Git Pro Tips
 
Becoming a Git Master
Becoming a Git MasterBecoming a Git Master
Becoming a Git Master
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitamin
 
Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview Docker Distributed application bundle & Stack - Overview
Docker Distributed application bundle & Stack - Overview
 
vBACD - Introduction to Opscode Chef - 2/29
vBACD - Introduction to Opscode Chef - 2/29vBACD - Introduction to Opscode Chef - 2/29
vBACD - Introduction to Opscode Chef - 2/29
 
Simplify writing code with deliberate commits
Simplify writing code with deliberate commitsSimplify writing code with deliberate commits
Simplify writing code with deliberate commits
 
Source Code Management systems
Source Code Management systemsSource Code Management systems
Source Code Management systems
 
DrupalCafe5 VCS
DrupalCafe5 VCSDrupalCafe5 VCS
DrupalCafe5 VCS
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
A Quick Start - Version Control with Git
A Quick Start - Version Control with GitA Quick Start - Version Control with Git
A Quick Start - Version Control with Git
 
Rush, a shell that will yield to you
Rush, a shell that will yield to youRush, a shell that will yield to you
Rush, a shell that will yield to you
 
Makefiles Bioinfo
Makefiles BioinfoMakefiles Bioinfo
Makefiles Bioinfo
 
Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)Linux Kernel 개발참여방법과 문화 (Contribution)
Linux Kernel 개발참여방법과 문화 (Contribution)
 
Fixup and autosquash
Fixup and autosquashFixup and autosquash
Fixup and autosquash
 

Mais de PatchSpace Ltd

Conflict in Complex Systems
Conflict in Complex SystemsConflict in Complex Systems
Conflict in Complex SystemsPatchSpace Ltd
 
Personal Kanban (lightning talk)
Personal Kanban (lightning talk)Personal Kanban (lightning talk)
Personal Kanban (lightning talk)PatchSpace Ltd
 
Parsing for Fun and Profit
Parsing for Fun and ProfitParsing for Fun and Profit
Parsing for Fun and ProfitPatchSpace Ltd
 
Why Won't My Car Start?
Why Won't My Car Start?Why Won't My Car Start?
Why Won't My Car Start?PatchSpace Ltd
 
ShRUG 5 - Scottish Ruby Conf edition
ShRUG 5  - Scottish Ruby Conf editionShRUG 5  - Scottish Ruby Conf edition
ShRUG 5 - Scottish Ruby Conf editionPatchSpace Ltd
 
Encouraging Agile Discipline
Encouraging Agile DisciplineEncouraging Agile Discipline
Encouraging Agile DisciplinePatchSpace Ltd
 
From Specification To Success
From Specification To SuccessFrom Specification To Success
From Specification To SuccessPatchSpace Ltd
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsPatchSpace Ltd
 
Elephants In The Meeting Room
Elephants In The Meeting RoomElephants In The Meeting Room
Elephants In The Meeting RoomPatchSpace Ltd
 

Mais de PatchSpace Ltd (10)

Conflict in Complex Systems
Conflict in Complex SystemsConflict in Complex Systems
Conflict in Complex Systems
 
Personal Kanban (lightning talk)
Personal Kanban (lightning talk)Personal Kanban (lightning talk)
Personal Kanban (lightning talk)
 
Parsing for Fun and Profit
Parsing for Fun and ProfitParsing for Fun and Profit
Parsing for Fun and Profit
 
Speedy TDD with Rails
Speedy TDD with RailsSpeedy TDD with Rails
Speedy TDD with Rails
 
Why Won't My Car Start?
Why Won't My Car Start?Why Won't My Car Start?
Why Won't My Car Start?
 
ShRUG 5 - Scottish Ruby Conf edition
ShRUG 5  - Scottish Ruby Conf editionShRUG 5  - Scottish Ruby Conf edition
ShRUG 5 - Scottish Ruby Conf edition
 
Encouraging Agile Discipline
Encouraging Agile DisciplineEncouraging Agile Discipline
Encouraging Agile Discipline
 
From Specification To Success
From Specification To SuccessFrom Specification To Success
From Specification To Success
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & Stubs
 
Elephants In The Meeting Room
Elephants In The Meeting RoomElephants In The Meeting Room
Elephants In The Meeting Room
 

Último

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 

Último (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 

NWRUG July 2009 - Darcs

  • 1. Manchester July 2009 darcs An introduction to a fully-distributed revision control system Ashley Moran Creative Commons Attribution-Noncommercial-Share Alike 2.0 UK: England & Wales License PatchSpace Ltd
  • 2. What is darcs? distributed interactive smart patch-based, not revision/history based written in Haskell
  • 3. Presentation goals To show how darcs makes revision control easy, interactive, and intuitive To show you how to think in terms of patches, not revisions To help you compare darcs to git (in the narration, a video, and questions)
  • 4. Presentation non-goals To show every last feature of darcs Even some really cool ones are omitted To show "best practice" workflows To explain the patch theory that underpins darcs To convince you that darcs is better than git/hg/bzr/svn
  • 5. Initialising a repository % mkdir repo_a % cd repo_a repo_a % darcs init repo_a % ls _darcs repo_a % darcs changes No patches yet
  • 6. Adding a file repo_a % echo "Hello, darcs" > hi.txt repo_a % darcs whatsnew No changes! repo_a % darcs whatsnew --look-for-adds a ./hi.txt repo_a % darcs add hi.txt repo_a % darcs whatsnew addfile ./hi.txt hunk ./hi.txt 1 +Hello, darcs
  • 7. Recording a patch repo_a % darcs record addfile ./hi.txt Shall I record this change? (1/2) [ynWsfvplxdaqjk], or ? for help: y hunk ./hi.txt 1 +Hello, darcs Shall I record this change? (2/2) [ynWsfvplxdaqjk], or ? for help: y What is the patch name? Say hello to darcs Do you want to add a long comment? [yn]n Finished recording patch 'Say hello to darcs'
  • 8. Listing patches repo_a % darcs changes Mon Jul 13 12:31:48 BST 2009 ashley.moran@patchspace.co.uk * Say hello to darcs darcs got my email address from the DARCS_EMAIL environment variable
  • 9. Cloning a repository repo_a % cd .. % darcs get repo_a repo_b % cd repo_b repo_b % darcs changes Mon Jul 13 12:31:48 BST 2009 ashley.moran@patch… * Say hello to darcs Repo B is a clone of Repo A
  • 10. Modifying a file repo_b % echo "How are you?" >> hi.txt repo_b % darcs whatsnew hunk ./hi.txt 2 +How are you? repo_b % darcs diff --unified diff -rN -u old-repo_b/hi.txt new-repo_b/hi.txt --- old-repo_b/hi.txt 2009-07-13 14:55:21.000000000 +0100 +++ new-repo_b/hi.txt 2009-07-13 14:55:21.000000000 +0100 @@ -1 +1,2 @@ Hello, darcs +How are you?
  • 11. Adding a directory repo_b % mkdir src repo_b % echo 'puts "Hi"' > src/hi.rb repo_b % darcs add -r src repo_b % darcs whatsnew --summary M ./hi.txt +1 A ./src/ A ./src/hi.rb
  • 12. Record interactively repo_b % darcs record hunk ./hi.txt 2 +How are you? Shall I record this change? (1/4) [ynWsfvplxdaqjk], or ? for help: n adddir ./src Shall I record this change? (2/4) [ynWsfvplxdaqjk], or ? for help: a What is the patch name? Added application source Do you want to add a long comment? [yn]n Finished recording patch 'Added application source'
  • 13. Record all repo_b % darcs record -a -m 'More hellos' Finished recording patch 'More hellos' repo_b % darcs changes Mon Jul 13 15:51:26 BST 2009 ashley.moran@patch… * More hellos Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch… * Added application source Mon Jul 13 12:31:48 BST 2009 ashley.moran@patch… * Say hello to darcs
  • 14. Showing patch contents repo_b % darcs annotate -p 'More' [More hellos ashley.moran@patchspace.co.uk**20090713145126 Ignore-this: 27105a11a78c889107399e21d7b9dea0 ] hunk ./hi.txt 2 +How are you? darcs annotate has another use - the name is not very intuitive here This named patch contains only one change
  • 15. More patch contents Regex example to locate the patch repo_b % darcs annotate -p '^Added.*source$' [Added application source ashley.moran@patchspace.co.uk**20090713141736 Ignore-this: 7403e5fb594ec9403d26d8c01ffdcb3c ] adddir ./src addfile ./src/hi.rb hunk ./src/hi.rb 1 This named patch contains +puts "Hi" three "primitive patches"
  • 16. Pushing patches repo_b % darcs push Pushing to "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch… * Added application source Shall I push this patch? (1/2) [ynWvplxdaqjk], or ? for help: y Mon Jul 13 15:51:26 BST 2009 ashley.moran@patch… * More hellos Shall I push this patch? (2/2) [ynWsfvplxdaqjk], or ? for help: n Finished applying... Push successful.
  • 17. View remote patches repo_b % darcs changes --repo=../repo_a Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch… * Added application source Mon Jul 13 12:31:48 BST 2009 ashley.moran@patch… * Say hello to darcs
  • 18. Spot a recorded mistake repo_b % darcs whatsnew --summary hi.txt What's new in "hi.txt": No changes! repo_b % cat hi.txt Hello, darcs Already recorded this in a patch How are you? repo_b % sed -ie 's/you/you today/' hi.txt repo_b % cat hi.txt Hello, darcs How are you today? repo_b % darcs whatsnew hunk ./hi.txt 2 -How are you? We want this patch instead +How are you today?
  • 19. Amend-record a patch repo_b % darcs amend-record Mon Jul 13 15:51:26 BST 2009 ashley.moran@patch… * More hellos Shall I amend this patch? [yNvpxq], or ? for help: y hunk ./hi.txt 2 You can amend-record any patch -How are you? that isn't depended upon +How are you today? Shall I add this change? (1/1) [ynWsfvplxdaqjk], or ? for help: y Finished amending patch: Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch… * More hellos
  • 20. View amended patch Before amend-record repo_b % darcs annotate -p 'More' [More hellos ashley.moran@patchspace.co.uk**20090713145126 Ignore-this: 27105a11a78c889107399e21d7b9dea0 ] hunk ./hi.txt 2 +How are you? After amend-record repo_b % darcs annotate -p 'More hellos' [More hellos ashley.moran@patchspace.co.uk**20090713154227 Ignore-this: 3c7d315c69e36a3f3faad64e9074b6e9 ] hunk ./hi.txt 2 +How are you today?
  • 21. Push remaining patches repo_b % darcs push -a Pushing to "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... Finished applying... Push successful. Once you've pushed a patch it would be considered "wild". Don't amend- record a patch that has been pushed!
  • 22. Recording unwanted… repo_b % echo 'exit false' >> src/hi.rb repo_b % cat src/hi.rb puts "Hi" exit false repo_b % darcs whatsnew hunk ./src/hi.rb 2 +exit false repo_b % darcs record -a -m 'Make hi.rb fail' Finished recording patch 'Make hi.rb fail' repo_b % darcs changes --last 1 Mon Jul 13 17:02:07 BST 2009 ashley.moran@patch… * Make hi.rb fail repo_b % darcs whatsnew No changes!
  • 23. …so unrecording… repo_b % darcs unrecord Mon Jul 13 17:02:07 BST 2009 ashley.moran@patch… * Make hi.rb fail Shall I unrecord this patch? (1/4) [ynWsfvplxdaqjk], or ? for help: y Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch… * More hellos Shall I unrecord this patch? (2/4) [ynWsfvplxdaqjk], or ? for help: d Finished unrecording. d for "done" - skip remaining patches
  • 24. …and carrying on. repo_b % darcs changes --last 1 Patch removed Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch… * More hellos repo_b % cat src/hi.rb puts "Hi" Working copy unmodified exit false repo_b % darcs whatsnew hunk ./src/hi.rb 2 Change can be re-recorded +exit false
  • 25. Recording unwanted… repo_b % darcs record -a -m 'Make hi.rb fail' Finished recording patch 'Make hi.rb fail' repo_b % darcs changes -p 'fail' Mon Jul 13 17:15:08 BST 2009 ashley.moran@patch… * Make hi.rb fail To save making a new patch, I'm just re-recording the last
  • 26. …REALLY unwanted… repo_b % darcs obliterate Mon Jul 13 17:15:08 BST 2009 ashley.moran@patch… * Make hi.rb fail Shall I obliterate this patch? (1/4) [ynWsfvplxdaqjk], or ? for help: y Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch… * More hellos Shall I obliterate this patch? (2/4) [ynWsfvplxdaqjk], or ? for help: d Finished obliterating.
  • 27. …and it's REALLY gone. repo_b % darcs changes --last 1 Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch… * More hellos repo_b % darcs changes -p 'fail' repo_b % cat src/hi.rb puts "Hi" Patch never existed!
  • 28. Check repos are in sync repo_b % darcs push --dry-run ../repo_a Would push to "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... No recorded local changes to push! repo_b % darcs pull --dry-run ../repo_a Would pull from "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... No remote changes to pull in! --dry-run is useful for seeing changes
  • 29. Record a change in repo A repo_b % cd ../repo_a repo_a % echo 'Yo dude' > hi.txt repo_a % darcs record -a -m 'Change greeting' Finished recording patch 'Change greeting' repo_a % darcs annotate -p 'greet' [Change greeting ashley.moran@patchspace.co.uk**20090713171149 Ignore-this: b41771e45b0a2277729dae96768e232b ] hunk ./hi.txt 1 -Hello, darcs -How are you today? +Yo dude
  • 30. Record a change in repo B repo_a % cd ../repo_b repo_b % echo 'Aup youth' > hi.txt repo_b % darcs record -a -m 'Update salutation' Finished recording patch 'Update salutation' repo_b % darcs annotate -p 'salut' [Update salutation ashley.moran@patchspace.co.uk**20090713171522 Ignore-this: cfe070e308bb4a14e010a6ea0d15be72 ] hunk ./hi.txt 1 -Hello, darcs -How are you today? +Aup youth
  • 31. Pull in the change: conflict! repo_b % darcs pull darcs remembers remote repos used Pulling from "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... Mon Jul 13 18:11:49 BST 2009 ashley.moran@patch… * Change greeting Shall I pull this patch? (1/1) [ynWsfvplxdaqjk], or ? for help: y Backing up ./hi.txt(-darcs-backup0) We have conflicts in the following files: ./hi.txt Finished pulling and applying.
  • 32. Repo in conflict state repo_b % ls _darcs hi.txt-darcs-backup0 src hi.txt hi.txte repo_b % cat hi.txt v v v v v v v Aup youth Conflicted working copy file ************* Yo dude ^ ^ ^ ^ ^ ^ ^ repo_b % cat hi.txt-darcs-backup0 Original local file Aup youth repo_b % cat hi.txte Hello, darcs Pre-conflict file How are you? The darcs team wants to improve conflict marking
  • 33. Resolve the conflict After much discussion, the correct form is found repo_b % echo 'Aup dude' > hi.txt repo_b % darcs record -a -m 'Correct greeting' Finished recording patch 'Correct greeting' repo_b % rm hi.txt-darcs-backup0 hi.txte The 'Correct greeting' patch depends upon the conflicting primitive patches, and resolves the conflict
  • 34. What's new w.r.t. repo A? repo_b % darcs push --dry-run Would push to "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... Would push the following changes: Mon Jul 13 18:15:22 BST 2009 ashley.moran@patch… * Update salutation Mon Jul 13 18:32:57 BST 2009 ashley.moran@patch… * Correct greeting Making no changes: this is a dry run. Repo A needs our original patch and also the conflict resolution patch
  • 35. Resolve the conflict repo_b % darcs push -a Pushing to "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... Finished applying... Push successful.
  • 36. Creating a fresh repo repo_b % mkdir ../repo_c repo_b % cd ../repo_c repo_c % darcs init
  • 37. Pulling from Repo A repo_c % darcs pull ../repo_a Pulling from "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... Mon Jul 13 12:31:48 BST 2009 ashley.moran@patch… * Say hello to darcs Shall I pull this patch? (1/6) [ynWsfvplxdaqjk], or ? for help: y Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch… * Added application source Shall I pull this patch? (2/6) [ynWvplxdaqjk], or ? for help: d Finished pulling and applying. Repo C is now 'primed' to pull from repositories generated from Repo A
  • 38. Pulling from Repo B repo_c % darcs pull ../repo_b Mon Jul 13 15:17:36 BST 2009 ashley.moran@patch… * Added application source Shall I pull this patch? (1/5) [ynWvplxdaqjk], or ? for help: y Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch… * More hellos Shall I pull this patch? (2/5) [ynWsfvplxdaqjk], or ? for help: d Finished pulling and applying. I didn't need to pull the first patch. I could have pulled any patch without dependencies. This will be explained later.
  • 39. What's left in Repo A? repo_c % darcs pull --dry-run ../repo_a Would pull from "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... Would pull the following changes: Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch… * More hellos Mon Jul 13 18:11:49 BST 2009 ashley.moran@patch… * Change greeting Mon Jul 13 18:15:22 BST 2009 ashley.moran@patch… * Update salutation Mon Jul 13 18:32:57 BST 2009 ashley.moran@patch… * Correct greeting Making no changes: this is a dry run. We can push and pull from Repo A, B or C in any direction - none of them are special to darcs
  • 40. A depended-on patch repo_c % darcs pull ../repo_a Pulling from "/Users/ashleymoran/Documents/ PatchSpace/Presentations/darcs/repos/repo_a"... Mon Jul 13 16:42:27 BST 2009 ashley.moran@patch… * More hellos Shall I pull this patch? (1/4) [ynWsfvplxdaqjk], or ? for help: n Skipped pull of 3 changes. You don't want to pull any patches, and that's fine with me! darcs knows that all the remaining patches depend on this one, so doesn't attempt to pull them
  • 41. The future of darcs Ian Lynagh is doing a re-implementation of the darcs patch algebra (and proof of the patch theory) under the project name Camp http://projects.haskell.org/camp/ Camp has a good demonstration to visualise patch vs chronological history http://projects.haskell.org/camp/unique Let's watch the video =)
  • 42. What's not covered? (1) Deleting files - just throw away and darcs sees they should be removed darcs mv - renaming files darcs revert - discarding your working copy changes darcs unrevert - getting them back!
  • 43. What's not covered? (2) darcs rollback - generating a patch to undo a change darcs tag - marking a snapshot version of a repository you can easily get back to darcs send - generating a patch bundle file you can send by email etc darcs apply - applying a patch bundle
  • 44. Repositories vs branches In darcs, a branch and a repository are the same thing You can also have "branches" identified by patch keywords, eg "[BUG61] ..." You can view this presentation as if Repo A is remote; Repo B is local Repo A is local; Repo B is a branch Replace repo_a with user@remote:repo_a
  • 45. Centralised repositories You can nominate repositories as a "central repository", but this is only for convenience Hosting is available: http://patch-tag.com/
  • 46. darcs limitations Some darcs operations are much slower than the equivalents in other revision control systems Could be a problem with very large repos Patch theory is still not fully understood, so edge case bugs may be lurking Mainly suitable for small-medium teams, or where a small team can help integrate patches (eg OSS projects)
  • 47. Why I use darcs Conceptually simple - it's just repositories and patches Smart - handles complex merge problems Easy to use - hides the complexity with a friendly interface Interactive - always presents me with the choices I need Flat learning cur ve - took no time to learn
  • 49. Contact Slides prepared by Ashley Moran ashley.moran@patchspace.co.uk www.patchspace.co.uk Creative Commons licensed - contact me for commercial use