Fossil

Check-in [49b59bc559]
Login

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

Overview
Comment:Issue a warning after a commit if the commit causes a fork.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 49b59bc5593a0e2118604573a04b5f46496740fa
User & Date: drh 2008-02-09 00:11:04.000
Context
2008-02-12
04:24
Added code to skip of administrative .cvsignore files. Added code to detect and warn about dot files (.FOO). Allow the user to import dot files by converting their names to non-dot form (.FOO -> dot-FOO). check-in: c1dc8701ef user: aku tags: trunk
2008-02-09
09:21
Fix grammar check-in: c1d9e0f4f8 user: bch tags: trunk
00:11
Issue a warning after a commit if the commit causes a fork. check-in: 49b59bc559 user: drh tags: trunk
2008-02-08
22:36
Truncate the name of the toplevel directory added to ZIP archives to be the first 10 characters of the UUID. check-in: 73a9b3d5d1 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/branch.c.
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  /* Clear the undo/redo stack */
  undo_reset();

  /* Commit */
  db_end_transaction(0);
  
  /* Do an autosync push, if requested */
  autosync(0);
}

/*
** COMMAND: branch
**
** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
**







|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
  /* Clear the undo/redo stack */
  undo_reset();

  /* Commit */
  db_end_transaction(0);
  
  /* Do an autosync push, if requested */
  autosync(AUTOSYNC_PUSH);
}

/*
** COMMAND: branch
**
** Usage: %fossil branch SUBCOMMAND ... ?-R|--repository FILE?
**
Changes to src/checkin.c.
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
  db_must_be_within_tree();
  noSign = db_get_int("omitsign", 0)|noSign;
  verify_all_options();

  /*
  ** Autosync if requested.
  */
  autosync(1);
  
  /* There are two ways this command may be executed. If there are
  ** no arguments following the word "commit", then all modified files
  ** in the checked out directory are committed. If one or more arguments
  ** follows "commit", then only those files are committed.
  **
  ** After the following function call has returned, the Global.aCommitFile[]







|







341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
  db_must_be_within_tree();
  noSign = db_get_int("omitsign", 0)|noSign;
  verify_all_options();

  /*
  ** Autosync if requested.
  */
  autosync(AUTOSYNC_PULL);
  
  /* There are two ways this command may be executed. If there are
  ** no arguments following the word "commit", then all modified files
  ** in the checked out directory are committed. If one or more arguments
  ** follows "commit", then only those files are committed.
  **
  ** After the following function call has returned, the Global.aCommitFile[]
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559

560
561
562
563
564
565
566
567
  }

  /* Clear the undo/redo stack */
  undo_reset();

  /* Commit */
  db_end_transaction(0);
  
  if( wouldFork==0 ){
    /* Do an autosync push if requested. If wouldFork == 1, then they either
    ** forced this commit or safe merge is on, and this commit did indeed
    ** create a fork. In this case, we want the user to merge before sending
    ** their new commit back to the rest of the world, so do not auto-push.
    */
    autosync(0);
  }else{
    printf("Warning: commit caused a fork to occur. Please merge and push\n");

    printf("         your changes as soon as possible.\n");
  }
}

/*
** COMMAND: test-import-manifest
**
** Usage: %fossil test-import-manifest DATE COMMENT ?-p PARENT_RECORDID?... ?-f (FILE_RECORDID PATH)?...







|
<
<
<
<
<
<
|
<
<
>
|







543
544
545
546
547
548
549
550






551


552
553
554
555
556
557
558
559
560
  }

  /* Clear the undo/redo stack */
  undo_reset();

  /* Commit */
  db_end_transaction(0);







  autosync(AUTOSYNC_PUSH);  


  if( db_exists("SELECT 1 FROM plink WHERE pid=%d AND cid!=%d", vid, nvid) ){
    printf("**** warning: a fork has occurred *****\n");
  }
}

/*
** COMMAND: test-import-manifest
**
** Usage: %fossil test-import-manifest DATE COMMENT ?-p PARENT_RECORDID?... ?-f (FILE_RECORDID PATH)?...
Changes to src/http.c.
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
      fclose(out);
    }
  }
  for(cnt=0; cnt<2; cnt++){
    if( http_send_recv(&hdr, &payload, pRecv) ) break;
  }
  if( cnt>=2 ){
    fossil_panic("connection to server failed");
  }
  blob_reset(&hdr);
  blob_reset(&payload);
  if( g.fHttpTrace ){
    printf("HTTP RECEIVE:\n%s\n=======================\n", blob_str(pRecv));
  }else{
    blob_uncompress(pRecv, pRecv);







|







369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
      fclose(out);
    }
  }
  for(cnt=0; cnt<2; cnt++){
    if( http_send_recv(&hdr, &payload, pRecv) ) break;
  }
  if( cnt>=2 ){
    fossil_fatal("connection to server failed");
  }
  blob_reset(&hdr);
  blob_reset(&payload);
  if( g.fHttpTrace ){
    printf("HTTP RECEIVE:\n%s\n=======================\n", blob_str(pRecv));
  }else{
    blob_uncompress(pRecv, pRecv);
Changes to src/sync.c.
23
24
25
26
27
28
29









30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
**
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>










/*
** If the respository is configured for autosyncing, then do an
** autosync.  This will be a pull if the argument is true or a push
** if the argument is false.  Return true if the autosync is done
** and false if autosync is not requested for the current repository.
*/
int autosync(int pullFlag){
  const char *zUrl;
  if( db_get_boolean("autosync", 0)==0 ){
    return 0;
  }
  zUrl = db_get("last-sync-url", 0);
  if( zUrl==0 ){
    return 0;  /* No default server */
  }
  url_parse(zUrl);
  if( g.urlIsFile ){
    return 0;  /* Network sync only */
  }
  if( g.urlPort!=80 ){
    printf("Autosync:  http://%s:%d%s\n", g.urlName, g.urlPort, g.urlPath);
  }else{
    printf("Autosync:  http://%s%s\n", g.urlName, g.urlPath);
  }
  client_sync(!pullFlag, pullFlag, 0);
  return 1;
}

/*
** 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







>
>
>
>
>
>
>
>
>






|

















|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
**
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>

#if INTERFACE
/*
** Flags used to determine which direction(s) an autosync goes in.
*/
#define AUTOSYNC_PUSH  1
#define AUTOSYNC_PULL  2

#endif /* INTERFACE */

/*
** If the respository is configured for autosyncing, then do an
** autosync.  This will be a pull if the argument is true or a push
** if the argument is false.  Return true if the autosync is done
** and false if autosync is not requested for the current repository.
*/
int autosync(int flags){
  const char *zUrl;
  if( db_get_boolean("autosync", 0)==0 ){
    return 0;
  }
  zUrl = db_get("last-sync-url", 0);
  if( zUrl==0 ){
    return 0;  /* No default server */
  }
  url_parse(zUrl);
  if( g.urlIsFile ){
    return 0;  /* Network sync only */
  }
  if( g.urlPort!=80 ){
    printf("Autosync:  http://%s:%d%s\n", g.urlName, g.urlPort, g.urlPath);
  }else{
    printf("Autosync:  http://%s%s\n", g.urlName, g.urlPath);
  }
  client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0);
  return 1;
}

/*
** 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
Changes to src/tag.c.
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
  blob_appendf(&ctrl, "Z %b\n", &cksum);
  db_begin_transaction();
  nrid = content_put(&ctrl, 0, 0);
  manifest_crosslink(nrid, &ctrl);
  db_end_transaction(0);
  
  /* Do an autosync push if requested */
  autosync(0);
}

/*
** COMMAND: tag
** Usage: %fossil tag SUBCOMMAND ...
**
** Run various subcommands to control tags and properties







|







291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
  blob_appendf(&ctrl, "Z %b\n", &cksum);
  db_begin_transaction();
  nrid = content_put(&ctrl, 0, 0);
  manifest_crosslink(nrid, &ctrl);
  db_end_transaction(0);
  
  /* Do an autosync push if requested */
  autosync(AUTOSYNC_PUSH);
}

/*
** COMMAND: tag
** Usage: %fossil tag SUBCOMMAND ...
**
** Run various subcommands to control tags and properties
Changes to src/update.c.
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  if( tid==0 ){
    /* 
    ** Do an autosync pull prior to the update, if autosync is on and they
    ** did not want a specific version (i.e. another branch, a past revision).
    ** By not giving a specific version, they are asking for the latest, thus
    ** pull to get the latest, then update.
    */
    autosync(1);
  }
  
  if( tid==0 ){
    compute_leaves(vid);
    if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){
      db_prepare(&q, 
        "%s "







|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
  if( tid==0 ){
    /* 
    ** Do an autosync pull prior to the update, if autosync is on and they
    ** did not want a specific version (i.e. another branch, a past revision).
    ** By not giving a specific version, they are asking for the latest, thus
    ** pull to get the latest, then update.
    */
    autosync(AUTOSYNC_PULL);
  }
  
  if( tid==0 ){
    compute_leaves(vid);
    if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){
      db_prepare(&q, 
        "%s "