Harry decides the time has come to create a proper
Makefile
. And also to gratuitously rename
lottery.c
.
lottery harry$ hg add Makefile lottery harry$ hg rename src/lottery.c src/pb.c lottery harry$ hg st A Makefile A src/pb.c R src/lottery.c lottery harry$ hg commit -m "Makefile. and lottery.c was too long to type." 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 2 changes to 2 files
Sally maintains her momentum with #define
and adds names for the ball ranges.
lottery sally$ hg diff diff -r c3e40a7996f0 src/lottery.c --- a/src/lottery.c Tue May 17 11:36:12 2011 -0500 +++ b/src/lottery.c Tue May 17 11:50:23 2011 -0500 @@ -3,6 +3,8 @@ #include <stdlib.h> #define LUCKY_NUMBER 7 +#define MAX_WHITE_BALL 59 +#define MAX_POWER_BALL 39 int calculate_result(int white_balls[5], int power_ball) { @@ -10,7 +12,7 @@ { if ( (white_balls[i] < 1) - || (white_balls[i] > 59) + || (white_balls[i] > MAX_WHITE_BALL) ) { return -1; @@ -19,7 +21,7 @@ if ( (power_ball < 1) - || (power_ball > 39) + || (power_ball > MAX_POWER_BALL) ) { return -1;
And commits her changes.
lottery sally$ hg commit -m "more #defines" lottery sally$ hg push pushing to http://server.futilisoft.com:8000/ searching for changes abort: push creates new remote heads on branch 'default'! (you should pull and merge or use push -f to force)
Grrr. That Harry is dumber than a sack full of hammers.
lottery sally$ hg pull pulling from http://server.futilisoft.com:8000/ searching for changes adding changesets adding manifests adding file changes added 1 changesets with 2 changes to 2 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) lottery sally$ hg heads changeset: 11:346dd1ab5474 tag: tip parent: 9:c3e40a7996f0 user: Harry <harry@futilisoft.com> date: Tue May 17 11:48:57 2011 -0500 summary: Makefile. and lottery.c was too long to type. changeset: 10:51a8540dbb7e user: Sally <sally@futilisoft.com> date: Tue May 17 11:51:24 2011 -0500 summary: more #defines lottery sally$ hg merge merging src/lottery.c and src/pb.c to src/pb.c 1 files updated, 1 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit)
Note that Mercurial correctly handled this merge, even though the same file had been modified in one branch and renamed in the other. |
lottery sally$ cd .. lottery sally$ make gcc -std=c99 -Wall -Wextra -Werror src/pb.c -o pb lottery sally$ hg commit -m "merge" 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 2 changesets with 2 changes to 2 files