~jan0sch/darcs-book
Showing details for patch ace4cdd739223b6691d379487bbb6bda010a2e99.
diff -rN -u old-darcs-book/en/03-working-locally.md new-darcs-book/en/03-working-locally.md --- old-darcs-book/en/03-working-locally.md 2024-11-23 23:54:16.038476084 +0000 +++ new-darcs-book/en/03-working-locally.md 2024-11-23 23:54:16.038476084 +0000 @@ -390,6 +390,34 @@ Changes like this allow you to be a little more specific about what your intentions are. `replace` is often used when renaming functions or variables. +Even if you don't `replace` explicitly you can instruct `darcs` to look for +replaces for you with the `--look-for-replaces` flag. + +``` +$ cat Hello.hs +main = putStrLn "Hello World!" +$ sed -i '' 's/World/Everyone/' Hello.hs +$ darcs whatsnew +hunk ./Hello.hs 1 +-main = putStrLn "Hello World!" ++main = putStrLn "Hello Everyone!" +``` +Just as we suspected, `darcs` has detected a `hunk` instead of a `replace`. +Let's use `--look-for-replaces` and see what happens. + +``` +$ darcs whatsnew --look-for-replaces +replace ./Hello.hs [A-Za-z_0-9] World Everyone +$ darcs record --look-for-replaces -m Everyone +replace ./Hello.hs [A-Za-z_0-9] World Everyone +Shall I record this change? (1/1) [ynW...], or ? for more options: y +Do you want to Record these changes? [Yglqk...], or ? for more options: y +Finished recording patch 'Everyone' +``` + +Just like with `--look-for-moves` `darcs` could figure this out on its own. In +chapter 6 we will take a closer look at the benefits of this type of change. + Booooooooooring!!! ------------------