Last active
December 14, 2015 19:29
Revisions
-
sebfisch revised this gist
Mar 11, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -100,8 +100,8 @@ to `Utilities`. There is no split command but we can do it by hand. Fred: Now we have a clone containing only the first two patches and can remove the second because nothing depends on it? Lisa: Right. We can use unrecord for that. Then we record two patches, splitting your changes. # echo yny | darcs unrecord # echo nnyy | darcs record -m "added database helper" -
sebfisch revised this gist
Mar 11, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -204,4 +204,4 @@ Lisa: Right. That would complicate things again. Seems like there should be a merge command. Or can splitting and merging be implemented using [rebase for Darcs](http://darcs.net/Ideas/RebaseDesign)? Fred: Well, you said *you* know Darcs! -
sebfisch revised this gist
Mar 11, 2013 . 1 changed file with 83 additions and 27 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,56 +1,56 @@ # A Dialog on How to Manage Patches with Darcs Fred: So, you know Darcs? Lisa: Sure. Fred: I heard it is quite flexible in managing patches. Wanna show me? Lisa: Ok, let's make a new repository for some imaginary project. # mkdir project; cd project; darcs init Fred: Ok, now add these files. A `Main` module using some helper function from a `Utilities` module. # echo define helperFunction > Utilities # echo import Utilities > Main # echo use helperFunction >> Main Lisa: Let's make a patch including all these changes. # darcs -lam "added initial Main and Utilities" Fred: I want to add database access. I make a new module and use it in Main. # echo define access > Database # echo use Database.access >> Main Fred: I also add a helper to `Utilities` and use it in `Database`. # echo define dbHelper >> Utilities # echo use dbHelper >> Database Lisa: Here is a patch for that. # darcs record -lam "added database access with helper" Lisa: I add a GUI and use your database helper for that. # echo import Utilities > GUI # echo use dbHelper >> GUI Lisa: I also add another helper function and use it. # echo define guiHelper >> Utilities # echo use guiHelper >> GUI Fred: By now, I know how to make a patch. # darcs record -lam "added GUI with helper and using DB helper" Lisa: Let's see what we have until now. # yes | darcs changes --reverse @@ -82,44 +82,44 @@ Fred: Let's see what we have until now. hunk ./Utilities 3 +define guiHelper Fred: Ok, I see which files were added by which patch and hunks seem to be changes to the contents of files. Lisa: Right. Now I want to remove database access but keep the GUI. Fred: You can't remove the database patch because the GUI patch depends on it adding the `dbHelper`. Lisa: It would be nice, if Darcs would let me split your patch, so I can remove your changes to `Database` and `Main` but keep your changes to `Utilities`. There is no split command but we can do it by hand. # cd ..; mkdir clone; cd clone; darcs init # echo yyny | darcs pull ../project Fred: Now we have a clone containing only the first two patches and can remove the second because nothing depends on it? Lisa: Right. We will use `unrecord` so Darcs knows that the patch was once there. Then we record two patches, splitting your changes. # echo yny | darcs unrecord # echo nnyy | darcs record -m "added database helper" # yes | darcs record -m "added database access" Lisa: Now we can pull the remaining changes. This will also include the original big patch adding database access and the helper function. # yes | darcs pull project Fred: So now we are back where we started? Lisa: But we can now obliterate the big database patch as well as the small one that I don't need for the GUI. # echo nyyy | darcs obliterate Fred: Let's see what we have now. # yes | darcs changes --reverse @@ -145,7 +145,63 @@ Lisa: Let's see what we have now. hunk ./Utilities 3 +define guiHelper Fred: Ok, but that sure was complicated. There should be a split command that does what you just did by hand. Can we now pull back the changes from the clone into our project? # cd ../project; darcs pull ../clone darcs: bug at src/Darcs/Patch/Depends.hs:322 Failed to commute common patches: * added GUI with helper and using DB helper * added database access with helper Lisa: Oops! Let's just work in the clone. Fred: I know how to drastically simplify your GUI implementation. I don't need the `guiHelper` and just delete it from `GUI` and `Utilities`. # sed -i "$ d" Utilities # sed -i "$ d" GUI Fred: Let's record that. # darcs record -am "simplified GUI" Lisa: There are now two patches for adding the GUI. # yes | darcs changes --reverse --last=2 [added GUI with helper and using DB helper] addfile ./GUI hunk ./GUI 1 +import Utilities +use dbHelper +use guiHelper hunk ./Utilities 3 +define guiHelper [simplified GUI] hunk ./GUI 3 -use guiHelper hunk ./Utilities 3 -define guiHelper Fred: Hmm, I wish I could merge them into a single patch that just adds the `GUI` file without using `guiHelper`. Lisa: Then you should have used amend-record instead of recording a new patch. Now you can still unrecord and then amend the changes. # echo yny | darcs unrecord # yes | darcs amend-record Fred: But unrecording would not work if there were already other patches depending on the simplified GUI. Lisa: Right. That would complicate things again. Seems like there should be a merge command. Or can splitting and merging be implemented using [rebase for Darcs](http://darcs.net/Ideas/RebaseDesign)? Fred: Good question. -
sebfisch revised this gist
Mar 11, 2013 . 1 changed file with 77 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,56 +1,56 @@ # A Dialog on How to Manage Patches with Darcs Lisa: So, you know Darcs? Fred: Sure. Lisa: I heard it is quite flexible in managing patches. Wanna show me? Fred: Ok, let's make a new repository for some imaginary project. # mkdir project; cd project; darcs init Lisa: Ok, now add these files. A `Main` module using some helper function from a `Utilities` module. # echo define helperFunction > Utilities # echo import Utilities > Main # echo use helperFunction >> Main Fred: Let's make a patch including all these changes. # darcs -lam "added initial Main and Utilities" Lisa: I want to add database access. I make a new module and use it in Main. # echo define access > Database # echo use Database.access >> Main Lisa: I also add a helper to `Utilities` and use it in `Database`. # echo define dbHelper >> Utilities # echo use dbHelper >> Database Fred: Here is a patch for that. # darcs record -lam "added database access with helper" Fred: I add a GUI and use your database helper for that. # echo import Utilities > GUI # echo use dbHelper >> GUI Fred: I also add another helper function and use it. # echo define guiHelper >> Utilities # echo use guiHelper >> GUI Lisa: By now, I know how to make a patch. # darcs record -lam "added GUI with helper and using DB helper" Fred: Let's see what we have until now. # yes | darcs changes --reverse @@ -82,10 +82,70 @@ Lisa: Let's see what we have until now. hunk ./Utilities 3 +define guiHelper Lisa: Ok, I see which files were added by which patch and hunks seem to be changes to the contents of files. Fred: Right. Now I want to remove database access but keep the GUI. Lisa: You can't remove the database patch because the GUI patch depends on it adding the `dbHelper`. Fred: It would be nice, if Darcs would let me split your patch, so I can remove your changes to `Database` and `Main` but keep your changes to `Utilities`. There is no split command but we can do it by hand. # cd ..; mkdir clone; cd clone; darcs init # echo yyny | darcs pull ../project Lisa: Now we have a clone containing only the first two patches and can remove the second because nothing depends on it? Fred: Right. We will use `unrecord` so Darcs knows that the patch was once there. Then we record two patches, splitting your changes. # echo yny | darcs unrecord # echo nnyy | darcs record -m "added database helper" # yes | darcs record -m "added database access" Fred: Now we can pull the remaining changes. This will also include the original big patch adding database access and the helper function. # yes | darcs pull project Lisa: So now we are back where we started? Fred: But we can now obliterate the big database patch as well as the small one that I don't need for the GUI. # echo nyyy | darcs obliterate Lisa: Let's see what we have now. # yes | darcs changes --reverse [added initial Main and Utilities] addfile ./Main hunk ./Main 1 +import Utilities +use helperFuntion addfile ./Utilities hunk ./Utilities 1 +define helperFunction [added database helper] hunk ./Utilities 2 +define dbHelper [added GUI with helper and using DB helper] addfile ./GUI hunk ./GUI 1 +import Utilities +use dbHelper +use guiHelper hunk ./Utilities 3 +define guiHelper Lisa: Ok, but that sure was complicated. And the Darcs Manual explicitly advises against unrecording changes that you want to re-record or that others have in their repositories. Isn't there a better way? What about rollback? -
sebfisch revised this gist
Mar 11, 2013 . 1 changed file with 40 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,3 +49,43 @@ Lisa: I also add another helper function and use it. Fred: By now, I know how to make a patch. # darcs record -lam "added GUI with helper and using DB helper" Lisa: Let's see what we have until now. # yes | darcs changes --reverse [added initial Main and Utilities] addfile ./Main hunk ./Main 1 +import Utilities +use helperFuntion addfile ./Utilities hunk ./Utilities 1 +define helperFunction [added database access with helper] addfile ./Database hunk ./Database 1 +define access +use dbHelper hunk ./Main 3 +use Database.access hunk ./Utilities 2 +define dbHelper [added GUI with helper and using DB helper] addfile ./GUI hunk ./GUI 1 +import Utilities +use dbHelper +use guiHelper hunk ./Utilities 3 +define guiHelper Fred: Ok, I see which files were added by which patch and hunks seem to be changes to the contents of files. Lisa: Right. Now I want to remove database access but keep the GUI. Fred: You can't remove the database patch because the GUI patch depends on it adding the `dbHelper`. -
sebfisch revised this gist
Mar 11, 2013 . 1 changed file with 35 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,15 +8,44 @@ Fred: I heard it is quite flexible in managing patches. Wanna show me? Lisa: Ok, let's make a new repository for some imaginary project. # mkdir project; cd project; darcs init Fred: Ok, now add these files. A `Main` module using some helper function from a `Utilities` module. # echo define helperFunction > Utilities # echo import Utilities > Main # echo use helperFunction >> Main Lisa: Let's make a patch including all these changes. # darcs -lam "added initial Main and Utilities" Fred: I want to add database access. I make a new module and use it in Main. # echo define access > Database # echo use Database.access >> Main Fred: I also add a helper to `Utilities` and use it in `Database`. # echo define dbHelper >> Utilities # echo use dbHelper >> Database Lisa: Here is a patch for that. # darcs record -lam "added database access with helper" Lisa: I add a GUI and use your database helper for that. # echo import Utilities > GUI # echo use dbHelper >> GUI Lisa: I also add another helper function and use it. # echo define guiHelper >> Utilities # echo use guiHelper >> GUI Fred: By now, I know how to make a patch. # darcs record -lam "added GUI with helper and using DB helper" -
sebfisch revised this gist
Mar 11, 2013 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,4 +10,13 @@ Lisa: Ok, let's make a new repository for some imaginary project. sh# mkdir project; cd project; darcs init Fred: Ok, now add these files. A `Main` module using some helper function from a `Utilities` module. sh# echo define helperFunction > Utilities sh# echo import Utilities > Main sh# echo use helperFunction >> Main Lisa: Now let's make a patch including all these changes. sh# darcs -lam "added initial Main and Utilities" -
sebfisch revised this gist
Mar 11, 2013 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,13 @@ # A Dialog on How to Manage Patches with Darcs Fred: So, you know Darcs? Lisa: Sure. Fred: I heard it is quite flexible in managing patches. Wanna show me? Lisa: Ok, let's make a new repository for some imaginary project. sh# mkdir project; cd project; darcs init -
Sebastian Fischer created this gist
Mar 11, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ # A Dialog on How to Manage Patches with Darcs