Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the --binary option to the "merge" command and a new "binary-glob" setting. These identify files that should be treated as binary files and which should not be subjected to a 3-way merge. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
d327f12522c7afd718c7b752ed5eb7d3 |
| User & Date: | drh 2010-03-15 18:09:35.000 |
Context
|
2010-03-15
| ||
| 20:54 | Add a new form of ticket timeline that shows only the check-ins associated with the ticket. check-in: dec1364848 user: drh tags: trunk | |
| 18:09 | Add the --binary option to the "merge" command and a new "binary-glob" setting. These identify files that should be treated as binary files and which should not be subjected to a 3-way merge. check-in: d327f12522 user: drh tags: trunk | |
| 17:41 | Add a --ignore option to the "extra" command, and an "ignore-glob" setting which causes files with given patterns to be ignored. Tickets [705181a992c] and [5125de2e624]. See also ticket [4e8410bfd69]. check-in: 3555c0fc6f user: drh tags: trunk | |
Changes
Changes to src/db.c.
| ︙ | ︙ | |||
1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 | ** which uses JavaScript to fill out the captcha for ** the "anonymous" user. (Most bots cannot use JavaScript.) ** ** autosync If enabled, automatically pull prior to commit ** or update and automatically push after commit or ** tag or branch creation. If the the value is "pullonly" ** then only pull operations occur automatically. ** ** clearsign When enabled, fossil will attempt to sign all commits ** with gpg. When disabled (the default), commits will ** be unsigned. ** ** diff-command External command to run when performing a diff. ** If undefined, the internal text diff will be used. | > > > > | 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 | ** which uses JavaScript to fill out the captcha for ** the "anonymous" user. (Most bots cannot use JavaScript.) ** ** autosync If enabled, automatically pull prior to commit ** or update and automatically push after commit or ** tag or branch creation. If the the value is "pullonly" ** then only pull operations occur automatically. ** ** binary-glob The VALUE is a comma-separated list of GLOB patterns ** that should be treated as binary files for merging ** purposes. Example: *.xml ** ** clearsign When enabled, fossil will attempt to sign all commits ** with gpg. When disabled (the default), commits will ** be unsigned. ** ** diff-command External command to run when performing a diff. ** If undefined, the internal text diff will be used. |
| ︙ | ︙ | |||
1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 |
** Defaults to "start" on windows, "open" on Mac,
** and "firefox" on Unix.
*/
void setting_cmd(void){
static const char *azName[] = {
"auto-captcha",
"autosync",
"clearsign",
"diff-command",
"dont-push",
"editor",
"gdiff-command",
"ignore-glob",
"http-port",
| > | 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 |
** Defaults to "start" on windows, "open" on Mac,
** and "firefox" on Unix.
*/
void setting_cmd(void){
static const char *azName[] = {
"auto-captcha",
"autosync",
"binary-glob",
"clearsign",
"diff-command",
"dont-push",
"editor",
"gdiff-command",
"ignore-glob",
"http-port",
|
| ︙ | ︙ |
Changes to src/merge.c.
| ︙ | ︙ | |||
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 71 |
** single check-in VERSION are merged. The --backout option causes
** the changes associated with VERSION to be removed from the current
** checkout rather than added.
**
** Only file content is merged. The result continues to use the
** file and directory names from the current checkout even if those
** names might have been changed in the branch being merged in.
*/
void merge_cmd(void){
int vid; /* Current version */
int mid; /* Version we are merging against */
int pid; /* The pivot version - most recent common ancestor */
int detailFlag; /* True if the --detail option is present */
int pickFlag; /* True if the --cherrypick option is present */
int backoutFlag; /* True if the --backout optioni is present */
Stmt q;
detailFlag = find_option("detail",0,0)!=0;
pickFlag = find_option("cherrypick",0,0)!=0;
backoutFlag = find_option("backout",0,0)!=0;
if( g.argc!=3 ){
usage("VERSION");
}
db_must_be_within_tree();
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_fatal("nothing is checked out");
}
mid = name_to_rid(g.argv[2]);
if( mid==0 ){
fossil_fatal("not a version: %s", g.argv[2]);
| > > > > > > > > > > > | 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 71 72 73 74 75 76 77 78 79 80 81 82 |
** single check-in VERSION are merged. The --backout option causes
** the changes associated with VERSION to be removed from the current
** checkout rather than added.
**
** Only file content is merged. The result continues to use the
** file and directory names from the current checkout even if those
** names might have been changed in the branch being merged in.
**
** Other options:
**
** --detail Show additional details of the merge
**
** --binary GLOBPATTERN Treat files that match GLOBPATTERN as binary
** and do not try to merge parallel changes. This
** option overrides the "binary-glob" setting.
*/
void merge_cmd(void){
int vid; /* Current version */
int mid; /* Version we are merging against */
int pid; /* The pivot version - most recent common ancestor */
int detailFlag; /* True if the --detail option is present */
int pickFlag; /* True if the --cherrypick option is present */
int backoutFlag; /* True if the --backout optioni is present */
const char *zBinGlob; /* The value of --binary */
Stmt q;
detailFlag = find_option("detail",0,0)!=0;
pickFlag = find_option("cherrypick",0,0)!=0;
backoutFlag = find_option("backout",0,0)!=0;
zBinGlob = find_option("binary",0,1);
if( g.argc!=3 ){
usage("VERSION");
}
db_must_be_within_tree();
if( zBinGlob==0 ) zBinGlob = db_get("binary-glob",0);
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_fatal("nothing is checked out");
}
mid = name_to_rid(g.argv[2]);
if( mid==0 ){
fossil_fatal("not a version: %s", g.argv[2]);
|
| ︙ | ︙ | |||
236 237 238 239 240 241 242 | } db_finalize(&q); /* ** Do a three-way merge on files that have changes pid->mid and pid->vid */ db_prepare(&q, | | | > > > > > > | > | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
}
db_finalize(&q);
/*
** Do a three-way merge on files that have changes pid->mid and pid->vid
*/
db_prepare(&q,
"SELECT ridm, idv, ridp, ridv, %s FROM fv"
" WHERE idp>0 AND idv>0 AND idm>0"
" AND ridm!=ridp AND (ridv!=ridp OR chnged)",
glob_expr("fv.fn", zBinGlob)
);
while( db_step(&q)==SQLITE_ROW ){
int ridm = db_column_int(&q, 0);
int idv = db_column_int(&q, 1);
int ridp = db_column_int(&q, 2);
int ridv = db_column_int(&q, 3);
int isBinary = db_column_int(&q, 4);
int rc;
char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idv);
char *zFullPath;
Blob m, p, v, r;
/* Do a 3-way merge of idp->idm into idp->idv. The results go into idv. */
if( detailFlag ){
printf("MERGE %s (pivot=%d v1=%d v2=%d)\n", zName, ridp, ridm, ridv);
}else{
printf("MERGE %s\n", zName);
}
undo_save(zName);
zFullPath = mprintf("%s/%s", g.zLocalRoot, zName);
content_get(ridp, &p);
content_get(ridm, &m);
blob_zero(&v);
blob_read_from_file(&v, zFullPath);
if( isBinary ){
rc = -1;
blob_zero(&r);
}else{
rc = blob_merge(&p, &m, &v, &r);
}
if( rc>=0 ){
blob_write_to_file(&r, zFullPath);
if( rc>0 ){
printf("***** %d merge conflicts in %s\n", rc, zName);
}
}else{
printf("***** Cannot merge binary file %s\n", zName);
|
| ︙ | ︙ |