| Ticket UUID: | 2aaa8042caec7929f432ce1de37b10563c70dd07 | ||
| Title: | Option to avoid saving the sync URL | ||
| Status: | Fixed | Type: | Feature_Request |
| Severity: | Minor | Priority: | |
| Subsystem: | Resolution: | Fixed | |
| Last Modified: | 2009-11-06 15:31:13 | ||
| Version Found In: | 149945beea | ||
| Description & Comments: | |||
|
I have a clone/fork of Fossil repository on my webserver (let's say it's http://example.com/fossil-fork), which I merge with the main one from time to time. When I pull changes from http://www.fossil-scm.org, the URL gets saved into last-sync-url. The next time I commit to it (with autosync option turned on), Fossil tries to push changes into mainline, while I want it to push into my fork (http://example.com/fossil-fork). I have to use remote-url command to set last-sync-url back to the URL of my fork.
I think the "--once" option for sync/pull/push will be useful for synchronizing forks. E.g., $ fossil remote-url http://example.com/fossil-fork $ fossil pull --once http://www.fossil-scm.org ... Total network traffic: 318 bytes sent, 1292 bytes received $ fossil remote-url http://example.com/fossil-fork Diff:
--- src/sync.c
+++ src/sync.c
@@ -67,14 +67,17 @@
/*
** 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.
+**
+** If --once option is specified, do not remember URL.
*/
void process_sync_args(void){
const char *zUrl = 0;
int urlOptional = find_option("autourl",0,0)!=0;
+ int syncOnce = find_option("once",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 ){
@@ -83,11 +86,13 @@
if( zUrl==0 ){
if( urlOptional ) exit(0);
usage("URL");
}
url_parse(zUrl);
- db_set("last-sync-url", g.urlIsFile ? g.urlCanonical : zUrl, 0);
+ if ( syncOnce==0 ) {
+ db_set("last-sync-url", g.urlIsFile ? g.urlCanonical : zUrl, 0);
+ }
user_select();
if( g.argc==2 ){
if( g.urlPort!=g.urlDfltPort ){
printf("Server: %s://%s:%d%s\n",
g.urlProtocol, g.urlName, g.urlPort, g.urlPath);
@@ -99,16 +104,18 @@
}
/*
** COMMAND: pull
**
-** Usage: %fossil pull ?URL? ?-R|--respository REPOSITORY?
+** Usage: %fossil pull ?URL? ?-R|--respository REPOSITORY? ?--once?
**
** Pull changes from a remote repository into the local repository.
**
** If the URL is not specified, then the URL from the most recent
** clone, push, pull, remote-url, or sync command is used.
+**
+** If --once option is specified, do not remember URL.
**
** See also: clone, push, sync, remote-url
*/
void pull_cmd(void){
process_sync_args();
@@ -116,16 +123,18 @@
}
/*
** COMMAND: push
**
-** Usage: %fossil push ?URL? ?-R|--repository REPOSITORY?
+** Usage: %fossil push ?URL? ?-R|--repository REPOSITORY? ?--once?
**
** Push changes in the local repository over into a remote repository.
**
** If the URL is not specified, then the URL from the most recent
** clone, push, pull, remote-url, or sync command is used.
+**
+** If --once option is specified, do not remember URL.
**
** See also: clone, pull, sync, remote-url
*/
void push_cmd(void){
process_sync_args();
@@ -134,11 +143,11 @@
/*
** COMMAND: sync
**
-** Usage: %fossil sync ?URL? ?-R|--repository REPOSITORY?
+** Usage: %fossil sync ?URL? ?-R|--repository REPOSITORY? ?--once?
**
** Synchronize the local repository with a remote repository. This is
** the equivalent of running both "push" and "pull" at the same time.
**
** If a user-id and password are required, specify them as follows:
@@ -145,10 +154,12 @@
**
** http://userid:password@www.domain.com:1234/path
**
** If the URL is not specified, then the URL from the most recent successful
** clone, push, pull, remote-url, or sync command is used.
+**
+** If --once option is specified, do not remember URL.
**
** See also: clone, push, pull, remote-url
*/
void sync_cmd(void){
process_sync_args();
drh added on 2009-11-06 14:16:01: dmitry added on 2009-11-06 15:31:13: | |||