Fossil

Check-in [5cc845cfeb]
Login

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

Overview
Comment:Rename the 'clearsign' setting to 'pgp-command'. Remove the 'safemerge' setting - safemerge is on by default and cannot be disabled.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5cc845cfeb32e18a3ce82593b0c8c28387f198c8
User & Date: drh 2008-02-08 21:42:46.000
Context
2008-02-08
21:50
Fix the branch subcommand so that the branch name tags it creates begin with "sym-". check-in: ce08928aaa user: drh tags: trunk
21:42
Rename the 'clearsign' setting to 'pgp-command'. Remove the 'safemerge' setting - safemerge is on by default and cannot be disabled. check-in: 5cc845cfeb user: drh tags: trunk
21:23
Improvements to annotated diffs - now takes into account contributions from other branches. check-in: 840699ecd9 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/checkin.c.
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
      fossil_panic("file %s has not changed", blob_str(&unmodified));
    }
  }

  vid = db_lget_int("checkout", 0);
  if( db_exists("SELECT 1 FROM plink WHERE pid=%d", vid) ){
    wouldFork=1;
    if( forceFlag==0 && db_get_int("safemerge", 0)==0 ){
      fossil_fatal("would fork.  use -f or --force");
    }
  }
  vfile_aggregate_checksum_disk(vid, &cksum1);
  if( zComment ){
    blob_zero(&comment);
    blob_append(&comment, zComment, -1);







|







391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
      fossil_panic("file %s has not changed", blob_str(&unmodified));
    }
  }

  vid = db_lget_int("checkout", 0);
  if( db_exists("SELECT 1 FROM plink WHERE pid=%d", vid) ){
    wouldFork=1;
    if( forceFlag==0 ){
      fossil_fatal("would fork.  use -f or --force");
    }
  }
  vfile_aggregate_checksum_disk(vid, &cksum1);
  if( zComment ){
    blob_zero(&comment);
    blob_append(&comment, zComment, -1);
Changes to src/clearsign.c.
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
** Clearsign the given blob.  Put the signed version in
** pOut.
*/
int clearsign(Blob *pIn, Blob *pOut){
  char *zRand;
  char *zIn;
  char *zOut;
  char *zBase = db_get("clear-sign", "gpg --clearsign -o ");
  char *zCmd;
  int rc;
  zRand = db_text(0, "SELECT hex(randomblob(10))");
  zOut = mprintf("out-%s", zRand);
  zIn = mprintf("in-%z", zRand);
  blob_write_to_file(pIn, zOut);
  zCmd = mprintf("%s %s %s", zBase, zIn, zOut);







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
** Clearsign the given blob.  Put the signed version in
** pOut.
*/
int clearsign(Blob *pIn, Blob *pOut){
  char *zRand;
  char *zIn;
  char *zOut;
  char *zBase = db_get("pgp-command", "gpg --clearsign -o ");
  char *zCmd;
  int rc;
  zRand = db_text(0, "SELECT hex(randomblob(10))");
  zOut = mprintf("out-%s", zRand);
  zIn = mprintf("in-%z", zRand);
  blob_write_to_file(pIn, zOut);
  zCmd = mprintf("%s %s %s", zBase, zIn, zOut);
Changes to src/db.c.
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
      "INSERT INTO config(name,value)"
      " VALUES('server-code', lower(hex(randomblob(20))));"
      "INSERT INTO config(name,value)"
      " VALUES('project-code', lower(hex(randomblob(20))));"
    );
  }
  if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);
  if( !db_is_global("safemerge") ) db_set_int("safemerge", 0, 0);
  if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
  zUser = db_get("default-user", 0);
  if( zUser==0 ){
#ifdef __MINGW32__
    zUser = getenv("USERNAME");
#else
    zUser = getenv("USER");







<







755
756
757
758
759
760
761

762
763
764
765
766
767
768
      "INSERT INTO config(name,value)"
      " VALUES('server-code', lower(hex(randomblob(20))));"
      "INSERT INTO config(name,value)"
      " VALUES('project-code', lower(hex(randomblob(20))));"
    );
  }
  if( !db_is_global("autosync") ) db_set_int("autosync", 1, 0);

  if( !db_is_global("localauth") ) db_set_int("localauth", 0, 0);
  zUser = db_get("default-user", 0);
  if( zUser==0 ){
#ifdef __MINGW32__
    zUser = getenv("USERNAME");
#else
    zUser = getenv("USER");
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
** a property name, show the value of that property.  With a value
** argument, change the property for the current repository.
**
**    autosync         If enabled, automatically pull prior to
**                     commit or update and automatically push
**                     after commit or tag or branch creation.
**
**    clearsign        Command used to clear-sign manifests at check-in.
**                     The default is "gpg --clearsign -o ".
**
**    editor           Text editor command used for check-in comments.
**
**    localauth        If enabled, require that HTTP connections from
**                     127.0.0.1 be authenticated by password.  If
**                     false, all HTTP requests from localhost have
**                     unrestricted access to the repository.
**
**    omitsign         When enabled, fossil will not attempt to sign any
**                     commit with gpg. All commits will be unsigned.
**
**    safemerge        If enabled, when commit will cause a fork, the
**                     commit will not abort with warning. Also update
**                     will not be allowed if local changes exist.
**
**   diff-command      External command to run when performing a diff.
**                     If undefined, the internal text diff will be used.
**
**   gdiff-command     External command to run when performing a graphical
**                     diff. If undefined, text diff will be used.
*/
void setting_cmd(void){
  static const char *azName[] = {
    "autosync",
    "clearsign",
    "editor",
    "localauth",
    "omitsign",
    "safemerge",
    "diff-command",
    "gdiff-command",
  };
  int i;
  int globalFlag = find_option("global","g",0)!=0;
  db_find_and_open_repository();
  if( g.argc==2 ){







|












<
<
<
<
|


|





|



<







1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068




1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081

1082
1083
1084
1085
1086
1087
1088
** a property name, show the value of that property.  With a value
** argument, change the property for the current repository.
**
**    autosync         If enabled, automatically pull prior to
**                     commit or update and automatically push
**                     after commit or tag or branch creation.
**
**    pgp-command      Command used to clear-sign manifests at check-in.
**                     The default is "gpg --clearsign -o ".
**
**    editor           Text editor command used for check-in comments.
**
**    localauth        If enabled, require that HTTP connections from
**                     127.0.0.1 be authenticated by password.  If
**                     false, all HTTP requests from localhost have
**                     unrestricted access to the repository.
**
**    omitsign         When enabled, fossil will not attempt to sign any
**                     commit with gpg. All commits will be unsigned.
**




**    diff-command     External command to run when performing a diff.
**                     If undefined, the internal text diff will be used.
**
**    gdiff-command    External command to run when performing a graphical
**                     diff. If undefined, text diff will be used.
*/
void setting_cmd(void){
  static const char *azName[] = {
    "autosync",
    "pgp-command",
    "editor",
    "localauth",
    "omitsign",

    "diff-command",
    "gdiff-command",
  };
  int i;
  int globalFlag = find_option("global","g",0)!=0;
  db_find_and_open_repository();
  if( g.argc==2 ){
Changes to src/update.c.
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
int is_a_version(int rid){
  return db_exists("SELECT 1 FROM plink WHERE cid=%d", rid);
}

/*
** COMMAND: update
**
** Usage: %fossil update ?VERSION? ?--force? ?--latest?
**
** The optional argument is a version that should become the current
** version.  If the argument is omitted, then use the leaf of the
** tree that begins with the current version, if there is only a 
** single leaf.  If there are a multiple leaves, the latest is used
** if the --latest flag is present.
**
** This command is different from the "checkout" in that edits are
** not overwritten.  Edits are merged into the new version.
**
** If there are uncommitted edits and the safemerge option is
** enabled then no update will occur unless you provide the 
** --force flag.
*/
void update_cmd(void){
  int vid;              /* Current version */
  int tid=0;            /* Target version - version we are changing to */
  Stmt q;
  int latestFlag;       /* Pick the latest version if true */
  int forceFlag;        /* True force the update */







|









<
<
<
<







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50




51
52
53
54
55
56
57
int is_a_version(int rid){
  return db_exists("SELECT 1 FROM plink WHERE cid=%d", rid);
}

/*
** COMMAND: update
**
** Usage: %fossil update ?VERSION? ?--latest?
**
** The optional argument is a version that should become the current
** version.  If the argument is omitted, then use the leaf of the
** tree that begins with the current version, if there is only a 
** single leaf.  If there are a multiple leaves, the latest is used
** if the --latest flag is present.
**
** This command is different from the "checkout" in that edits are
** not overwritten.  Edits are merged into the new version.




*/
void update_cmd(void){
  int vid;              /* Current version */
  int tid=0;            /* Target version - version we are changing to */
  Stmt q;
  int latestFlag;       /* Pick the latest version if true */
  int forceFlag;        /* True force the update */
69
70
71
72
73
74
75



76
77
78

79
80
81
82
83
84
85
  vid = db_lget_int("checkout", 0);
  if( vid==0 ){
    fossil_fatal("cannot find current version");
  }
  if( db_exists("SELECT 1 FROM vmerge") ){
    fossil_fatal("cannot update an uncommitted merge");
  }



  if( !forceFlag && db_get_int("safemerge", 0) && unsaved_changes() ){
    fossil_fatal("there are uncommitted changes and safemerge is enabled");
  }


  if( g.argc==3 ){
    tid = name_to_rid(g.argv[2]);
    if( tid==0 ){
      fossil_fatal("not a version: %s", g.argv[2]);
    }
    if( !is_a_version(tid) ){







>
>
>
|
|

>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  vid = db_lget_int("checkout", 0);
  if( vid==0 ){
    fossil_fatal("cannot find current version");
  }
  if( db_exists("SELECT 1 FROM vmerge") ){
    fossil_fatal("cannot update an uncommitted merge");
  }
#if 0
  /* Always do the update.  If it does not work out, the user can back out
  ** the changes using "undo" */
  if( !forceFlag && unsaved_changes() ){
    fossil_fatal("uncommitted changes; use -f or --force to override");
  }
#endif

  if( g.argc==3 ){
    tid = name_to_rid(g.argv[2]);
    if( tid==0 ){
      fossil_fatal("not a version: %s", g.argv[2]);
    }
    if( !is_a_version(tid) ){