Harry immediately moves on to his next task, which is to restructure
the tree a bit. He doesn’t want the top level of the repository to
get too cluttered so he decides to move their vast number of source code files into a src
subdirectory.
lottery harry$ mkdir src lottery harry$ vv move lottery.c src lottery harry$ vv st Added: @/src/ Moved: @/src/lottery.c # was at @/ Found: @/a.out lottery harry$ vv commit -m "dir structure" revision: 9:519ea522ac74f7f1764088d98478f8f569b65f18 branch: master who: harry when: 2011/05/31 10:30:39.162 -0500 comment: dir structure parent: 8:817b33a44fd16f268c6bd0f75b95aaf32e461554 lottery harry$ vv push Pushing to http://server.futilisoft.com:8080/repos/lottery: Pushing... Done.
Sally decides having the number 7 as a constant in the
code is ugly enough to stop an eight-day clock. She adds a #define
to give it a more meaningful
name.
lottery sally$ vv diff === ================ === Modified: File @/lottery.c --- @/lottery.c 5b6f6ebaab98dbfe3386f90436af79dc142482f2 +++ @/lottery.c 2011/05/31 15:31:07.000 +0000 @@ -2,6 +2,8 @@ #include <stdio.h> #include <stdlib.h> +#define LUCKY_NUMBER 7 + int calculate_result(int white_balls[5], int power_ball) { for (int i=0; i<5; i++) @@ -50,7 +52,7 @@ return -1; } - if (7 == power_ball) + if (LUCKY_NUMBER == power_ball) { result = result * 2; }
And immediately commits and pushes the change.
lottery sally$ vv commit -m "use a #define for the lucky number" revision: 9:b5b788895d07b660b2b9213f089383a88d201d27 branch: master who: sally when: 2011/05/31 10:31:45.918 -0500 comment: use a #define for the lucky number parent: 8:817b33a44fd16f268c6bd0f75b95aaf32e461554 lottery sally$ vv push vv: Error 234 (sglib): The branch needs to be merged.
Hmmm. Sally needs to pull and merge before she can push her changes.
lottery sally$ vv pull Pulling from http://server.futilisoft.com:8080/repos/lottery: Pulling... Done.
She uses vv heads to get a look at the merge situation.
lottery sally$ vv heads revision: 10:519ea522ac74f7f1764088d98478f8f569b65f18 branch: master who: harry when: 2011/05/31 10:30:39.162 -0500 comment: dir structure parent: 8:817b33a44fd16f268c6bd0f75b95aaf32e461554 revision: 9:b5b788895d07b660b2b9213f089383a88d201d27 branch: master who: sally when: 2011/05/31 10:31:45.918 -0500 comment: use a #define for the lucky number parent: 8:817b33a44fd16f268c6bd0f75b95aaf32e461554
And proceeds to attempt the merge itself.
lottery sally$ vv merge 1 updated, 0 deleted, 1 added, 0 merged, 0 unresolved lottery sally$ vv st Added: @/src/ Moved: @/src/lottery.c # was at @/ Found: @/a.out
No problems on the merge.
lottery sally$ vv commit -m "merge" revision: 11:3cc62d4c79e2f3a94bb2731e84d2304a10760938 branch: master who: sally when: 2011/05/31 10:32:44.349 -0500 comment: merge parent: 10:519ea522ac74f7f1764088d98478f8f569b65f18 parent: 9:b5b788895d07b660b2b9213f089383a88d201d27 lottery sally$ vv push Pushing to http://server.futilisoft.com:8080/repos/lottery: Pushing... Done.