Fossil

Check-in [d685096f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:On a merge or update, prompt to continue of autosync fails, just like is done for commit.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d685096f99a977909bcb8931a55d5cba2e02819c
User & Date: drh 2016-05-30 22:30:46
Context
2016-05-31
01:16
Improved handling of exclude_robots(). Add the "isrobot" query parameter for testing. check-in: abcd5df2 user: drh tags: trunk
2016-05-30
22:30
On a merge or update, prompt to continue of autosync fails, just like is done for commit. check-in: d685096f user: drh tags: trunk
22:25
On a merge or update, prompt to continue of autosync fails, just like is done for commit. Closed-Leaf check-in: d5575d14 user: drh tags: autosync-failure-prompt
21:10
Add a new robot detection string. check-in: 1e2d76ec user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/branch.c.

   174    174     }
   175    175   
   176    176   
   177    177     /* Commit */
   178    178     db_end_transaction(0);
   179    179   
   180    180     /* Do an autosync push, if requested */
   181         -  if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries", 1));
          181  +  if( !isPrivate ) autosync_loop(SYNC_PUSH, db_get_int("autosync-tries",1),0);
   182    182   }
   183    183   
   184    184   #if INTERFACE
   185    185   /*
   186    186   ** Allows bits in the mBplqFlags parameter to branch_prepare_list_query().
   187    187   */
   188    188   #define BRL_CLOSED_ONLY      0x001 /* Show only closed branches */

Changes to src/checkin.c.

  1812   1812       g.markPrivate = 1;
  1813   1813     }
  1814   1814   
  1815   1815     /*
  1816   1816     ** Autosync if autosync is enabled and this is not a private check-in.
  1817   1817     */
  1818   1818     if( !g.markPrivate ){
  1819         -    if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1)) ){
  1820         -      prompt_user("continue in spite of sync failure (y/N)? ", &ans);
  1821         -      cReply = blob_str(&ans)[0];
  1822         -      if( cReply!='y' && cReply!='Y' ){
  1823         -        fossil_exit(1);
  1824         -      }
         1819  +    if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1), 1) ){
         1820  +      fossil_exit(1);
  1825   1821       }
  1826   1822     }
  1827   1823   
  1828   1824     /* Require confirmation to continue with the check-in if there is
  1829   1825     ** clock skew
  1830   1826     */
  1831   1827     if( g.clockSkewSeen ){
................................................................................
  2234   2230     if( dryRunFlag ){
  2235   2231       db_end_transaction(1);
  2236   2232       exit(1);
  2237   2233     }
  2238   2234     db_end_transaction(0);
  2239   2235   
  2240   2236     if( !g.markPrivate ){
  2241         -    autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1));
         2237  +    autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1), 0);
  2242   2238     }
  2243   2239     if( count_nonbranch_children(vid)>1 ){
  2244   2240       fossil_print("**** warning: a fork has occurred *****\n");
  2245   2241     }
  2246   2242   }

Changes to src/merge.c.

   263    263     if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
   264    264     vid = db_lget_int("checkout", 0);
   265    265     if( vid==0 ){
   266    266       fossil_fatal("nothing is checked out");
   267    267     }
   268    268     if( !dryRunFlag ){
   269    269       if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
   270         -                      db_get_int("autosync-tries", 1)) ){
   271         -      fossil_fatal("Cannot proceed with merge");
          270  +                      db_get_int("autosync-tries", 1), 1) ){
          271  +      fossil_fatal("merge abandoned due to sync failure");
   272    272       }
   273    273     }
   274    274   
   275    275     /* Find mid, the artifactID of the version to be merged into the current
   276    276     ** check-out */
   277    277     if( g.argc==3 ){
   278    278       /* Mid is specified as an argument on the command-line */

Changes to src/sync.c.

    75     75     url_enable_proxy("via proxy: ");
    76     76     rc = client_sync(flags, configSync, 0);
    77     77     return rc;
    78     78   }
    79     79   
    80     80   /*
    81     81   ** This routine will try a number of times to perform autosync with a
    82         -** 0.5 second sleep between attempts; returning the last autosync status.
           82  +** 0.5 second sleep between attempts.
           83  +**
           84  +** Return zero on success and non-zero on a failure.  If failure occurs
           85  +** and doPrompt flag is true, ask the user if they want to continue, and
           86  +** if they answer "yes" then return zero in spite of the failure.
    83     87   */
    84         -int autosync_loop(int flags, int nTries){
           88  +int autosync_loop(int flags, int nTries, int doPrompt){
    85     89     int n = 0;
    86     90     int rc = 0;
    87     91     while( (n==0 || n<nTries) && (rc=autosync(flags)) ){
    88     92       if( rc ){
    89     93         if( ++n<nTries ){
    90     94           fossil_warning("Autosync failed, making another attempt.");
    91     95           sqlite3_sleep(500);
    92     96         }else{
    93     97           fossil_warning("Autosync failed.");
    94     98         }
    95     99       }
          100  +  }
          101  +  if( rc && doPrompt ){
          102  +    Blob ans;
          103  +    char cReply;
          104  +    prompt_user("continue in spite of sync failure (y/N)? ", &ans);
          105  +    cReply = blob_str(&ans)[0];
          106  +    if( cReply=='y' || cReply=='Y' ) rc = 0;
          107  +    blob_reset(&ans);
    96    108     }
    97    109     return rc;
    98    110   }
    99    111   
   100    112   /*
   101    113   ** This routine processes the command-line argument for push, pull,
   102    114   ** and sync.  If a command-line argument is given, that is the URL

Changes to src/update.c.

   151    151     verify_all_options();
   152    152   
   153    153     db_must_be_within_tree();
   154    154     vid = db_lget_int("checkout", 0);
   155    155     user_select();
   156    156     if( !dryRunFlag && !internalUpdate ){
   157    157       if( autosync_loop(SYNC_PULL + SYNC_VERBOSE*verboseFlag,
   158         -                      db_get_int("autosync-tries", 1)) ){
   159         -      fossil_fatal("Cannot proceed with update");
          158  +                      db_get_int("autosync-tries", 1), 1) ){
          159  +      fossil_fatal("update abandoned due to sync failure");
   160    160       }
   161    161     }
   162    162   
   163    163     /* Create any empty directories now, as well as after the update,
   164    164     ** so changes in settings are reflected now */
   165    165     if( !dryRunFlag ) ensure_empty_dirs_created();
   166    166