Simultaneously, both Harry and Sally have a crisis of conscience and realize that their code has no comments at all.
Harry:
lottery harry$ vv diff === ================ === Modified: File @/src/pb.c --- @/src/pb.c 3cdd8958d3467042fd5791f3c16951f3cfdacc5c +++ @/src/pb.c 2011/05/31 16:53:00.000 +0000 @@ -47,6 +47,7 @@ return -1; } + // lottery ball numbers are always shown sorted qsort(white_balls, 5, sizeof(int), my_sort_func); return 0; lottery harry$ vv commit -m "comments" revision: 21:cb3675aada7836e63ec88fc5a6eeb9f80a00f656 branch: master who: harry when: 2011/05/31 11:53:32.590 -0500 comment: comments parent: 20:68f12175bcda2296298f6b0f30da326341976356 lottery harry$ vv push Pushing to http://server.futilisoft.com:8080/repos/lottery: Pushing... Done.
And Sally:
lottery sally$ vv diff === ================ === Modified: File @/src/pb.c --- @/src/pb.c 7d927466a22e24d4adc5542f6bf0a4797aa06801 +++ @/src/pb.c 2011/05/31 16:54:57.000 +0000 @@ -35,7 +35,7 @@ { int balls[6]; int count_balls = 0; - int favorite = 0; + int favorite = 0; // this should be a bool for (int i=1; i<argc; i++) { @@ -69,10 +69,13 @@ goto usage_error; } + // the power ball is always the last one given int power_ball = balls[5]; int result = calculate_result(balls, power_ball); + // calculate result can return -1 if the ball numbers + // are out of range if (result < 0) { goto usage_error; lottery sally$ vv commit -m "comments" revision: 21:69f50e32759eef176403ca0c019fb1af73145fb9 branch: no_boys_allowed who: sally when: 2011/05/31 11:55:40.174 -0500 comment: comments parent: 18:37939b07309af8232c44048ca0a1633c982b7506 lottery sally$ vv push Pushing to http://server.futilisoft.com:8080/repos/lottery: Pushing... Done.
Harry decides to try again to merge the changes from Sally’s branch.
lottery harry$ vv heads revision: 22:69f50e32759eef176403ca0c019fb1af73145fb9 branch: no_boys_allowed who: sally when: 2011/05/31 11:55:40.174 -0500 comment: comments parent: 18:37939b07309af8232c44048ca0a1633c982b7506 revision: 21:cb3675aada7836e63ec88fc5a6eeb9f80a00f656 branch: master who: harry when: 2011/05/31 11:53:32.590 -0500 comment: comments parent: 20:68f12175bcda2296298f6b0f30da326341976356 lottery harry$ vv merge -r 69f50e32759eef176403ca0c019fb1af73145fb9 1 updated, 0 deleted, 0 added, 1 merged, 0 unresolved
No problems with the merge. Let’s review the changes.
lottery harry$ vv diff === ================ === Modified: File @/src/pb.c --- @/src/pb.c ec840f5b96e6f64ab9efaf0b37975ceafa6bfe81 +++ @/src/pb.c 2011/05/31 16:57:07.000 +0000 @@ -57,7 +57,7 @@ { int balls[6]; int count_balls = 0; - int favorite = 0; + int favorite = 0; // this should be a bool for (int i=1; i<argc; i++) { @@ -91,10 +91,13 @@ goto usage_error; } + // the power ball is always the last one given int power_ball = balls[5]; int result = calculate_result(balls, power_ball); + // calculate result can return -1 if the ball numbers + // are out of range if (result < 0) { goto usage_error;
Harry checks to see if everything compiles, and commits the merge.
lottery harry$ make gcc -std=c99 -Wall -Wextra -Werror pb.c -o pb lottery harry$ vv commit -m "merge changes from sally" revision: 23:31d8497141637a90feeb38f16ac9ff9454673e3d branch: master who: harry when: 2011/05/31 11:57:55.503 -0500 comment: merge changes from sally parent: 22:69f50e32759eef176403ca0c019fb1af73145fb9 parent: 21:cb3675aada7836e63ec88fc5a6eeb9f80a00f656 lottery harry$ vv push Pushing to http://server.futilisoft.com:8080/repos/lottery: Pushing... Done.