Simultaneously, both Harry and Sally have a crisis of conscience and realize that their code has no comments at all.
Harry:
lottery harry$ hg diff diff -r 922ff5acda79 src/pb.c --- a/src/pb.c Tue May 17 14:31:41 2011 -0500 +++ b/src/pb.c Tue May 17 14:39:21 2011 -0500 @@ -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$ hg commit -m comments lottery harry$ hg push pushing to http://server.futilisoft.com:8000/ searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files
And Sally:
lottery sally$ hg diff diff -r 836e4df60a27 src/pb.c --- a/src/pb.c Tue May 17 14:24:14 2011 -0500 +++ b/src/pb.c Tue May 17 14:40:27 2011 -0500 @@ -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$ hg commit -m comments lottery sally$ hg push pushing to http://server.futilisoft.com:8000/ searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files (+1 heads)
Harry decides to try again to merge the changes from Sally’s branch.
lottery harry$ hg heads changeset: 21:76fcfc4170dc branch: no_boys_allowed tag: tip parent: 17:836e4df60a27 user: Sally <sally@futilisoft.com> date: Tue May 17 14:44:56 2011 -0500 summary: comments changeset: 20:6ae39c9ee2e8 user: Harry <harry@futilisoft.com> date: Tue May 17 14:45:04 2011 -0500 summary: comments lottery harry$ hg merge -r 21 merging src/pb.c 0 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit)
lottery harry$ hg diff diff -r 6ae39c9ee2e8 src/pb.c --- a/src/pb.c Tue May 17 14:45:04 2011 -0500 +++ b/src/pb.c Tue May 17 14:47:52 2011 -0500 @@ -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;
No worries on the merge then. 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$ hg commit -m "merge changes from sally" lottery harry$ hg push pushing to http://server.futilisoft.com:8000/ searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files (-1 heads)