On Jan 18, 2010, at 3:14 PM, Ron Aaron wrote: > The following patch makes it possible to "sync-then-update" > or "pull-then-update" in one command (like Mercurial "hg pull -u"):
Fossil already does "sync-then-update": simply enable autosync mode (on by default) and do an "update". Why do we need a new mechanism to accomplish the same thing? > > > Index: src/sync.c > =================================================================== > --- src/sync.c > +++ src/sync.c > @@ -68,14 +68,16 @@ > ** This routine processes the command-line argument for push, pull, > ** and sync. If a command-line argument is given, that is the URL > ** of a server to sync against. If no argument is given, use the > ** most recently synced URL. Remember the current URL for next time. > */ > +int alsoUpdate = 0; > void process_sync_args(void){ > const char *zUrl = 0; > int urlOptional = find_option("autourl",0,0)!=0; > int dontKeepUrl = find_option("once",0,0)!=0; > + alsoUpdate = find_option("update",0,0)!=0; > url_proxy_options(); > db_find_and_open_repository(1); > if( g.argc==2 ){ > zUrl = db_get("last-sync-url", 0); > }else if( g.argc==3 ){ > @@ -106,11 +108,12 @@ > ** > ** Usage: %fossil pull ?URL? ?options? > ** > ** Pull changes from a remote repository into the local repository. > ** Use the "-R REPO" or "--repository REPO" command-line options > -** to specify an alternative repository file. > +** to specify an alternative repository file. Use the "--update" > +** command-line option to perform an update after the pull. > ** > ** If the URL is not specified, then the URL from the most recent > ** clone, push, pull, remote-url, or sync command is used. > ** > ** The URL specified normally becomes the new "remote-url" used for > @@ -121,10 +124,13 @@ > ** See also: clone, push, sync, remote-url > */ > void pull_cmd(void){ > process_sync_args(); > client_sync(0,1,0,0,0); > + if (alsoUpdate) { > + update_cmd(); > + } > } > > /* > ** COMMAND: push > ** > @@ -156,11 +162,12 @@ > ** Usage: %fossil sync ?URL? ?options? > ** > ** Synchronize the local repository with a remote repository. This is > ** the equivalent of running both "push" and "pull" at the same time. > ** Use the "-R REPO" or "--repository REPO" command-line options > -** to specify an alternative repository file. > +** to specify an alternative repository file. Use the "--update" > +** command-line option to perform an update after the sync. > ** > ** If a user-id and password are required, specify them as follows: > ** > ** http://userid:passw...@www.domain.com:1234/path > ** > @@ -175,10 +182,13 @@ > ** See also: clone, push, pull, remote-url > */ > void sync_cmd(void){ > process_sync_args(); > client_sync(1,1,0,0,0); > + if (alsoUpdate) { > + update_cmd(); > + } > } > > /* > ** COMMAND: remote-url > ** > > _______________________________________________ > fossil-users mailing list > fossil-users@lists.fossil-scm.org > http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users D. Richard Hipp d...@hwaci.com _______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users