Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Change spelling for check-in and similar |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | check-in-spelling |
| Files: | files | file ages | folders |
| SHA3-256: |
d9c4321e7ac26b5beca2bbc9fda1e917 |
| User & Date: | danield 2022-12-20 09:46:51.580 |
Context
|
2022-12-21
| ||
| 11:52 | Merge in help consistency improvements. Closed-Leaf check-in: 526b0a54c4 user: danield tags: check-in-spelling | |
| 09:00 | Improved consistency for --help option descriptions: begin with uppercase letter; do not use a period at the end of short-ish sentences. Closed-Leaf check-in: de684083c6 user: km tags: spelling-fixes | |
|
2022-12-20
| ||
| 09:46 | Change spelling for check-in and similar check-in: d9c4321e7a user: danield tags: check-in-spelling | |
| 05:00 | Unbreak MinGW build to account for deletions in zlib 1.2.13. check-in: a24a790f3d user: mistachkin tags: trunk | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 | #include "config.h" #include "add.h" #include <assert.h> #include <dirent.h> #include "cygsup.h" /* | | | | | 21 22 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 |
#include "config.h"
#include "add.h"
#include <assert.h>
#include <dirent.h>
#include "cygsup.h"
/*
** This routine returns the names of files in a working check-out that
** are created by Fossil itself, and hence should not be added, deleted,
** or merge, and should be omitted from "clean" and "extras" lists.
**
** Return the N-th name. The first name has N==0. When all names have
** been used, return 0.
*/
const char *fossil_reserved_name(int N, int omitRepo){
/* Possible names of the local per-check-out database file and
** its associated journals
*/
static const char *const azName[] = {
"_FOSSIL_",
"_FOSSIL_-journal",
"_FOSSIL_-wal",
"_FOSSIL_-shm",
".fslckout",
".fslckout-journal",
".fslckout-wal",
".fslckout-shm",
/* The use of ".fos" as the name of the check-out database is
** deprecated. Use ".fslckout" instead. At some point, the following
** entries should be removed. 2012-02-04 */
".fos",
".fos-journal",
".fos-wal",
".fos-shm",
};
|
| ︙ | ︙ | |||
65 66 67 68 69 70 71 |
{ "manifest", MFESTFLG_RAW },
{ "manifest.uuid", MFESTFLG_UUID },
{ "manifest.tags", MFESTFLG_TAGS }
};
static const char *azManifests[3];
/*
| | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
{ "manifest", MFESTFLG_RAW },
{ "manifest.uuid", MFESTFLG_UUID },
{ "manifest.tags", MFESTFLG_TAGS }
};
static const char *azManifests[3];
/*
** Names of repository files, if they exist in the check-out.
*/
static const char *azRepo[4] = { 0, 0, 0, 0 };
/* Cached setting "manifest" */
static int cachedManifest = -1;
static int numManifests;
|
| ︙ | ︙ | |||
243 244 245 246 247 248 249 | } db_finalize(&loop); blob_reset(&repoName); return nAdd; } /* | | | | | 243 244 245 246 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 |
}
db_finalize(&loop);
blob_reset(&repoName);
return nAdd;
}
/*
** Resets the ADDED/DELETED state of a check-out, such that all
** newly-added (but not yet committed) files are no longer added and
** newly-removed (but not yet committed) files are no longer
** removed. If bIsAdd is true, it operates on the "add" state, else it
** operates on the "rm" state.
**
** If bDryRun is true it outputs what it would have done, but does not
** actually do it. In this case it rolls back the transaction it
** starts (so don't start a transaction before calling this).
**
** If bVerbose is true it outputs the name of each reset entry.
**
** This is intended to be called only in the context of the
** add/rm/addremove commands, after a call to verify_all_options().
**
** Un-added files are not modified but any un-rm'd files which are
** missing from the check-out are restored from the repo. un-rm'd files
** which exist in the check-out are left as-is, rather than restoring
** them using vfile_to_disk(), to avoid overwriting any local changes
** made to those files.
*/
static void addremove_reset(int bIsAdd, int bDryRun, int bVerbose){
int nReset = 0; /* # of entries which get reset */
Stmt stmt; /* vfile loop query */
|
| ︙ | ︙ | |||
339 340 341 342 343 344 345 | /* ** COMMAND: add ** ** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...? ** ** Make arrangements to add one or more files or directories to the | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | /* ** COMMAND: add ** ** Usage: %fossil add ?OPTIONS? FILE1 ?FILE2 ...? ** ** Make arrangements to add one or more files or directories to the ** current check-out at the next [[commit]]. ** ** When adding files or directories recursively, filenames that begin ** with "." are excluded by default. To include such files, add ** the "--dotfiles" option to the command-line. ** ** The --ignore and --clean options are comma-separated lists of glob patterns ** for files to be excluded. Example: '*.o,*.obj,*.exe' If the --ignore |
| ︙ | ︙ | |||
368 369 370 371 372 373 374 |
** --case-sensitive BOOL Override the case-sensitive setting
** --dotfiles Include files beginning with a dot (".")
** -f|--force Add files without prompting
** --ignore CSG Ignore unmanaged files matching patterns from
** the Comma Separated Glob (CSG) pattern list
** --clean CSG Also ignore files matching patterns from
** the Comma Separated Glob (CSG) list
| | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
** --case-sensitive BOOL Override the case-sensitive setting
** --dotfiles Include files beginning with a dot (".")
** -f|--force Add files without prompting
** --ignore CSG Ignore unmanaged files matching patterns from
** the Comma Separated Glob (CSG) pattern list
** --clean CSG Also ignore files matching patterns from
** the Comma Separated Glob (CSG) list
** --reset Reset the ADDED state of a check-out, such
** that all newly-added (but not yet committed)
** files are no longer added. No flags other
** than --verbose and --dry-run may be used
** with --reset.
** --allow-reserved Permit filenames which are reserved on
** Windows platforms. Such files cannot be
** checked out on Windows, so use with care.
**
** The following options are only valid with --reset:
** -v|--verbose Output information about each --reset file
** -n|--dry-run Display instead of run actions
**
** See also: [[addremove]], [[rm]]
*/
void add_cmd(void){
int i; /* Loop counter */
int vid; /* Currently checked-out version */
int nRoot; /* Full path characters in g.zLocalRoot */
const char *zCleanFlag; /* The --clean option or clean-glob setting */
const char *zIgnoreFlag; /* The --ignore option or ignore-glob setting */
Glob *pIgnore, *pClean; /* Ignore everything matching the glob patterns */
unsigned scanFlags = 0; /* Flags passed to vfile_scan() */
int forceFlag;
int allowReservedFlag = 0; /* --allow-reserved flag */
|
| ︙ | ︙ | |||
435 436 437 438 439 440 441 |
/* Load the names of all files that are to be added into sfile temp table */
for(i=2; i<g.argc; i++){
char *zName;
int isDir;
Blob fullName = empty_blob;
/* file_tree_name() throws a fatal error if g.argv[i] is outside of the
| | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
/* Load the names of all files that are to be added into sfile temp table */
for(i=2; i<g.argc; i++){
char *zName;
int isDir;
Blob fullName = empty_blob;
/* file_tree_name() throws a fatal error if g.argv[i] is outside of the
** check-out. */
file_tree_name(g.argv[i], &fullName, 0, 1);
blob_reset(&fullName);
file_canonical_name(g.argv[i], &fullName, 0);
zName = blob_str(&fullName);
isDir = file_isdir(zName, RepoFILE);
if( isDir==1 ){
vfile_scan(&fullName, nRoot-1, scanFlags, pClean, pIgnore, RepoFILE);
|
| ︙ | ︙ | |||
528 529 530 531 532 533 534 |
}
file_tree_name(zOldName, &fullOldName, 1, 1);
db_multi_exec("INSERT INTO fremove VALUES('%q');", blob_str(&fullOldName));
blob_reset(&fullOldName);
}
/*
| | | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
}
file_tree_name(zOldName, &fullOldName, 1, 1);
db_multi_exec("INSERT INTO fremove VALUES('%q');", blob_str(&fullOldName));
blob_reset(&fullOldName);
}
/*
** This function deletes files from the check-out, using the file names
** contained in the temporary table "fremove". The temporary table is
** created on demand by the add_file_to_remove() function.
**
** If dryRunFlag is non-zero, no files will be removed; however, their
** names will still be output.
**
** The temporary table "fremove" is dropped after being processed.
|
| ︙ | ︙ | |||
579 580 581 582 583 584 585 | ** to do so. ** ** WARNING: If the "--hard" option is specified -OR- the "mv-rm-files" ** setting is non-zero, files WILL BE removed from disk as well. ** This does NOT apply to the 'forget' command. ** ** Options: | | | | | 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | ** to do so. ** ** WARNING: If the "--hard" option is specified -OR- the "mv-rm-files" ** setting is non-zero, files WILL BE removed from disk as well. ** This does NOT apply to the 'forget' command. ** ** Options: ** --soft Skip removing files from the check-out. ** This supersedes the --hard option. ** --hard Remove files from the check-out. ** --case-sensitive BOOL Override the case-sensitive setting. ** -n|--dry-run If given, display instead of run actions. ** --reset Reset the DELETED state of a check-out, such ** that all newly-rm'd (but not yet committed) ** files are no longer removed. No flags other ** than --verbose or --dry-run may be used with ** --reset. ** -v|--verbose Outputs information about each --reset file. ** Only usable with --reset. ** |
| ︙ | ︙ | |||
741 742 743 744 745 746 747 | /* ** COMMAND: addremove ** ** Usage: %fossil addremove ?OPTIONS? ** ** Do all necessary "[[add]]" and "[[rm]]" commands to synchronize the | | | | | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | /* ** COMMAND: addremove ** ** Usage: %fossil addremove ?OPTIONS? ** ** Do all necessary "[[add]]" and "[[rm]]" commands to synchronize the ** repository with the content of the working check-out: ** ** * All files in the check-out but not in the repository (that is, ** all files displayed using the "extras" command) are added as ** if by the "[[add]]" command. ** ** * All files in the repository but missing from the check-out (that is, ** all files that show as MISSING with the "status" command) are ** removed as if by the "[[rm]]" command. ** ** The command does not "[[commit]]". You must run the "[[commit]]" separately ** as a separate step. ** ** Files and directories whose names begin with "." are ignored unless |
| ︙ | ︙ | |||
775 776 777 778 779 780 781 |
** --case-sensitive BOOL Override the case-sensitive setting.
** --dotfiles Include files beginning with a dot (".")
** --ignore CSG Ignore unmanaged files matching patterns from
** the Comma Separated Glob (CSG) list
** --clean CSG Also ignore files matching patterns from
** the Comma Separated Glob (CSG) list
** -n|--dry-run If given, display instead of run actions.
| | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
** --case-sensitive BOOL Override the case-sensitive setting.
** --dotfiles Include files beginning with a dot (".")
** --ignore CSG Ignore unmanaged files matching patterns from
** the Comma Separated Glob (CSG) list
** --clean CSG Also ignore files matching patterns from
** the Comma Separated Glob (CSG) list
** -n|--dry-run If given, display instead of run actions.
** --reset Reset the ADDED/DELETED state of a check-out,
** such that all newly-added (but not yet committed)
** files are no longer added and all newly-removed
** (but not yet committed) files are no longer
** removed. No flags other than --verbose and
** --dry-run may be used with --reset.
** -v|--verbose Outputs information about each --reset file.
** Only usable with --reset.
|
| ︙ | ︙ | |||
824 825 826 827 828 829 830 |
verify_all_options();
/* Fail if unprocessed arguments are present, in case user expect the
** addremove command to accept a list of file or directory.
*/
if( g.argc>2 ){
fossil_fatal(
| | | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 |
verify_all_options();
/* Fail if unprocessed arguments are present, in case user expect the
** addremove command to accept a list of file or directory.
*/
if( g.argc>2 ){
fossil_fatal(
"%s: Can only work on the entire check-out, no arguments supported.",
g.argv[1]);
}
db_must_be_within_tree();
if( zCleanFlag==0 ){
zCleanFlag = db_get("clean-glob", 0);
}
if( zIgnoreFlag==0 ){
|
| ︙ | ︙ | |||
953 954 955 956 957 958 959 |
db_multi_exec("INSERT INTO fmove VALUES('%q','%q');", zOld, zNew);
}
blob_reset(&fullNewName);
blob_reset(&fullOldName);
}
/*
| | | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 |
db_multi_exec("INSERT INTO fmove VALUES('%q','%q');", zOld, zNew);
}
blob_reset(&fullNewName);
blob_reset(&fullOldName);
}
/*
** This function moves files within the check-out, using the file names
** contained in the temporary table "fmove". The temporary table is
** created on demand by the add_file_to_move() function.
**
** If dryRunFlag is non-zero, no files will be moved; however, their
** names will still be output.
**
** The temporary table "fmove" is dropped after being processed.
|
| ︙ | ︙ | |||
1019 1020 1021 1022 1023 1024 1025 | ** require it to do so. ** ** WARNING: If the "--hard" option is specified -OR- the "mv-rm-files" ** setting is non-zero, files WILL BE renamed or moved on disk ** as well. This does NOT apply to the 'rename' command. ** ** Options: | | | | 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 |
** require it to do so.
**
** WARNING: If the "--hard" option is specified -OR- the "mv-rm-files"
** setting is non-zero, files WILL BE renamed or moved on disk
** as well. This does NOT apply to the 'rename' command.
**
** Options:
** --soft Skip moving files within the check-out.
** This supersedes the --hard option.
** --hard Move files within the check-out
** --case-sensitive BOOL Override the case-sensitive setting
** -n|--dry-run If given, display instead of run actions
**
** See also: [[changes]], [[status]]
*/
void mv_cmd(void){
int i;
|
| ︙ | ︙ | |||
1050 1051 1052 1053 1054 1055 1056 |
hardFlag = find_option("hard",0,0)!=0;
/* We should be done with options.. */
verify_all_options();
vid = db_lget_int("checkout", 0);
if( vid==0 ){
| | | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 |
hardFlag = find_option("hard",0,0)!=0;
/* We should be done with options.. */
verify_all_options();
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_fatal("no check-out in which to rename files");
}
if( g.argc<4 ){
usage("OLDNAME NEWNAME");
}
zDest = g.argv[g.argc-1];
db_begin_transaction();
if( g.argv[1][0]=='r' ){ /* i.e. "rename" */
|
| ︙ | ︙ |
Changes to src/ajax.c.
| ︙ | ︙ | |||
233 234 235 236 237 238 239 |
"connections).");
return 0;
}
return 1;
}
/*
| | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
"connections).");
return 0;
}
return 1;
}
/*
** Helper for collecting filename/check-in request parameters.
**
** If zFn is not NULL, it is assigned the value of the first one of
** the "filename" or "fn" CGI parameters which is set.
**
** If zCi is not NULL, it is assigned the value of the first one of
** the "checkin" or "ci" CGI parameters which is set.
**
|
| ︙ | ︙ | |||
321 322 323 324 325 326 327 |
blob_init(&content, zContent, -1);
ajax_render_preview(&content, zFilename,
ln ? AJAX_PREVIEW_LINE_NUMBERS : 0,
&renderMode, iframeHeight);
/*
** Now tell the caller if we did indeed use AJAX_RENDER_WIKI, so that
** they can re-set the <base href> to an appropriate value (which
| | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
blob_init(&content, zContent, -1);
ajax_render_preview(&content, zFilename,
ln ? AJAX_PREVIEW_LINE_NUMBERS : 0,
&renderMode, iframeHeight);
/*
** Now tell the caller if we did indeed use AJAX_RENDER_WIKI, so that
** they can re-set the <base href> to an appropriate value (which
** requires knowing the content's current check-in version, which we
** don't have here).
*/
switch(renderMode){
/* The strings used here MUST correspond to those used in the JS-side
** fossil.page.previewModes map.
*/
case AJAX_RENDER_WIKI: zRenderMode = "wiki"; break;
|
| ︙ | ︙ |
Changes to src/allrepo.c.
| ︙ | ︙ | |||
67 68 69 70 71 72 73 | ** backup Backup all repositories. The argument must be the name of ** a directory into which all backup repositories are written. ** ** cache Manages the cache used for potentially expensive web ** pages. Any additional arguments are passed on verbatim ** to the cache command. ** | | | | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | ** backup Backup all repositories. The argument must be the name of ** a directory into which all backup repositories are written. ** ** cache Manages the cache used for potentially expensive web ** pages. Any additional arguments are passed on verbatim ** to the cache command. ** ** changes Shows all local check-outs that have uncommitted changes. ** This operation has no additional options. ** ** clean Delete all "extra" files in all local check-outs. Extreme ** caution should be exercised with this command because its ** effects cannot be undone. Use of the --dry-run option to ** carefully review the local check-outs to be operated upon ** and the --whatif option to carefully review the files to ** be deleted beforehand is highly recommended. The command ** line options supported by the clean command itself, if any ** are present, are passed along verbatim. ** ** config Only the "config pull AREA" command works. ** ** dbstat Run the "dbstat" command on all repositories. ** ** extras Shows "extra" files from all local check-outs. The command ** line options supported by the extra command itself, if any ** are present, are passed along verbatim. ** ** fts-config Run the "fts-config" command on all repositories. ** ** git CMD Do the "git export" or "git status" command (whichever ** is specified by CMD) on all repositories for which |
| ︙ | ︙ | |||
135 136 137 138 139 140 141 | ** tracked by Fossil. Normally Fossil is able to keep up with ** this list by itself, but sometimes it can benefit from this ** hint if you rename repositories. ** ** ignore Arguments are repositories that should be ignored by ** subsequent clean, extras, list, pull, push, rebuild, and ** sync operations. The -c|--ckout option causes the listed | | | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
** tracked by Fossil. Normally Fossil is able to keep up with
** this list by itself, but sometimes it can benefit from this
** hint if you rename repositories.
**
** ignore Arguments are repositories that should be ignored by
** subsequent clean, extras, list, pull, push, rebuild, and
** sync operations. The -c|--ckout option causes the listed
** local check-outs to be ignored instead.
**
** list | ls Display the location of all repositories. The -c|--ckout
** option causes all local check-outs to be listed instead.
**
** Repositories are automatically added to the set of known repositories
** when one of the following commands are run against the repository:
** clone, info, pull, push, or sync. Even previously ignored repositories
** are added back to the list of repositories by these commands.
**
** Options:
** --dry-run If given, display instead of run actions.
** --showfile Show the repository or check-out being operated upon.
** --stop-on-error Halt immediately if any subprocess fails.
*/
void all_cmd(void){
Stmt q;
const char *zCmd;
char *zSyscmd;
Blob extra;
|
| ︙ | ︙ | |||
423 424 425 426 427 428 429 |
nToDel++;
continue;
}
if( zCmd[0]=='l' ){
fossil_print("%s\n", zFilename);
continue;
}else if( showFile ){
| | | 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
nToDel++;
continue;
}
if( zCmd[0]=='l' ){
fossil_print("%s\n", zFilename);
continue;
}else if( showFile ){
fossil_print("%s: %s\n", useCheckouts ? "check-out" : "repository",
zFilename);
}
zSyscmd = mprintf("%$ %s %$%s",
g.nameOfExe, zCmd, zFilename, blob_str(&extra));
if( showLabel ){
int len = (int)strlen(zFilename);
int nStar = 80 - (len + 15);
|
| ︙ | ︙ |
Changes to src/backoffice.c.
| ︙ | ︙ | |||
664 665 666 667 668 669 670 | /* ** COMMAND: backoffice* ** ** Usage: %fossil backoffice [OPTIONS...] [REPOSITORIES...] ** ** Run backoffice processing on the repositories listed. If no | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | /* ** COMMAND: backoffice* ** ** Usage: %fossil backoffice [OPTIONS...] [REPOSITORIES...] ** ** Run backoffice processing on the repositories listed. If no ** repository is specified, run it on the repository of the local check-out. ** ** This might be done by a cron job or similar to make sure backoffice ** processing happens periodically. Or, the --poll option can be used ** to run this command as a daemon that will periodically invoke backoffice ** on a collection of repositories. ** ** If only a single repository is named and --poll is omitted, then the |
| ︙ | ︙ |
Changes to src/bisect.c.
| ︙ | ︙ | |||
200 201 202 203 204 205 206 | ); } /* ** Create a TEMP table named "bilog" that contains the complete history ** of the current bisect. ** | | | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | ); } /* ** Create a TEMP table named "bilog" that contains the complete history ** of the current bisect. ** ** If iCurrent>0 then it is the RID of the current check-out and is included ** in the history table. ** ** If zDesc is not NULL, then it is the bid= query parameter to /timeline ** that describes a bisect. Use the information in zDesc rather than in ** the bisect-log variable. ** ** If bDetail is true, then also include information about every node |
| ︙ | ︙ | |||
467 468 469 470 471 472 473 | /* ** COMMAND: bisect ** ** Usage: %fossil bisect SUBCOMMAND ... ** ** Run various subcommands useful for searching back through the change | | | | | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | /* ** COMMAND: bisect ** ** Usage: %fossil bisect SUBCOMMAND ... ** ** Run various subcommands useful for searching back through the change ** history for a particular check-in that causes or fixes a problem. ** ** > fossil bisect bad ?VERSION? ** ** Identify version VERSION as non-working. If VERSION is omitted, ** the current check-out is marked as non-working. ** ** > fossil bisect good ?VERSION? ** ** Identify version VERSION as working. If VERSION is omitted, ** the current check-out is marked as working. ** ** > fossil bisect log ** > fossil bisect chart ** ** Show a log of "good", "bad", and "skip" versions. "bisect log" ** shows the events in the order that they were tested. ** "bisect chart" shows them in order of check-in. |
| ︙ | ︙ | |||
513 514 515 516 517 518 519 | ** ** -i|--interactive Prompt the user for the good/bad/skip decision ** after each step, rather than using the exit ** code from COMMAND ** ** > fossil bisect skip ?VERSION? ** | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | ** ** -i|--interactive Prompt the user for the good/bad/skip decision ** after each step, rather than using the exit ** code from COMMAND ** ** > fossil bisect skip ?VERSION? ** ** Cause VERSION (or the current check-out if VERSION is omitted) to ** be ignored for the purpose of the current bisect. This might ** be done, for example, because VERSION does not compile correctly ** or is otherwise unsuitable to participate in this bisect. ** ** > fossil bisect vlist|ls|status ?-a|--all? ** ** List the versions in between the inner-most "bad" and "good". |
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
222 223 224 225 226 227 228 | if( !isPrivate ) autosync_loop(SYNC_PUSH, 0, "branch"); } /* ** Create a TEMP table named "tmp_brlist" with 7 columns: ** ** name Name of the branch | | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | if( !isPrivate ) autosync_loop(SYNC_PUSH, 0, "branch"); } /* ** Create a TEMP table named "tmp_brlist" with 7 columns: ** ** name Name of the branch ** mtime Time of last check-in on this branch ** isclosed True if the branch is closed ** mergeto Another branch this branch was merged into ** nckin Number of checkins on this branch ** ckin Hash of the last check-in on this branch ** isprivate True if the branch is private ** bgclr Background color for this branch */ static const char createBrlistQuery[] = @ CREATE TEMP TABLE IF NOT EXISTS tmp_brlist AS @ SELECT @ tagxref.value AS name, |
| ︙ | ︙ | |||
472 473 474 475 476 477 478 | blob_reset(&manifest); db_end_transaction(doRollback); return 0; } /* ** Internal helper for branch_cmd_close() and friends. zName is a | | | | | | | | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
blob_reset(&manifest);
db_end_transaction(doRollback);
return 0;
}
/*
** Internal helper for branch_cmd_close() and friends. zName is a
** symbolic check-in name. Returns the blob.rid of the check-in or fails
** fatally if the name does not resolve unambiguously. If zUuid is
** not NULL, *zUuid is set to the resolved blob.uuid and must be freed
** by the caller via fossil_free().
*/
static int branch_resolve_name(char const *zName, char **zUuid){
const int rid = name_to_uuid2(zName, "ci", zUuid);
if(0==rid){
fossil_fatal("Cannot resolve name: %s", zName);
}else if(rid<0){
fossil_fatal("Ambiguous name: %s", zName);
}
return rid;
}
/*
** Implementation of (branch hide/unhide) subcommands. nStartAtArg is
** the g.argv index to start reading branch/check-in names. fHide is
** true for hiding, false for unhiding. Fails fatally on error.
*/
static void branch_cmd_hide(int nStartAtArg, int fHide){
int argPos = nStartAtArg; /* g.argv pos with first branch/ci name */
char * zUuid = 0; /* Resolved branch UUID. */
const int fVerbose = find_option("verbose","v",0)!=0;
const int fDryRun = find_option("dry-run","n",0)!=0;
const char *zDateOvrd = find_option("date-override",0,1);
const char *zUserOvrd = find_option("user-override",0,1);
verify_all_options();
db_begin_transaction();
for( ; argPos < g.argc; fossil_free(zUuid), ++argPos ){
const char * zName = g.argv[argPos];
const int rid = branch_resolve_name(zName, &zUuid);
const int isHidden = rid_has_tag(rid, TAG_HIDDEN);
/* Potential TODO: check for existing 'hidden' flag and skip this
** entry if it already has (if fHide) or does not have (if !fHide)
** that tag. FWIW, /ci_edit does not do so. */
if(fHide && isHidden){
fossil_warning("Skipping hidden check-in %s: %s.", zName, zUuid);
continue;
}else if(!fHide && !isHidden){
fossil_warning("Skipping non-hidden check-in %s: %s.", zName, zUuid);
continue;
}
branch_cmd_tag_add(rid, fHide ? "*hidden" : "-hidden");
if(fVerbose!=0){
fossil_print("%s check-in [%s] %s\n",
fHide ? "Hiding" : "Unhiding",
zName, zUuid);
}
}
branch_cmd_tag_finalize(fDryRun, fVerbose, zDateOvrd, zUserOvrd);
}
/*
** Implementation of (branch close|reopen) subcommands. nStartAtArg is
** the g.argv index to start reading branch/check-in names. The given
** checkins are closed if fClose is true, else their "closed" tag (if
** any) is cancelled. Fails fatally on error.
*/
static void branch_cmd_close(int nStartAtArg, int fClose){
int argPos = nStartAtArg; /* g.argv pos with first branch name */
char * zUuid = 0; /* Resolved branch UUID. */
const int fVerbose = find_option("verbose","v",0)!=0;
|
| ︙ | ︙ | |||
583 584 585 586 587 588 589 | ** Run various subcommands to manage branches of the open repository or ** of the repository identified by the -R or --repository option. ** ** > fossil branch close|reopen ?OPTIONS? BRANCH-NAME ?...BRANCH-NAMES? ** ** Adds or cancels the "closed" tag to one or more branches. ** It accepts arbitrary unambiguous symbolic names but | | | | | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | ** Run various subcommands to manage branches of the open repository or ** of the repository identified by the -R or --repository option. ** ** > fossil branch close|reopen ?OPTIONS? BRANCH-NAME ?...BRANCH-NAMES? ** ** Adds or cancels the "closed" tag to one or more branches. ** It accepts arbitrary unambiguous symbolic names but ** will only resolve check-in names and skips any which resolve ** to non-leaf check-ins. Options: ** -n|--dry-run do not commit changes and dump artifact ** to stdout ** -v|--verbose output more information ** --date-override DATE DATE to use instead of 'now' ** --user-override USER USER to use instead of the current default ** ** > fossil branch current ** ** Print the name of the branch for the current check-out ** ** > fossil branch hide|unhide ?OPTIONS? BRANCH-NAME ?...BRANCH-NAMES? ** ** Adds or cancels the "hidden" tag for the specified branches or ** or check-in IDs. Accepts the same options as the close ** subcommand. ** ** > fossil branch info BRANCH-NAME ** ** Print information about a branch ** ** > fossil branch list|ls ?OPTIONS? ?GLOB? |
| ︙ | ︙ | |||
655 656 657 658 659 660 661 |
int n;
const char *zCmd = "list";
db_find_and_open_repository(0, 0);
if( g.argc>=3 ) zCmd = g.argv[2];
n = strlen(zCmd);
if( strncmp(zCmd,"current",n)==0 ){
if( !g.localOpen ){
| | | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 |
int n;
const char *zCmd = "list";
db_find_and_open_repository(0, 0);
if( g.argc>=3 ) zCmd = g.argv[2];
n = strlen(zCmd);
if( strncmp(zCmd,"current",n)==0 ){
if( !g.localOpen ){
fossil_fatal("not within an open check-out");
}else{
int vid = db_lget_int("checkout", 0);
char *zCurrent = db_text(0, "SELECT value FROM tagxref"
" WHERE rid=%d AND tagid=%d", vid, TAG_BRANCH);
fossil_print("%s\n", zCurrent);
fossil_free(zCurrent);
}
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
59 60 61 62 63 64 65 | }; /* ** Create a TEMP table named SFILE and add all unmanaged files named on ** the command-line to that table. If directories are named, then add ** all unmanaged files contained underneath those directories. If there ** are no files or directories named on the command-line, then add all | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | }; /* ** Create a TEMP table named SFILE and add all unmanaged files named on ** the command-line to that table. If directories are named, then add ** all unmanaged files contained underneath those directories. If there ** are no files or directories named on the command-line, then add all ** unmanaged files anywhere in the check-out. ** ** This routine never follows symlinks. It always treats symlinks as ** object unto themselves. */ static void locate_unmanaged_files( int argc, /* Number of command-line arguments to examine */ char **argv, /* values of command-line arguments */ |
| ︙ | ︙ | |||
196 197 198 199 200 201 202 |
db_multi_exec("CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)");
/* Append an ORDER BY clause then compile the query. */
blob_append_sql(&sql, " ORDER BY pathname");
db_prepare(&q, "%s", blob_sql_text(&sql));
blob_reset(&sql);
| | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
db_multi_exec("CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)");
/* Append an ORDER BY clause then compile the query. */
blob_append_sql(&sql, " ORDER BY pathname");
db_prepare(&q, "%s", blob_sql_text(&sql));
blob_reset(&sql);
/* Bind the check-out version ID to the query if needed. */
if( (flags & C_ALL) && (flags & C_MTIME) ){
db_bind_int(&q, ":vid", db_lget_int("checkout", 0));
}
/* Execute the query and assemble the report. */
blob_zero(&rewrittenPathname);
while( db_step(&q)==SQLITE_ROW ){
|
| ︙ | ︙ | |||
365 366 367 368 369 370 371 | /* ** COMMAND: changes ** COMMAND: status ** ** Usage: %fossil changes|status ?OPTIONS? ?PATHS ...? ** | | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | /* ** COMMAND: changes ** COMMAND: status ** ** Usage: %fossil changes|status ?OPTIONS? ?PATHS ...? ** ** Report the change status of files in the current check-out. If one or ** more PATHS are specified, only changes among the named files and ** directories are reported. Directories are searched recursively. ** ** The status command is similar to the changes command, except it lacks ** several of the options supported by changes and it has its own header ** and footer information. The header information is a subset of that ** shown by the info command, and the footer shows if there are any forks. ** Change type classification is always enabled for the status command. ** ** Each line of output is the name of a changed file, with paths shown ** according to the "relative-paths" setting, unless overridden by the ** --abs-paths or --rel-paths options. ** ** By default, all changed files are selected for display. This behavior ** can be overridden by using one or more filter options (listed below), ** in which case only files with the specified change type(s) are shown. ** As a special case, the --no-merge option does not inhibit this default. ** This default shows exactly the set of changes that would be checked- ** in by the commit command. ** ** If no filter options are used, or if the --merge option is used, the ** artifact hash of each merge contributor check-in version is displayed at ** the end of the report. The --no-merge option is useful to display the ** default set of changed files without the merge contributors. ** |
| ︙ | ︙ | |||
407 408 409 410 411 412 413 | ** change type classification is UPDATED_BY_MERGE or UPDATED_BY_INTEGRATE. ** If the file had to be merged with any other changes, it is considered ** to be merged or conflicted and therefore will be shown by --edited, not ** --updated, with types EDITED or CONFLICT. The --changed option can be ** used to display the union of --edited and --updated. ** ** --differ is so named because it lists all the differences between the | | | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | ** change type classification is UPDATED_BY_MERGE or UPDATED_BY_INTEGRATE. ** If the file had to be merged with any other changes, it is considered ** to be merged or conflicted and therefore will be shown by --edited, not ** --updated, with types EDITED or CONFLICT. The --changed option can be ** used to display the union of --edited and --updated. ** ** --differ is so named because it lists all the differences between the ** checked-out version and the check-out directory. In addition to the ** default changes (excluding --merge), it lists extra files which (if ** ignore-glob is set correctly) may be worth adding. Prior to doing a ** commit, it is good practice to check --differ to see not only which ** changes would be committed but also if any files should be added. ** ** If both --merge and --no-merge are used, --no-merge has priority. The ** same is true of --classify and --no-classify. |
| ︙ | ︙ | |||
515 516 517 518 519 520 521 |
for( i=0; i<count(noFlagDefs); ++i ){
if( (command==CHANGES || !(noFlagDefs[i].mask & C_CLASSIFY))
&& find_option(noFlagDefs[i].option, 0, 0) ){
flags &= ~noFlagDefs[i].mask;
}
}
| | | | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
for( i=0; i<count(noFlagDefs); ++i ){
if( (command==CHANGES || !(noFlagDefs[i].mask & C_CLASSIFY))
&& find_option(noFlagDefs[i].option, 0, 0) ){
flags &= ~noFlagDefs[i].mask;
}
}
/* Confirm current working directory is within check-out. */
db_must_be_within_tree();
/* Get check-out version. l*/
vid = db_lget_int("checkout", 0);
/* Relative path flag determination is done by a shared function. */
if( determine_cwd_relative_option() ){
flags |= C_RELPATH;
}
|
| ︙ | ︙ | |||
660 661 662 663 664 665 666 | } /* ** COMMAND: ls ** ** Usage: %fossil ls ?OPTIONS? ?PATHS ...? ** | | | 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | } /* ** COMMAND: ls ** ** Usage: %fossil ls ?OPTIONS? ?PATHS ...? ** ** List all files in the current check-out. If PATHS is included, only the ** named files (or their children if directories) are shown. ** ** The ls command is essentially two related commands in one, depending on ** whether or not the -r option is given. -r selects a specific check-in ** version to list, in which case -R can be used to select the repository. ** The fine behavior of the --age, -v, and -t options is altered by the -r ** option as well, as explained below. |
| ︙ | ︙ | |||
825 826 827 828 829 830 831 | /* ** COMMAND: extras ** ** Usage: %fossil extras ?OPTIONS? ?PATH1 ...? ** ** Print a list of all files in the source tree that are not part of the | | | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | /* ** COMMAND: extras ** ** Usage: %fossil extras ?OPTIONS? ?PATH1 ...? ** ** Print a list of all files in the source tree that are not part of the ** current check-out. See also the "clean" command. If paths are specified, ** only files in the given directories will be listed. ** ** Files and subdirectories whose names begin with "." are normally ** ignored but can be included by adding the --dotfiles option. ** ** Files whose names match any of the glob patterns in the "ignore-glob" ** setting are ignored. This setting can be overridden by the --ignore |
| ︙ | ︙ | |||
894 895 896 897 898 899 900 | /* ** COMMAND: clean ** ** Usage: %fossil clean ?OPTIONS? ?PATH ...? ** ** Delete all "extra" files in the source tree. "Extra" files are files | | | 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 | /* ** COMMAND: clean ** ** Usage: %fossil clean ?OPTIONS? ?PATH ...? ** ** Delete all "extra" files in the source tree. "Extra" files are files ** that are not officially part of the check-out. If one or more PATH ** arguments appear, then only the files named, or files contained with ** directories named, will be removed. ** ** If the --prompt option is used, prompts are issued to confirm the ** permanent removal of each file. Otherwise, files are backed up to the ** undo buffer prior to removal, and prompts are issued only for files ** whose removal cannot be undone due to their large size or due to |
| ︙ | ︙ | |||
923 924 925 926 927 928 929 | ** ** The --verily option ignores the keep-glob and ignore-glob settings and ** turns on --force, --emptydirs, --dotfiles, and --disable-undo. Use the ** --verily option when you really want to clean up everything. Extreme ** care should be exercised when using the --verily option. ** ** Options: | | | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | ** ** The --verily option ignores the keep-glob and ignore-glob settings and ** turns on --force, --emptydirs, --dotfiles, and --disable-undo. Use the ** --verily option when you really want to clean up everything. Extreme ** care should be exercised when using the --verily option. ** ** Options: ** --allckouts Check for empty directories within any check-outs ** that may be nested within the current one. This ** option should be used with great care because the ** empty-dirs setting (and other applicable settings) ** belonging to the other repositories, if any, will ** not be checked. ** --case-sensitive BOOL Override case-sensitive setting ** --dirsonly Only remove empty directories. No files will |
| ︙ | ︙ | |||
1513 1514 1515 1516 1517 1518 1519 |
g.aCommitFile[jj] = 0;
bag_clear(&toCommit);
}
return result;
}
/*
| | | | 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 |
g.aCommitFile[jj] = 0;
bag_clear(&toCommit);
}
return result;
}
/*
** Returns true if the check-in identified by the first parameter is
** older than the given (valid) date/time string, else returns false.
** Also returns true if rid does not refer to a check-in, but it is not
** intended to be used for that case.
*/
int checkin_is_younger(
int rid, /* The record ID of the ancestor */
const char *zDate /* Date & time of the current check-in */
){
return db_exists(
|
| ︙ | ︙ | |||
1639 1640 1641 1642 1643 1644 1645 |
blob_zero(pOut);
if( vid ){
zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d AND "
"EXISTS(SELECT 1 FROM event WHERE event.type='ci' and event.objid=%d)",
vid, vid);
if( !zParentUuid ){
fossil_fatal("Could not find a valid check-in for RID %d. "
| | | 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 |
blob_zero(pOut);
if( vid ){
zParentUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d AND "
"EXISTS(SELECT 1 FROM event WHERE event.type='ci' and event.objid=%d)",
vid, vid);
if( !zParentUuid ){
fossil_fatal("Could not find a valid check-in for RID %d. "
"Possible check-out/repo mismatch.", vid);
}
}
if( pBaseline ){
blob_appendf(pOut, "B %s\n", zBaselineUuid);
manifest_file_rewind(pBaseline);
pFile = manifest_file_next(pBaseline, 0);
nFBcard++;
|
| ︙ | ︙ | |||
2020 2021 2022 2023 2024 2025 2026 | } /* ** COMMAND: test-commit-warning ** ** Usage: %fossil test-commit-warning ?OPTIONS? ** | | | 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 | } /* ** COMMAND: test-commit-warning ** ** Usage: %fossil test-commit-warning ?OPTIONS? ** ** Check each file in the check-out, including unmodified ones, using all ** the pre-commit checks. ** ** Options: ** --no-settings Do not consider any glob settings. ** -v|--verbose Show per-file results for all pre-commit checks. ** ** See also: commit, extras |
| ︙ | ︙ | |||
2095 2096 2097 2098 2099 2100 2101 | ** COMMAND: ci# ** COMMAND: commit ** ** Usage: %fossil commit ?OPTIONS? ?FILE...? ** or: %fossil ci ?OPTIONS? ?FILE...? ** ** Create a new version containing all of the changes in the current | | | 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 | ** COMMAND: ci# ** COMMAND: commit ** ** Usage: %fossil commit ?OPTIONS? ?FILE...? ** or: %fossil ci ?OPTIONS? ?FILE...? ** ** Create a new version containing all of the changes in the current ** check-out. You will be prompted to enter a check-in comment unless ** the comment has been specified on the command-line using "-m" or a ** file containing the comment using -M. The editor defined in the ** "editor" fossil option (see %fossil help set) will be used, or from ** the "VISUAL" or "EDITOR" environment variables (in that order) if ** no editor is set. ** ** All files that have changed will be committed unless some subset of |
| ︙ | ︙ | |||
2402 2403 2404 2405 2406 2407 2408 |
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
/* There are two ways this command may be executed. If there are
** no arguments following the word "commit", then all modified files
| | | 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 |
if( cReply!='y' && cReply!='Y' ){
fossil_exit(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[]
** array is allocated to contain the "id" field from the vfile table
** for each file to be committed. Or, if aCommitFile is NULL, all files
** should be committed.
*/
|
| ︙ | ︙ | |||
2823 2824 2825 2826 2827 2828 2829 |
/* Verify that the repository checksum matches the expected checksum
** calculated before the check-in started (and stored as the R record
** of the manifest file).
*/
vfile_aggregate_checksum_repository(nvid, &cksum2);
if( blob_compare(&cksum1, &cksum2) ){
vfile_compare_repository_to_disk(nvid);
| | | | | 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 |
/* Verify that the repository checksum matches the expected checksum
** calculated before the check-in started (and stored as the R record
** of the manifest file).
*/
vfile_aggregate_checksum_repository(nvid, &cksum2);
if( blob_compare(&cksum1, &cksum2) ){
vfile_compare_repository_to_disk(nvid);
fossil_fatal("working check-out does not match what would have ended "
"up in the repository: %b versus %b",
&cksum1, &cksum2);
}
/* Verify that the manifest checksum matches the expected checksum */
vfile_aggregate_checksum_manifest(nvid, &cksum2, &cksum1b);
if( blob_compare(&cksum1, &cksum1b) ){
fossil_fatal("manifest checksum self-test failed: "
"%b versus %b", &cksum1, &cksum1b);
}
if( blob_compare(&cksum1, &cksum2) ){
fossil_fatal(
"working check-out does not match manifest after commit: "
"%b versus %b", &cksum1, &cksum2);
}
/* Verify that the commit did not modify any disk images. */
vfile_aggregate_checksum_disk(nvid, &cksum2);
if( blob_compare(&cksum1, &cksum2) ){
fossil_fatal("working check-out before and after commit does not match");
}
}
/* Clear the undo/redo stack */
undo_reset();
/* Commit */
|
| ︙ | ︙ |
Changes to src/checkout.c.
| ︙ | ︙ | |||
19 20 21 22 23 24 25 | ** from the local repository. */ #include "config.h" #include "checkout.h" #include <assert.h> /* | | | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
** from the local repository.
*/
#include "config.h"
#include "checkout.h"
#include <assert.h>
/*
** Check to see if there is an existing check-out that has been
** modified. Return values:
**
** 0: There is an existing check-out but it is unmodified
** 1: There is a modified check-out - there are unsaved changes
*/
int unsaved_changes(unsigned int cksigFlags){
int vid;
db_must_be_within_tree();
vid = db_lget_int("checkout",0);
vfile_check_signature(vid, cksigFlags|CKSIG_ENOTFILE);
return db_exists("SELECT 1 FROM vfile WHERE chnged"
|
| ︙ | ︙ | |||
106 107 108 109 110 111 112 |
if( vid==0 ){
fossil_fatal("no such check-in: %s", g.argv[2]);
}
if( !is_a_version(vid) ){
fossil_fatal("object [%S] is not a check-in", blob_str(&uuid));
}
if( load_vfile_from_rid(vid) && !forceMissingFlag ){
| | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
if( vid==0 ){
fossil_fatal("no such check-in: %s", g.argv[2]);
}
if( !is_a_version(vid) ){
fossil_fatal("object [%S] is not a check-in", blob_str(&uuid));
}
if( load_vfile_from_rid(vid) && !forceMissingFlag ){
fossil_fatal("missing content, unable to check out");
};
return vid;
}
/*
** Set or clear the vfile.isexe flag for a file.
*/
|
| ︙ | ︙ | |||
267 268 269 270 271 272 273 | ** NOTE: Most people use "fossil update" instead of "fossil checkout" for ** day-to-day operations. If you are new to Fossil and trying to learn your ** way around, it is recommended that you become familiar with the ** "fossil update" command first. ** ** This command changes the current check-out to the version specified ** as an argument. The command aborts if there are edited files in the | | | | | | | | | | | 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 294 295 296 297 298 299 300 301 302 303 |
** NOTE: Most people use "fossil update" instead of "fossil checkout" for
** day-to-day operations. If you are new to Fossil and trying to learn your
** way around, it is recommended that you become familiar with the
** "fossil update" command first.
**
** This command changes the current check-out to the version specified
** as an argument. The command aborts if there are edited files in the
** current check-out unless the --force option is used. The --keep option
** leaves files on disk unchanged, except the manifest and manifest.uuid
** files.
**
** The --latest flag can be used in place of VERSION to check-out the
** latest version in the repository.
**
** Options:
** --force Ignore edited files in the current check-out
** --keep Only update the manifest file(s)
** --force-missing Force check-out even if content is missing
** --setmtime Set timestamps of all files to match their SCM-side
** times (the timestamp of the last check-in which modified
** them)
**
** See also: [[update]]
*/
void checkout_cmd(void){
int forceFlag; /* Force check-out even if edits exist */
int forceMissingFlag; /* Force check-out even if missing content */
int keepFlag; /* Do not change any files on disk */
int latestFlag; /* Check out the latest version */
char *zVers; /* Version to check out */
int promptFlag; /* True to prompt before overwriting */
int vid, prior;
int setmtimeFlag; /* --setmtime. Set mtimes on files */
Blob cksum1, cksum1b, cksum2;
db_must_be_within_tree();
db_begin_transaction();
|
| ︙ | ︙ | |||
311 312 313 314 315 316 317 |
/* We should be done with options.. */
verify_all_options();
if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){
usage("VERSION|--latest ?--force? ?--keep?");
}
if( !forceFlag && unsaved_changes(0) ){
| | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
/* We should be done with options.. */
verify_all_options();
if( (latestFlag!=0 && g.argc!=2) || (latestFlag==0 && g.argc!=3) ){
usage("VERSION|--latest ?--force? ?--keep?");
}
if( !forceFlag && unsaved_changes(0) ){
fossil_fatal("there are unsaved changes in the current check-out");
}
if( forceFlag ){
db_multi_exec("DELETE FROM vfile");
prior = 0;
}else{
prior = db_lget_int("checkout",0);
}
|
| ︙ | ︙ | |||
395 396 397 398 399 400 401 | ** Usage: %fossil close ?OPTIONS? ** ** The opposite of "[[open]]". Close the current database connection. ** Require a -f or --force flag if there are unsaved changes in the ** current check-out or if there is non-empty stash. ** ** Options: | | | | | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
** Usage: %fossil close ?OPTIONS?
**
** The opposite of "[[open]]". Close the current database connection.
** Require a -f or --force flag if there are unsaved changes in the
** current check-out or if there is non-empty stash.
**
** Options:
** -f|--force necessary to close a check-out with uncommitted changes
**
** See also: [[open]]
*/
void close_cmd(void){
int forceFlag = find_option("force","f",0)!=0;
db_must_be_within_tree();
/* We should be done with options.. */
verify_all_options();
if( !forceFlag && unsaved_changes(0) ){
fossil_fatal("there are unsaved changes in the current check-out");
}
if( !forceFlag
&& db_table_exists("localdb","stash")
&& db_exists("SELECT 1 FROM localdb.stash")
){
fossil_fatal("closing the check-out will delete your stash");
}
if( db_is_writeable("repository") ){
db_unset_mprintf(1, "ckout:%q", g.zLocalRoot);
}
unlink_local_database(1);
db_close(1);
unlink_local_database(0);
}
|
Changes to src/clone.c.
| ︙ | ︙ | |||
106 107 108 109 110 111 112 | ** '/' to use an absolute path. ** ** Use %HH escapes for special characters in the userid and ** password. For example "%40" in place of "@", "%2f" in place ** of "/", and "%3a" in place of ":". ** ** Note that in Fossil (in contrast to some other DVCSes) a repository | | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
** '/' to use an absolute path.
**
** Use %HH escapes for special characters in the userid and
** password. For example "%40" in place of "@", "%2f" in place
** of "/", and "%3a" in place of ":".
**
** Note that in Fossil (in contrast to some other DVCSes) a repository
** is distinct from a check-out. Cloning a repository is not the same thing
** as opening a repository. This command always clones the repository. This
** command might also open the repository, but only if the --no-open option
** is omitted and either the --workdir option is included or the FILENAME
** argument is omitted. Use the separate [[open]] command to open a
** repository that was previously cloned and already exists on the
** local machine.
**
** By default, the current login name is used to create the default
** admin user for the new clone. This can be overridden using
** the -A|--admin-user parameter.
**
** Options:
** -A|--admin-user USERNAME Make USERNAME the administrator
** -B|--httpauth USER:PASS Add HTTP Basic Authorization to requests
** --nested Allow opening a repository inside an opened
** check-out
** --nocompress Omit extra delta compression
** --no-open Clone only. Do not open a check-out.
** --once Don't remember the URI.
** --private Also clone private branches
** --save-http-password Remember the HTTP password without asking
** --ssh-command|-c SSH Use SSH as the "ssh" command
** --ssl-identity FILENAME Use the SSL identity if requested by the server
** --transport-command CMD Use CMD to move messages to the server and back
** -u|--unversioned Also sync unversioned content
** -v|--verbose Show more statistics in output
** --workdir DIR Also open a check-out in DIR
**
** See also: [[init]], [[open]]
*/
void clone_cmd(void){
char *zPassword;
const char *zDefaultUser; /* Optional name of the default user */
const char *zHttpAuth; /* HTTP Authorization user:pass information */
|
| ︙ | ︙ | |||
198 199 200 201 202 203 204 |
zWorkDir = mprintf("./%s", zBase);
}
fossil_free(zBase);
}
if( -1 != file_size(zRepo, ExtFILE) ){
fossil_fatal("file already exists: %s", zRepo);
}
| | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
zWorkDir = mprintf("./%s", zBase);
}
fossil_free(zBase);
}
if( -1 != file_size(zRepo, ExtFILE) ){
fossil_fatal("file already exists: %s", zRepo);
}
/* Fail before clone if open will fail because inside an open check-out */
if( zWorkDir!=0 && zWorkDir[0]!=0 && !noOpen ){
if( db_open_local_v2(0, allowNested) ){
fossil_fatal("there is already an open tree at %s", g.zLocalRoot);
}
}
url_parse(g.argv[2], urlFlags);
if( zDefaultUser==0 && g.url.user!=0 ) zDefaultUser = g.url.user;
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 | ** with: ** ** (1) The "configdb" database in ~/.fossil or ~/.config/fossil.db ** or in %LOCALAPPDATA%/_fossil ** ** (2) The "repository" database ** | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ** with: ** ** (1) The "configdb" database in ~/.fossil or ~/.config/fossil.db ** or in %LOCALAPPDATA%/_fossil ** ** (2) The "repository" database ** ** (3) A local check-out database named "_FOSSIL_" or ".fslckout" ** and located at the root of the local copy of the source tree. ** */ #include "config.h" #if defined(_WIN32) # if USE_SEE # include <windows.h> |
| ︙ | ︙ | |||
2050 2051 2052 2053 2054 2055 2056 | i64 lsize; if( file_access(zDbName, F_OK) ) return 0; lsize = file_size(zDbName, ExtFILE); if( lsize%1024!=0 || lsize<4096 ) return 0; db_open_or_attach(zDbName, "localdb"); | | | | | 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 |
i64 lsize;
if( file_access(zDbName, F_OK) ) return 0;
lsize = file_size(zDbName, ExtFILE);
if( lsize%1024!=0 || lsize<4096 ) return 0;
db_open_or_attach(zDbName, "localdb");
/* Check to see if the check-out database has the lastest schema changes.
** The most recent schema change (2019-01-19) is the addition of the
** vmerge.mhash and vfile.mhash fields. If the schema has the vmerge.mhash
** column, assume everything else is up-to-date.
*/
if( db_table_has_column("localdb","vmerge","mhash") ){
return 1; /* This is a check-out database with the latest schema */
}
/* If there is no vfile table, then assume we have picked up something
** that is not even close to being a valid check-out database */
if( !db_table_exists("localdb","vfile") ){
return 0; /* Not a DB */
}
/* If the "isexe" column is missing from the vfile table, then
** add it now. This code added on 2010-03-06. After all users have
** upgraded, this code can be safely deleted.
|
| ︙ | ︙ | |||
2090 2091 2092 2093 2094 2095 2096 |
db_multi_exec("ALTER TABLE undo ADD COLUMN isLink BOOLEAN DEFAULT 0");
}
if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){
db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0");
}
}
| | | 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 |
db_multi_exec("ALTER TABLE undo ADD COLUMN isLink BOOLEAN DEFAULT 0");
}
if( db_local_table_exists_but_lacks_column("undo_vfile", "islink") ){
db_multi_exec("ALTER TABLE undo_vfile ADD COLUMN islink BOOL DEFAULT 0");
}
}
/* The design of the check-out database changed on 2019-01-19, adding the mhash
** column to vfile and vmerge and changing the UNIQUE index on vmerge into
** a PRIMARY KEY that includes the new mhash column. However, we must have
** the repository database at hand in order to do the migration, so that
** step is deferred. */
return 1;
}
|
| ︙ | ︙ | |||
2112 2113 2114 2115 2116 2117 2118 | ** ** If no valid _FOSSIL_ or .fslckout file is found, we move up one level and ** try again. Once the file is found, the g.zLocalRoot variable is set ** to the root of the repository tree and this routine returns 1. If ** no database is found, then this routine return 0. ** ** In db_open_local_v2(), if the bRootOnly flag is true, then only | | | 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 |
**
** If no valid _FOSSIL_ or .fslckout file is found, we move up one level and
** try again. Once the file is found, the g.zLocalRoot variable is set
** to the root of the repository tree and this routine returns 1. If
** no database is found, then this routine return 0.
**
** In db_open_local_v2(), if the bRootOnly flag is true, then only
** look in the CWD for the check-out database. Do not scan upwards in
** the file hierarchy.
**
** This routine always opens the user database regardless of whether or
** not the repository database is found. If the _FOSSIL_ or .fslckout file
** is found, it is attached to the open database connection too.
*/
int db_open_local_v2(const char *zDbName, int bRootOnly){
|
| ︙ | ︙ | |||
2134 2135 2136 2137 2138 2139 2140 |
while( n>0 ){
for(i=0; i<count(aDbName); i++){
sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
if( isValidLocalDb(zPwd) ){
if( db_open_config(0, 1)==0 ){
return 0; /* Configuration could not be opened */
}
| | | | 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 |
while( n>0 ){
for(i=0; i<count(aDbName); i++){
sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]);
if( isValidLocalDb(zPwd) ){
if( db_open_config(0, 1)==0 ){
return 0; /* Configuration could not be opened */
}
/* Found a valid check-out database file */
g.zLocalDbName = mprintf("%s", zPwd);
zPwd[n] = 0;
while( n>0 && zPwd[n-1]=='/' ){
n--;
zPwd[n] = 0;
}
g.zLocalRoot = mprintf("%s/", zPwd);
g.localOpen = 1;
db_open_repository(zDbName);
return 1;
}
}
if( bRootOnly ) break;
n--;
while( n>1 && zPwd[n]!='/' ){ n--; }
while( n>1 && zPwd[n-1]=='/' ){ n--; }
zPwd[n] = 0;
}
/* A check-out database file could not be found */
return 0;
}
int db_open_local(const char *zDbName){
return db_open_local_v2(zDbName, 0);
}
/*
|
| ︙ | ︙ | |||
2292 2293 2294 2295 2296 2297 2298 | } /* Make a change to the CHECK constraint on the BLOB table for ** version 2.0 and later. */ rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */ | | | | 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 |
}
/* Make a change to the CHECK constraint on the BLOB table for
** version 2.0 and later.
*/
rebuild_schema_update_2_0(); /* Do the Fossil-2.0 schema updates */
/* Additional checks that occur when opening the check-out database */
if( g.localOpen ){
/* If the repository database that was just opened has been
** eplaced by a clone of the same project, with different RID
** values, then renumber the RID values stored in various tables
** of the check-out database, so that the repository and check-out
** databases align.
*/
if( !db_fingerprint_ok() ){
if( find_option("no-rid-adjust",0,0)!=0 ){
/* The --no-rid-adjust command-line option bypasses the RID value
** updates. Intended for use during debugging, especially to be
** able to run "fossil sql" after a database swap. */
|
| ︙ | ︙ | |||
2331 2332 2333 2334 2335 2336 2337 |
fossil_print(
"WARNING: The repository database has been replaced by a clone.\n"
"Bisect history and undo have been lost.\n"
);
}
}
| | | 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 |
fossil_print(
"WARNING: The repository database has been replaced by a clone.\n"
"Bisect history and undo have been lost.\n"
);
}
}
/* Make sure the check-out database schema migration of 2019-01-20
** has occurred.
**
** The 2019-01-19 migration is the addition of the vmerge.mhash and
** vfile.mhash columns and making the vmerge.mhash column part of the
** PRIMARY KEY for vmerge.
*/
if( !db_table_has_column("localdb", "vfile", "mhash") ){
|
| ︙ | ︙ | |||
2386 2387 2388 2389 2390 2391 2392 | #define OPEN_ANY_SCHEMA 0x002 /* Do not error if schema is wrong */ #define OPEN_SUBSTITUTE 0x004 /* Fake in-memory repo if not found */ #endif /* ** Try to find the repository and open it. Use the -R or --repository ** option to locate the repository. If no such option is available, then | | | 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 |
#define OPEN_ANY_SCHEMA 0x002 /* Do not error if schema is wrong */
#define OPEN_SUBSTITUTE 0x004 /* Fake in-memory repo if not found */
#endif
/*
** Try to find the repository and open it. Use the -R or --repository
** option to locate the repository. If no such option is available, then
** use the repository of the open check-out if there is one.
**
** Error out if the repository cannot be opened.
*/
void db_find_and_open_repository(int bFlags, int nArgUsed){
const char *zRep = find_repository_option();
if( zRep && file_isdir(zRep, ExtFILE)==1 ){
goto rep_not_found;
|
| ︙ | ︙ | |||
2469 2470 2471 2472 2473 2474 2475 | /* ** COMMAND: test-move-repository ** ** Usage: %fossil test-move-repository PATHNAME ** ** Change the location of the repository database on a local check-out. | | | | | 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 |
/*
** COMMAND: test-move-repository
**
** Usage: %fossil test-move-repository PATHNAME
**
** Change the location of the repository database on a local check-out.
** Use this command to avoid having to close and reopen a check-out
** when relocating the repository database.
*/
void move_repo_cmd(void){
Blob repo;
char *zRepo;
if( g.argc!=3 ){
usage("PATHNAME");
}
file_canonical_name(g.argv[2], &repo, 0);
zRepo = blob_str(&repo);
if( file_access(zRepo, F_OK) ){
fossil_fatal("no such file: %s", zRepo);
}
if( db_open_local(zRepo)==0 ){
fossil_fatal("not in a local check-out");
return;
}
db_open_or_attach(zRepo, "test_repo");
db_lset("repository", blob_str(&repo));
db_record_repository_filename(blob_str(&repo));
db_close(1);
}
/*
** Open the local database. If unable, exit with an error.
*/
void db_must_be_within_tree(void){
if( find_repository_option() ){
fossil_fatal("the \"%s\" command only works from within an open check-out",
g.argv[1]);
}
if( db_open_local(0)==0 ){
fossil_fatal("current directory is not within an open check-out");
}
db_open_repository(0);
db_verify_schema();
}
/*
** Close the database connection.
|
| ︙ | ︙ | |||
3190 3191 3192 3193 3194 3195 3196 |
while( cacheEntry!=0 ){
if( fossil_strcmp(cacheEntry->zName, zName)==0 ){
zVersionedSetting = fossil_strdup(cacheEntry->zValue);
break;
}
cacheEntry = cacheEntry->next;
}
| | | 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 |
while( cacheEntry!=0 ){
if( fossil_strcmp(cacheEntry->zName, zName)==0 ){
zVersionedSetting = fossil_strdup(cacheEntry->zValue);
break;
}
cacheEntry = cacheEntry->next;
}
/* Attempt to read value from file in check-out if there wasn't a cache hit.*/
if( cacheEntry==0 ){
Blob versionedPathname;
Blob setting;
blob_zero(&versionedPathname);
blob_zero(&setting);
blob_appendf(&versionedPathname, "%s.fossil-settings/%s",
g.zLocalRoot, zName);
|
| ︙ | ︙ | |||
3297 3298 3299 3300 3301 3302 3303 |
if( db_step(&q2)==SQLITE_ROW && (zRes = db_column_text(&q2,0))!=0 ){
z = fossil_strdup(zRes);
}
db_reset(&q2);
}
if( pSetting!=0 && pSetting->versionable ){
/* This is a versionable setting, try and get the info from a
| | | 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 |
if( db_step(&q2)==SQLITE_ROW && (zRes = db_column_text(&q2,0))!=0 ){
z = fossil_strdup(zRes);
}
db_reset(&q2);
}
if( pSetting!=0 && pSetting->versionable ){
/* This is a versionable setting, try and get the info from a
** checked-out file */
char * zZ = z;
z = db_get_versioned(zName, z);
if(zZ != z){
fossil_free(zZ);
}
}
if( z==0 ){
|
| ︙ | ︙ | |||
3589 3590 3591 3592 3593 3594 3595 | ** The repository filename %s is recorded as an entry with a "name" field ** of the following form: ** ** repo:%s ** ** The value field is set to 1. ** | | | | 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 |
** The repository filename %s is recorded as an entry with a "name" field
** of the following form:
**
** repo:%s
**
** The value field is set to 1.
**
** If running from a local check-out, also record the root of the check-out
** as follows:
**
** ckout:%s
**
** Where %s is the check-out root. The value is the repository file.
*/
void db_record_repository_filename(const char *zName){
char *zRepoSetting;
char *zCkoutSetting;
Blob full;
if( zName==0 ){
if( !g.localOpen ) return;
|
| ︙ | ︙ | |||
3659 3660 3661 3662 3663 3664 3665 | } /* ** COMMAND: open ** ** Usage: %fossil open REPOSITORY ?VERSION? ?OPTIONS? ** | | | 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 | } /* ** COMMAND: open ** ** Usage: %fossil open REPOSITORY ?VERSION? ?OPTIONS? ** ** Open a new connection to the repository name REPOSITORY. A check-out ** for the repository is created with its root at the current working ** directory, or in DIR if the "--workdir DIR" is used. If VERSION is ** specified then that version is checked out. Otherwise the most recent ** check-in on the main branch (usually "trunk") is used. ** ** REPOSITORY can be the filename for a repository that already exists on the ** local machine or it can be a URI for a remote repository. If REPOSITORY |
| ︙ | ︙ | |||
3681 3682 3683 3684 3685 3686 3687 | ** fossil open https://fossil-scm.org/home/new-name ** ** The base URI for cloning is "https://fossil-scm.org/home". The extra ** "new-name" term means that the cloned repository will be called ** "new-name.fossil". ** ** Options: | | | | | | 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 | ** fossil open https://fossil-scm.org/home/new-name ** ** The base URI for cloning is "https://fossil-scm.org/home". The extra ** "new-name" term means that the cloned repository will be called ** "new-name.fossil". ** ** Options: ** --empty Initialize check-out as being empty, but still connected ** with the local repository. If you commit this check-out, ** it will become a new "initial" commit in the repository. ** -f|--force Continue with the open even if the working directory is ** not empty. ** --force-missing Force opening a repository with missing content ** -k|--keep Only modify the manifest file(s) ** --nested Allow opening a repository inside an opened check-out ** --nosync Do not auto-sync the repository prior to opening even ** if the autosync setting is on. ** --repodir DIR If REPOSITORY is a URI that will be cloned, store ** the clone in DIR rather than in "." ** --setmtime Set timestamps of all files to match their SCM-side ** times (the timestamp of the last check-in which modified ** them). ** --sync Auto-sync prior to opening even if the autosync setting ** is off. ** --verbose If passed a URI then this flag is passed on to the clone ** operation, otherwise it has no effect. ** --workdir DIR Use DIR as the working directory instead of ".". The DIR ** directory is created if it does not exist. |
| ︙ | ︙ | |||
4331 4332 4333 4334 4335 4336 4337 | /* ** SETTING: main-branch width=40 default=trunk ** The value is the primary branch for the project. */ /* ** SETTING: manifest width=5 versionable ** If enabled, automatically create files "manifest" and "manifest.uuid" | | | 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 | /* ** SETTING: main-branch width=40 default=trunk ** The value is the primary branch for the project. */ /* ** SETTING: manifest width=5 versionable ** If enabled, automatically create files "manifest" and "manifest.uuid" ** in every check-out. ** ** Optionally use combinations of characters 'r' for "manifest", ** 'u' for "manifest.uuid" and 't' for "manifest.tags". The SQLite ** and Fossil repositories both require manifests. */ /* ** SETTING: max-loadavg width=25 default=0.0 |
| ︙ | ︙ | |||
4367 4368 4369 4370 4371 4372 4373 | ** files have been modified. If disabled, all managed files ** are hashed to detect changes, which can be slow for large ** projects. */ /* ** SETTING: mv-rm-files boolean default=off ** If enabled, the "mv" and "rename" commands will also move | | | | 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 | ** files have been modified. If disabled, all managed files ** are hashed to detect changes, which can be slow for large ** projects. */ /* ** SETTING: mv-rm-files boolean default=off ** If enabled, the "mv" and "rename" commands will also move ** the associated files within the check-out -AND- the "rm" ** and "delete" commands will also remove the associated ** files from within the check-out. */ /* ** SETTING: pgp-command width=40 sensitive ** Command used to clear-sign manifests at check-in. ** Default value is "gpg --clearsign -o" */ /* |
| ︙ | ︙ | |||
4404 4405 4406 4407 4408 4409 4410 | /* ** SETTING: relative-paths boolean default=on ** When showing changes and extras, report paths relative ** to the current working directory. */ /* ** SETTING: repo-cksum boolean default=on | | | 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 | /* ** SETTING: relative-paths boolean default=on ** When showing changes and extras, report paths relative ** to the current working directory. */ /* ** SETTING: repo-cksum boolean default=on ** Compute checksums over all files in each check-out as a double-check ** of correctness. Disable this on large repositories for a performance ** improvement. */ /* ** SETTING: repolist-skin width=2 default=0 ** If non-zero then use this repository as the skin for a repository list ** such as created by the one of: |
| ︙ | ︙ | |||
4879 4880 4881 4882 4883 4884 4885 | } /* ** COMMAND: test-database-names ** ** Print the names of the various database files: ** (1) The main repository database | | | | | | 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 |
}
/*
** COMMAND: test-database-names
**
** Print the names of the various database files:
** (1) The main repository database
** (2) The local check-out database
** (3) The global configuration database
*/
void test_database_name_cmd(void){
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
fossil_print("Repository database: %s\n", g.zRepositoryName);
fossil_print("Local database: %s\n", g.zLocalDbName);
fossil_print("Config database: %s\n", g.zConfigDbName);
}
/*
** Compute a "fingerprint" on the repository. A fingerprint is used
** to verify that that the repository has not been replaced by a clone
** of the same repository. More precisely, a fingerprint are used to
** verify that the mapping between SHA3 hashes and RID values is unchanged.
**
** The check-out database ("localdb") stores RID values. When associating
** a check-out database against a repository database, it is useful to verify
** the fingerprint so that we know tha the RID values in the check-out
** database still correspond to the correct entries in the BLOB table of
** the repository.
**
** The fingerprint is based on the RCVFROM table. When constructing a
** new fingerprint, use the most recent RCVFROM entry. (Set rcvid==0 to
** accomplish this.) When verifying an old fingerprint, use the same
** RCVFROM entry that generated the fingerprint in the first place.
|
| ︙ | ︙ | |||
5004 5005 5006 5007 5008 5009 5010 |
/*
** Verify that the fingerprint recorded in the "fingerprint" entry
** of the VVAR table matches the fingerprint on the currently
** connected repository. Return true if the fingerprint is ok, and
** return false if the fingerprint does not match.
*/
int db_fingerprint_ok(void){
| | | | | 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 |
/*
** Verify that the fingerprint recorded in the "fingerprint" entry
** of the VVAR table matches the fingerprint on the currently
** connected repository. Return true if the fingerprint is ok, and
** return false if the fingerprint does not match.
*/
int db_fingerprint_ok(void){
char *zCkout; /* The fingerprint recorded in the check-out database */
char *zRepo; /* The fingerprint of the repository */
int rc; /* Result */
if( !db_lget_int("checkout", 0) ){
/* We have an empty check-out, fingerprint is still NULL. */
return 2;
}
zCkout = db_text(0,"SELECT value FROM localdb.vvar WHERE name='fingerprint'");
if( zCkout==0 ){
/* This is an older check-out that does not record a fingerprint.
** We have to assume everything is ok */
return 2;
}
zRepo = db_fingerprint(atoi(zCkout), 1);
rc = fossil_strcmp(zCkout,zRepo)==0;
fossil_free(zRepo);
/* If the initial test fails, try again using the older fingerprint
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
3546 3547 3548 3549 3550 3551 3552 | ** filename=FILENAME The filename. ** filevers=BOOLEAN Show file versions rather than check-in versions ** limit=LIMIT Limit the amount of analysis. LIMIT can be one of: ** none No limit ** Xs As much as can be computed in X seconds ** N N versions ** log=BOOLEAN Show a log of versions analyzed | | | 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 |
** filename=FILENAME The filename.
** filevers=BOOLEAN Show file versions rather than check-in versions
** limit=LIMIT Limit the amount of analysis. LIMIT can be one of:
** none No limit
** Xs As much as can be computed in X seconds
** N N versions
** log=BOOLEAN Show a log of versions analyzed
** origin=ID The origin check-in. If unspecified, the root
** check-in over the entire repository is used.
** Specify "origin=trunk" or similar for a reverse
** annotation
** w=BOOLEAN Ignore whitespace
*/
void annotation_page(void){
int i;
|
| ︙ | ︙ |
Changes to src/diffcmd.c.
| ︙ | ︙ | |||
1025 1026 1027 1028 1029 1030 1031 | /* ** COMMAND: diff ** COMMAND: gdiff ** ** Usage: %fossil diff|gdiff ?OPTIONS? ?FILE1? ?FILE2 ...? ** ** Show the difference between the current version of each of the FILEs | | | 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | /* ** COMMAND: diff ** COMMAND: gdiff ** ** Usage: %fossil diff|gdiff ?OPTIONS? ?FILE1? ?FILE2 ...? ** ** Show the difference between the current version of each of the FILEs ** specified (as they exist on disk) and that same file as it was checked- ** out. Or if the FILE arguments are omitted, show all unsaved changes ** currently in the working check-out. ** ** The default output format is a "unified patch" (the same as the ** output of "diff -u" on most unix systems). Many alternative formats ** are available. A few of the more useful alternatives: ** |
| ︙ | ︙ |
Changes to src/doc.c.
| ︙ | ︙ | |||
1010 1011 1012 1013 1014 1015 1016 |
g.isConst = 1;
}
zDfltTitle = zName;
}
}else if( fossil_strcmp(zCheckin,"ckout")==0
|| fossil_strcmp(zCheckin,g.zCkoutAlias)==0
){
| | | 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 |
g.isConst = 1;
}
zDfltTitle = zName;
}
}else if( fossil_strcmp(zCheckin,"ckout")==0
|| fossil_strcmp(zCheckin,g.zCkoutAlias)==0
){
/* Read from the local check-out */
char *zFullpath;
db_must_be_within_tree();
zFullpath = mprintf("%s/%s", g.zLocalRoot, zName);
if( file_isfile(zFullpath, RepoFILE)
&& blob_read_from_file(&filebody, zFullpath, RepoFILE)>0 ){
rid = 1; /* Fake RID just to get the loop to end */
}
|
| ︙ | ︙ |
Changes to src/export.c.
| ︙ | ︙ | |||
456 457 458 459 460 461 462 | ** ** Write an export of all check-ins to standard output. The export is ** written in the git-fast-export file format assuming the --git option is ** provided. The git-fast-export format is currently the only VCS ** interchange format supported, though other formats may be added in ** the future. ** | | | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | ** ** Write an export of all check-ins to standard output. The export is ** written in the git-fast-export file format assuming the --git option is ** provided. The git-fast-export format is currently the only VCS ** interchange format supported, though other formats may be added in ** the future. ** ** Run this command within a check-out. Or use the -R or --repository ** option to specify a Fossil repository to be exported. ** ** Only check-ins are exported using --git. Git does not support tickets ** or wiki or tech notes or attachments, so none of those are exported. ** ** If the "--import-marks FILE" option is used, it contains a list of ** rids to skip. |
| ︙ | ︙ | |||
1822 1823 1824 1825 1826 1827 1828 | ** > fossil git export [MIRROR] [OPTIONS] ** ** Write content from the Fossil repository into the Git repository ** in directory MIRROR. The Git repository is created if it does not ** already exist. If the Git repository does already exist, then ** new content added to fossil since the previous export is appended. ** | | | 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 | ** > fossil git export [MIRROR] [OPTIONS] ** ** Write content from the Fossil repository into the Git repository ** in directory MIRROR. The Git repository is created if it does not ** already exist. If the Git repository does already exist, then ** new content added to fossil since the previous export is appended. ** ** Repeat this command whenever new check-ins are added to the Fossil ** repository in order to reflect those changes into the mirror. If ** the MIRROR option is omitted, the repository from the previous ** invocation is used. ** ** The MIRROR directory will contain a subdirectory named ** ".mirror_state" that contains information that Fossil needs to ** do incremental exports. Do not attempt to manage or edit the files |
| ︙ | ︙ |
Changes to src/file.c.
| ︙ | ︙ | |||
376 377 378 379 380 381 382 | return 0; } /* ** The file named zFile is suppose to be an in-tree file. Check to ** ensure that it will be safe to write to this file by verifying that ** there are no symlinks or other non-directory objects in between the | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
return 0;
}
/*
** The file named zFile is suppose to be an in-tree file. Check to
** ensure that it will be safe to write to this file by verifying that
** there are no symlinks or other non-directory objects in between the
** root of the check-out and zFile.
**
** If a problem is found, print a warning message (using fossil_warning())
** and return non-zero. If everything is ok, return zero.
*/
int file_unsafe_in_tree_path(const char *zFile){
int n;
if( !file_is_absolute_path(zFile) ){
|
| ︙ | ︙ | |||
1477 1478 1479 1480 1481 1482 1483 | ** display file system information about the files specified, if any. ** ** Options: ** ** --allow-symlinks BOOLEAN Temporarily turn allow-symlinks on/off ** --open-config Open the configuration database first. ** --reset Reset cached stat() info for each file. | | | 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 |
** display file system information about the files specified, if any.
**
** Options:
**
** --allow-symlinks BOOLEAN Temporarily turn allow-symlinks on/off
** --open-config Open the configuration database first.
** --reset Reset cached stat() info for each file.
** --root ROOT Use ROOT as the root of the check-out
** --slash Trailing slashes, if any, are retained.
*/
void cmd_test_file_environment(void){
int i;
int slashFlag = find_option("slash",0,0)!=0;
int resetFlag = find_option("reset",0,0)!=0;
const char *zRoot = find_option("root",0,1);
|
| ︙ | ︙ | |||
1697 1698 1699 1700 1701 1702 1703 |
char *zFull;
int (*xCmp)(const char*,const char*,int);
blob_zero(pOut);
if( !g.localOpen ){
if( absolute && !file_is_absolute_path(zOrigName) ){
if( errFatal ){
| | | | | 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 |
char *zFull;
int (*xCmp)(const char*,const char*,int);
blob_zero(pOut);
if( !g.localOpen ){
if( absolute && !file_is_absolute_path(zOrigName) ){
if( errFatal ){
fossil_fatal("relative to absolute needs open check-out tree: %s",
zOrigName);
}
return 0;
}else{
/*
** The original path may be relative or absolute; however, without
** an open check-out tree, the only things we can do at this point
** is return it verbatim or generate a fatal error. The caller is
** probably expecting a tree-relative path name will be returned;
** however, most places where this function is called already check
** if the local check-out tree is open, either directly or indirectly,
** which would make this situation impossible. Alternatively, they
** could check the returned path using the file_is_absolute_path()
** function.
*/
blob_appendf(pOut, "%s", zOrigName);
return 1;
}
|
| ︙ | ︙ | |||
1747 1748 1749 1750 1751 1752 1753 |
return 1;
}
if( nFull<=nLocalRoot || xCmp(zLocalRoot, zFull, nLocalRoot) ){
blob_reset(&localRoot);
blob_reset(&full);
if( errFatal ){
| | | 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 |
return 1;
}
if( nFull<=nLocalRoot || xCmp(zLocalRoot, zFull, nLocalRoot) ){
blob_reset(&localRoot);
blob_reset(&full);
if( errFatal ){
fossil_fatal("file outside of check-out tree: %s", zOrigName);
}
return 0;
}
if( absolute ){
if( !file_is_absolute_path(zOrigName) ){
blob_append(pOut, zLocalRoot, nLocalRoot);
}
|
| ︙ | ︙ | |||
2400 2401 2402 2403 2404 2405 2406 |
}
}
return 1;
}
/*
** Internal helper for touch_cmd(). If the given file name is found in
| | | 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 |
}
}
return 1;
}
/*
** Internal helper for touch_cmd(). If the given file name is found in
** the given check-out version, which MUST be the check-out version
** currently populating the vfile table, the vfile.mrid value for the
** file is returned, else 0 is returned. zName must be resolvable
** as-is from the vfile table - this function neither expands nor
** normalizes it, though it does compare using the repo's
** filename_collation() preference.
*/
static int touch_cmd_vfile_mrid( int vid, char const *zName ){
|
| ︙ | ︙ | |||
2429 2430 2431 2432 2433 2434 2435 | } /* ** COMMAND: touch* ** ** Usage: %fossil touch ?OPTIONS? ?FILENAME...? ** | | | | | | 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 |
}
/*
** COMMAND: touch*
**
** Usage: %fossil touch ?OPTIONS? ?FILENAME...?
**
** For each file in the current check-out matching one of the provided
** list of glob patterns and/or file names, the file's mtime is
** updated to a value specified by one of the flags --checkout,
** --checkin, or --now.
**
** If neither glob patterns nor filenames are provided, it operates on
** all files managed by the currently checked-out version.
**
** This command gets its name from the conventional Unix "touch"
** command.
**
** Options:
** --now Stamp each affected file with the current time.
** This is the default behavior.
** -c|--checkin Stamp each affected file with the time of the
** most recent check-in which modified that file.
** -C|--checkout Stamp each affected file with the time of the
** currently checked-out version.
** -g GLOBLIST Comma-separated list of glob patterns.
** -G GLOBFILE Similar to -g but reads its globs from a
** fossil-conventional glob list file.
** -v|--verbose Outputs extra information about its globs
** and each file it touches.
** -n|--dry-run Outputs which files would require touching,
** but does not touch them.
** -q|--quiet Suppress warnings, e.g. when skipping unmanaged
** or out-of-tree files.
**
** Only one of --now, --checkin, and --checkout may be used. The
** default is --now.
**
** Only one of -g or -G may be used. If neither is provided and no
** additional filenames are provided, the effect is as if a glob of
** '*' were provided, i.e. all files belonging to the
** currently checked-out version. Note that all glob patterns provided
** via these flags are always evaluated as if they are relative to the
** top of the source tree, not the current working (sub)directory.
** Filenames provided without these flags, on the other hand, are
** treated as relative to the current directory.
**
** As a special case, files currently undergoing an uncommitted merge
** might not get timestamped with --checkin because it may be
** impossible for fossil to choose between multiple potential
** timestamps. A non-fatal warning is emitted for such cases.
**
*/
void touch_cmd(){
const char * zGlobList; /* -g List of glob patterns */
const char * zGlobFile; /* -G File of glob patterns */
Glob * pGlob = 0; /* List of glob patterns */
int verboseFlag;
int dryRunFlag;
int vid; /* Check-out version */
int changeCount = 0; /* Number of files touched */
int quietFlag = 0; /* -q|--quiet */
int timeFlag; /* -1==--checkin, 1==--checkout, 0==--now */
i64 nowTime = 0; /* Timestamp of --now or --checkout */
Stmt q;
Blob absBuffer = empty_blob; /* Absolute filename buffer */
|
| ︙ | ︙ | |||
2511 2512 2513 2514 2515 2516 2517 |
int const now = find_option("now",0,0) ? 1 : 0;
if(ci + co + now > 1){
fossil_fatal("Options --checkin, --checkout, and --now may "
"not be used together.");
}else if(co){
timeFlag = 1;
if(verboseFlag){
| | | | | | | 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 |
int const now = find_option("now",0,0) ? 1 : 0;
if(ci + co + now > 1){
fossil_fatal("Options --checkin, --checkout, and --now may "
"not be used together.");
}else if(co){
timeFlag = 1;
if(verboseFlag){
fossil_print("Timestamp = current check-out version.\n");
}
}else if(ci){
timeFlag = -1;
if(verboseFlag){
fossil_print("Timestamp = check-in in which each file was "
"most recently modified.\n");
}
}else{
timeFlag = 0;
if(verboseFlag){
fossil_print("Timestamp = current system time.\n");
}
}
}
verify_all_options();
db_must_be_within_tree();
vid = db_lget_int("checkout", 0);
if(vid==0){
fossil_fatal("Cannot determine check-out version.");
}
if(zGlobList){
pGlob = *zGlobList ? glob_create(zGlobList) : 0;
}else if(zGlobFile){
Blob globs = empty_blob;
blob_read_from_file(&globs, zGlobFile, ExtFILE);
pGlob = glob_create( globs.aData );
blob_reset(&globs);
}
if( pGlob && verboseFlag!=0 ){
int i;
for(i=0; i<pGlob->nPattern; ++i){
fossil_print("glob: %s\n", pGlob->azPattern[i]);
}
}
db_begin_transaction();
if(timeFlag==0){/*--now*/
nowTime = time(0);
}else if(timeFlag>0){/*--checkout: get the check-out
manifest's timestamp*/
assert(vid>0);
nowTime = db_int64(-1,
"SELECT CAST(strftime('%%s',"
"(SELECT mtime FROM event WHERE objid=%d)"
") AS INTEGER)", vid);
if(nowTime<0){
fossil_fatal("Could not determine check-out version's time!");
}
}else{ /* --checkin */
assert(0 == nowTime);
}
if((pGlob && pGlob->nPattern>0) || g.argc<3){
/*
** We have either (1) globs or (2) no trailing filenames. If there
|
| ︙ | ︙ |
Changes to src/fileedit.c.
| ︙ | ︙ | |||
20 21 22 23 24 25 26 | #include "config.h" #include "fileedit.h" #include <assert.h> #include <stdarg.h> /* ** State for the "mini-checkin" infrastructure, which enables the | | | | 20 21 22 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 |
#include "config.h"
#include "fileedit.h"
#include <assert.h>
#include <stdarg.h>
/*
** State for the "mini-checkin" infrastructure, which enables the
** ability to commit changes to a single file without a check-out
** db, e.g. for use via an HTTP request.
**
** Use CheckinMiniInfo_init() to cleanly initialize one to a known
** valid/empty default state.
**
** Memory for all non-const pointer members is owned by the
** CheckinMiniInfo instance, unless explicitly noted otherwise, and is
** freed by CheckinMiniInfo_cleanup(). Similarly, each instance owns
** any memory for its own Blob members, but NOT for its pointers to
** blobs.
*/
struct CheckinMiniInfo {
Manifest * pParent; /* parent check-in. Memory is owned by this
object. */
char *zParentUuid; /* Full UUID of pParent */
char *zFilename; /* Name of single file to commit. Must be
relative to the top of the repo. */
Blob fileContent; /* Content of file referred to by zFilename. */
Blob fileHash; /* Hash of this->fileContent, using the repo's
preferred hash method. */
|
| ︙ | ︙ | |||
99 100 101 102 103 104 105 | ** than their parent. i.e. they may not have a timestamp ** which predates their parent. This flag bypasses that ** check. */ CIMINI_ALLOW_OLDER = 1<<4, /* | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | ** than their parent. i.e. they may not have a timestamp ** which predates their parent. This flag bypasses that ** check. */ CIMINI_ALLOW_OLDER = 1<<4, /* ** Indicates that the content of the newly checked-in file is ** converted, if needed, to use the same EOL style as the previous ** version of that file. Only the in-memory/in-repo copies are ** affected, not the original file (if any). */ CIMINI_CONVERT_EOL_INHERIT = 1<<5, /* ** Indicates that the input's EOLs should be converted to Unix-style. |
| ︙ | ︙ | |||
384 385 386 387 388 389 390 | blob_appendf(pOut, "Z %b\n", &zCard); blob_reset(&zCard); return 1; #undef mf_err } /* | | | | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | blob_appendf(pOut, "Z %b\n", &zCard); blob_reset(&zCard); return 1; #undef mf_err } /* ** A so-called "single-file/mini/web check-in" is a slimmed-down form ** of the check-in command which accepts only a single file and is ** intended to accept edits to a file via the web interface or from ** the CLI from outside of a check-out. ** ** Being fully non-interactive is a requirement for this function, ** thus it cannot perform autosync or similar activities (which ** includes checking for repo locks). ** ** This routine uses the state from the given fully-populated pCI ** argument to add pCI->fileContent to the database, and create and |
| ︙ | ︙ | |||
438 439 440 441 442 443 444 | ** ** On error, returns false (0) and, if pErr is not NULL, writes a ** diagnostic message there. ** ** Returns true on success. If pRid is not NULL, the RID of the ** resulting manifest is written to *pRid. ** | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
**
** On error, returns false (0) and, if pErr is not NULL, writes a
** diagnostic message there.
**
** Returns true on success. If pRid is not NULL, the RID of the
** resulting manifest is written to *pRid.
**
** The check-in process is largely influenced by pCI->flags, and that
** must be populated before calling this. See the fossil_cimini_flags
** enum for the docs for each flag.
*/
static int checkin_mini(CheckinMiniInfo * pCI, int *pRid, Blob * pErr){
Blob mf = empty_blob; /* output manifest */
int rid = 0, frid = 0; /* various RIDs */
int isPrivate; /* whether this is private content
|
| ︙ | ︙ | |||
492 493 494 495 496 497 498 |
}
if(!file_is_simple_pathname(pCI->zFilename, 1)){
ci_err((pErr,"Invalid filename for use in a repository: %s",
pCI->zFilename));
}
if(!(CIMINI_ALLOW_OLDER & pCI->flags)
&& !checkin_is_younger(pCI->pParent->rid, pCI->zDate)){
| | | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
}
if(!file_is_simple_pathname(pCI->zFilename, 1)){
ci_err((pErr,"Invalid filename for use in a repository: %s",
pCI->zFilename));
}
if(!(CIMINI_ALLOW_OLDER & pCI->flags)
&& !checkin_is_younger(pCI->pParent->rid, pCI->zDate)){
ci_err((pErr,"Check-in time (%s) may not be older "
"than its parent (%z).",
pCI->zDate,
db_text(0, "SELECT strftime('%%Y-%%m-%%dT%%H:%%M:%%f',%lf)",
pCI->pParent->rDate)
));
}
{
|
| ︙ | ︙ | |||
525 526 527 528 529 530 531 |
if(CIMINI_CONVERT_EOL_WINDOWS & pCI->flags) ++n;
if(n>1){
ci_err((pErr,"More than 1 EOL conversion policy was specified."));
}
}
/* Potential TODOs include:
**
| | | | 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
if(CIMINI_CONVERT_EOL_WINDOWS & pCI->flags) ++n;
if(n>1){
ci_err((pErr,"More than 1 EOL conversion policy was specified."));
}
}
/* Potential TODOs include:
**
** - Commit allows an empty check-in only with a flag, but we
** currently disallow an empty check-in entirely. Conform with
** commit?
**
** Non-TODOs:
**
** - Check for a commit lock would require auto-sync, which this
** code cannot do if it's going to be run via a web page.
*/
|
| ︙ | ︙ | |||
702 703 704 705 706 707 708 | ** Options: ** ** -R|--repository REPO The repository file to commit to. ** --as FILENAME The repository-side name of the input ** file, relative to the top of the ** repository. Default is the same as the ** input file name. | | | | | | | | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 | ** Options: ** ** -R|--repository REPO The repository file to commit to. ** --as FILENAME The repository-side name of the input ** file, relative to the top of the ** repository. Default is the same as the ** input file name. ** -m|--comment COMMENT Required check-in comment. ** -M|--comment-file FILE Reads check-in comment from the given file. ** -r|--revision VERSION Commit from this version. Default is ** the check-out version (if available) or ** trunk (if used without a check-out). ** --allow-fork Allows the commit to be made against a ** non-leaf parent. Note that no autosync ** is performed beforehand. ** --allow-merge-conflict Allows check-in of a file even if it ** appears to contain a fossil merge conflict ** marker. ** --user-override USER USER to use instead of the current ** default. ** --date-override DATETIME DATE to use instead of 'now'. ** --allow-older Allow a commit to be older than its ** ancestor. ** --convert-eol-inherit Convert EOL style of the check-in to match ** the previous version's content. ** --convert-eol-unix Convert the EOL style to Unix. ** --convert-eol-windows Convert the EOL style to Windows. ** (only one of the --convert-eol-X options may be used and they only ** modified the saved blob, not the input file.) ** --delta Prefer to generate a delta manifest, if ** able. The forbid-delta-manifests repo |
| ︙ | ︙ | |||
745 746 747 748 749 750 751 |
**
** Example:
**
** %fossil test-ci-mini -R REPO -m ... -r foo --as src/myfile.c myfile.c
**
*/
void test_ci_mini_cmd(void){
| | | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
**
** Example:
**
** %fossil test-ci-mini -R REPO -m ... -r foo --as src/myfile.c myfile.c
**
*/
void test_ci_mini_cmd(void){
CheckinMiniInfo cimi; /* check-in state */
int newRid = 0; /* RID of new version */
const char * zFilename; /* argv[2] */
const char * zComment; /* -m comment */
const char * zCommentFile; /* -M FILE */
const char * zAsFilename; /* --as filename */
const char * zRevision; /* -r|--revision [=trunk|checkout] */
const char * zUser; /* --user-override */
|
| ︙ | ︙ | |||
817 818 819 820 821 822 823 |
}else{
if(zCommentFile && *zCommentFile){
blob_read_from_file(&cimi.comment, zCommentFile, ExtFILE);
}else if(zComment && *zComment){
blob_append(&cimi.comment, zComment, -1);
}
if(!blob_size(&cimi.comment)){
| | | | 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 |
}else{
if(zCommentFile && *zCommentFile){
blob_read_from_file(&cimi.comment, zCommentFile, ExtFILE);
}else if(zComment && *zComment){
blob_append(&cimi.comment, zComment, -1);
}
if(!blob_size(&cimi.comment)){
fossil_fatal("Non-empty check-in comment is required.");
}
}
db_begin_transaction();
zFilename = g.argv[2];
cimi.zFilename = mprintf("%/", zAsFilename ? zAsFilename : zFilename);
cimi.filePerm = file_perm(zFilename, ExtFILE);
cimi.zUser = mprintf("%s", zUser ? zUser : login_name());
if(zDate){
cimi.zDate = mprintf("%s", zDate);
}
if(zRevision==0 || zRevision[0]==0){
if(g.localOpen/*check-out*/){
zRevision = db_lget("checkout-hash", 0)/*leak*/;
}else{
zRevision = "trunk";
}
}
name_to_uuid2(zRevision, "ci", &cimi.zParentUuid);
if(cimi.zParentUuid==0){
|
| ︙ | ︙ | |||
871 872 873 874 875 876 877 |
rid_to_uuid(newRid));
}
db_end_transaction(0/*checkin_mini() will have triggered it to roll
** back in dry-run mode, but we need access to
** the transaction-written db state in this
** routine.*/);
if(!(cimi.flags & CIMINI_DRY_RUN) && newRid!=0 && g.localOpen!=0){
| | | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 |
rid_to_uuid(newRid));
}
db_end_transaction(0/*checkin_mini() will have triggered it to roll
** back in dry-run mode, but we need access to
** the transaction-written db state in this
** routine.*/);
if(!(cimi.flags & CIMINI_DRY_RUN) && newRid!=0 && g.localOpen!=0){
fossil_warning("The check-out state is now out of sync "
"with regards to this commit. It needs to be "
"'update'd or 'close'd and re-'open'ed.");
}
CheckinMiniInfo_cleanup(&cimi);
}
/*
|
| ︙ | ︙ | |||
967 968 969 970 971 972 973 | ** cannot be resolved or is ambiguous, pVid is not assigned. ** ** - *frid = the RID of zFilename's blob content. May not be NULL ** unless zFilename is also NULL. If BOTH of zFilename and frid are ** NULL then no confirmation is done on the filename argument - only ** zRev is checked. ** | | | | | | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 |
** cannot be resolved or is ambiguous, pVid is not assigned.
**
** - *frid = the RID of zFilename's blob content. May not be NULL
** unless zFilename is also NULL. If BOTH of zFilename and frid are
** NULL then no confirmation is done on the filename argument - only
** zRev is checked.
**
** Returns 0 if the given file is not in the given check-in or if
** fileedit_ajax_check_filename() fails, else returns true. If it
** returns false, it queues up an error response and the caller must
** return immediately.
*/
static int fileedit_ajax_setup_filerev(const char * zRev,
char ** zRevUuid,
int * pVid,
const char * zFilename,
int * frid){
char * zFileUuid = 0; /* file content UUID */
const int checkFile = zFilename!=0 || frid!=0;
int vid = 0;
if(checkFile && !fileedit_ajax_check_filename(zFilename)){
return 0;
}
vid = symbolic_name_to_rid(zRev, "ci");
if(0==vid){
ajax_route_error(404,"Cannot resolve name as a check-in: %s",
zRev);
return 0;
}else if(vid<0){
ajax_route_error(400,"Check-in name is ambiguous: %s",
zRev);
return 0;
}else if(pVid!=0){
*pVid = vid;
}
if(checkFile){
zFileUuid = fileedit_file_uuid(zFilename, vid, 0);
if(zFileUuid==0){
ajax_route_error(404, "Check-in does not contain file.");
return 0;
}
}
if(zRevUuid!=0){
*zRevUuid = rid_to_uuid(vid);
}
if(checkFile){
|
| ︙ | ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | ** produces a JSON response as documented for ajax_route_error(). ** ** Extra response headers: ** ** x-fileedit-file-perm: empty or "x" or "l", representing PERM_REG, ** PERM_EXE, or PERM_LINK, respectively. ** | | | 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 |
** produces a JSON response as documented for ajax_route_error().
**
** Extra response headers:
**
** x-fileedit-file-perm: empty or "x" or "l", representing PERM_REG,
** PERM_EXE, or PERM_LINK, respectively.
**
** x-fileedit-checkin-branch: branch name for the passed-in check-in.
*/
static void fileedit_ajax_content(void){
const char * zFilename = 0;
const char * zRev = 0;
int vid, frid;
Blob content = empty_blob;
const char * zMime;
|
| ︙ | ︙ | |||
1085 1086 1087 1088 1089 1090 1091 | /* ** AJAX route /fileedit?ajax=diff ** ** Required query parameters: ** ** filename=FILENAME ** content=text | | | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | /* ** AJAX route /fileedit?ajax=diff ** ** Required query parameters: ** ** filename=FILENAME ** content=text ** checkin=check-in version ** ** Optional parameters: ** ** sbs=integer (1=side-by-side or 0=unified, default=0) ** ** ws=integer (0=diff whitespace, 1=ignore EOL ws, 2=ignore all ws) ** |
| ︙ | ︙ | |||
1153 1154 1155 1156 1157 1158 1159 |
blob_reset(&orig);
}
fossil_free(zRevUuid);
blob_reset(&content);
}
/*
| | | 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 |
blob_reset(&orig);
}
fossil_free(zRevUuid);
blob_reset(&content);
}
/*
** Sets up and validates most, but not all, of p's check-in-related
** state from the CGI environment. Returns 0 on success or a suggested
** HTTP result code on error, in which case a message will have been
** written to pErr.
**
** It always fails if it cannot completely resolve the 'file' and 'r'
** parameters, including verifying that the refer to a real
** file/version combination and editable by the current user. All
|
| ︙ | ︙ | |||
1175 1176 1177 1178 1179 1180 1181 |
**
** Intended to be used only by /filepage and /filepage_commit.
*/
static int fileedit_setup_cimi_from_p(CheckinMiniInfo * p, Blob * pErr,
int * bIsMissingArg){
char * zFileUuid = 0; /* UUID of file content */
const char * zFlag; /* generic flag */
| | | 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 |
**
** Intended to be used only by /filepage and /filepage_commit.
*/
static int fileedit_setup_cimi_from_p(CheckinMiniInfo * p, Blob * pErr,
int * bIsMissingArg){
char * zFileUuid = 0; /* UUID of file content */
const char * zFlag; /* generic flag */
int rc = 0, vid = 0, frid = 0; /* result code, check-in/file rids */
#define fail(EXPR) blob_appendf EXPR; goto end_fail
zFlag = PD("filename",P("fn"));
if(zFlag==0 || !*zFlag){
rc = 400;
if(bIsMissingArg){
*bIsMissingArg = 1;
|
| ︙ | ︙ | |||
1207 1208 1209 1210 1211 1212 1213 |
*bIsMissingArg = 1;
}
fail((pErr,"Missing required 'checkin' parameter."));
}
vid = symbolic_name_to_rid(zFlag, "ci");
if(0==vid){
rc = 404;
| | | | | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 |
*bIsMissingArg = 1;
}
fail((pErr,"Missing required 'checkin' parameter."));
}
vid = symbolic_name_to_rid(zFlag, "ci");
if(0==vid){
rc = 404;
fail((pErr,"Could not resolve check-in version."));
}else if(vid<0){
rc = 400;
fail((pErr,"Check-in name is ambiguous."));
}
p->zParentUuid = rid_to_uuid(vid)/*fully expand it*/;
zFileUuid = fileedit_file_uuid(p->zFilename, vid, &p->filePerm);
if(!zFileUuid){
rc = 404;
fail((pErr,"Check-in [%S] does not contain file: "
"[%h]", p->zParentUuid, p->zFilename));
}else if(PERM_LNK==p->filePerm){
rc = 400;
fail((pErr,"Editing symlinks is not permitted."));
}
/* Find the repo-side file entry or fail... */
|
| ︙ | ︙ | |||
1340 1341 1342 1343 1344 1345 1346 |
}
CX("]");
db_finalize(&q);
}
/*
** For the given fully resolved UUID, renders a JSON object containing
| | | 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
}
CX("]");
db_finalize(&q);
}
/*
** For the given fully resolved UUID, renders a JSON object containing
** the fileeedit-editable files in that check-in:
**
** {
** checkin: UUID,
** editableFiles: [ filename1, ... filenameN ]
** }
**
** They are sorted by name using filename_collation().
|
| ︙ | ︙ | |||
1390 1391 1392 1393 1394 1395 1396 |
** [
** {checkin: UUID, branch: branchName, timestamp: string}
** ]
**
** The entries are ordered newest first.
**
** 'checkin=CHECKIN_NAME': fetch the current list of is-editable files
| | | 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 |
** [
** {checkin: UUID, branch: branchName, timestamp: string}
** ]
**
** The entries are ordered newest first.
**
** 'checkin=CHECKIN_NAME': fetch the current list of is-editable files
** for the current user and given check-in name:
**
** {
** checkin: UUID,
** editableFiles: [ filename1, ... filenameN ] // sorted by name
** }
**
** On error it produces a JSON response as documented for
|
| ︙ | ︙ | |||
1428 1429 1430 1431 1432 1433 1434 | /* ** AJAX route /fileedit?ajax=commit ** ** Required query parameters: ** ** filename=FILENAME | | | 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 | /* ** AJAX route /fileedit?ajax=commit ** ** Required query parameters: ** ** filename=FILENAME ** checkin=Parent check-in UUID ** content=text ** comment=non-empty text ** ** Optional query parameters: ** ** comment_mimetype=text (NOT currently honored) ** |
| ︙ | ︙ | |||
1452 1453 1454 1455 1456 1457 1458 |
** from the input in order to avoid certain race conditions
** client-side):
**
** {
** checkin: newUUID,
** filename: theFilename,
** mimetype: string,
| | | | | 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 |
** from the input in order to avoid certain race conditions
** client-side):
**
** {
** checkin: newUUID,
** filename: theFilename,
** mimetype: string,
** branch: name of the check-in's branch,
** isExe: bool,
** dryRun: bool,
** manifest: text of manifest,
** }
**
** On error it produces a JSON response as documented for
** ajax_route_error().
*/
static void fileedit_ajax_commit(void){
Blob err = empty_blob; /* Error messages */
Blob manifest = empty_blob; /* raw new manifest */
CheckinMiniInfo cimi; /* check-in state */
int rc; /* generic result code */
int newVid = 0; /* new version's RID */
char * zNewUuid = 0; /* newVid's UUID */
char const * zMimetype;
char * zBranch = 0;
if(!ajax_route_bootstrap(1,1)){
return;
}
db_begin_transaction();
CheckinMiniInfo_init(&cimi);
rc = fileedit_setup_cimi_from_p(&cimi, &err, 0);
if(0!=rc){
ajax_route_error(rc,"%b",&err);
goto end_cleanup;
}
if(blob_size(&cimi.comment)==0){
ajax_route_error(400,"Empty check-in comment is not permitted.");
goto end_cleanup;
}
if(0!=atoi(PD("include_manifest","0"))){
cimi.pMfOut = &manifest;
}
checkin_mini(&cimi, &newVid, &err);
if(blob_size(&err)){
|
| ︙ | ︙ | |||
1538 1539 1540 1541 1542 1543 1544 | ** Note that fileedit-glob, by design, is a local-only setting. ** It does not sync across repository clones, and must be explicitly ** set on any repositories where this page should be activated. ** ** Optional query parameters: ** ** filename=FILENAME Repo-relative path to the file. | | | | | | 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 |
** Note that fileedit-glob, by design, is a local-only setting.
** It does not sync across repository clones, and must be explicitly
** set on any repositories where this page should be activated.
**
** Optional query parameters:
**
** filename=FILENAME Repo-relative path to the file.
** checkin=VERSION Check-in version, using any unambiguous
** symbolic version name.
**
** If passed a filename but no check-in then it will attempt to
** load that file from the most recent leaf check-in.
**
** Once the page is loaded, files may be selected from any open leaf
** version. The only way to edit files from non-leaf checkins is to
** pass both the filename and check-in as URL parameters to the page.
** Users with the proper permissions will be presented with "Edit"
** links in various file-specific contexts for files which match the
** fileedit-glob, regardless of whether they refer to leaf versions or
** not.
*/
void fileedit_page(void){
const char * zFileMime = 0; /* File mime type guess */
|
| ︙ | ︙ | |||
2019 2020 2021 2022 2023 2024 2025 |
CX("fossil.config['fileedit-glob'] = ");
glob_render_json_to_cgi(fileedit_glob());
CX(";\n");
if(blob_size(&err)>0){
CX("fossil.error(%!j);\n", blob_str(&err));
}
/* Populate the page with the current leaves and, if available,
| | | 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 |
CX("fossil.config['fileedit-glob'] = ");
glob_render_json_to_cgi(fileedit_glob());
CX(";\n");
if(blob_size(&err)>0){
CX("fossil.error(%!j);\n", blob_str(&err));
}
/* Populate the page with the current leaves and, if available,
the selected check-in's file list, to save 1 or 2 XHR requests
at startup. That makes this page uncacheable, but compressed
delivery of this page is currently less than 6k. */
CX("fossil.page.initialLeaves = ");
fileedit_render_leaves_list(cimi.zParentUuid ? 0 : &zFirstLeafUuid);
CX(";\n");
if(zFirstLeafUuid){
assert(!cimi.zParentUuid);
|
| ︙ | ︙ |
Changes to src/finfo.c.
| ︙ | ︙ | |||
39 40 41 42 43 44 45 | ** option to see similar information about the same file for the check-in ** specified by VERSION. ** ** In the -s mode prints the status as <status> <revision>. This is ** a quick status and does not check for up-to-date-ness of the file. ** ** In the -p mode, there's an optional flag "-r|--revision REVISION". | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** option to see similar information about the same file for the check-in ** specified by VERSION. ** ** In the -s mode prints the status as <status> <revision>. This is ** a quick status and does not check for up-to-date-ness of the file. ** ** In the -p mode, there's an optional flag "-r|--revision REVISION". ** The specified version (or the latest checked-out version) is printed ** to stdout. The -p mode is another form of the "cat" command. ** ** Options: ** -b|--brief Display a brief (one line / revision) summary ** --case-sensitive B Enable or disable case-sensitive filenames. B is a ** boolean: "yes", "no", "true", "false", etc. ** -i|--id Print the artifact ID |
| ︙ | ︙ | |||
76 77 78 79 80 81 82 |
/* We should be done with options.. */
verify_all_options();
if( g.argc!=3 ) usage("-s|--status FILENAME");
vid = db_lget_int("checkout", 0);
if( vid==0 ){
| | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
/* We should be done with options.. */
verify_all_options();
if( g.argc!=3 ) usage("-s|--status FILENAME");
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_fatal("no check-out to finfo files in");
}
vfile_check_signature(vid, CKSIG_ENOTFILE);
file_tree_name(g.argv[2], &fname, 0, 1);
db_prepare(&q,
"SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
" FROM vfile WHERE vfile.pathname=%B %s",
&fname, filename_collation());
|
| ︙ | ︙ | |||
556 557 558 559 560 561 562 |
blob_appendf(&title, " and check-in %z%S</a>", zLink, zUuid);
fossil_free(zUuid);
}
}else if( ridCi ){
blob_appendf(&title, "History of the file that is called ");
hyperlinked_path(zFilename, &title, 0, "tree", "", LINKPATH_FILE);
if( fShowId ) blob_appendf(&title, " (%d)", fnid);
| | | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 |
blob_appendf(&title, " and check-in %z%S</a>", zLink, zUuid);
fossil_free(zUuid);
}
}else if( ridCi ){
blob_appendf(&title, "History of the file that is called ");
hyperlinked_path(zFilename, &title, 0, "tree", "", LINKPATH_FILE);
if( fShowId ) blob_appendf(&title, " (%d)", fnid);
blob_appendf(&title, " at check-in %z%h</a>",
href("%R/info?name=%t",zCI), zCI);
}else{
blob_appendf(&title, "History for ");
hyperlinked_path(zFilename, &title, 0, "tree", "", LINKPATH_FILE);
if( fShowId ) blob_appendf(&title, " (%d)", fnid);
}
if( uBg ){
|
| ︙ | ︙ |
Changes to src/import.c.
| ︙ | ︙ | |||
540 541 542 543 544 545 546 |
}
zName[i] = 0;
}
static struct{
const char *zMasterName; /* Name of master branch */
| | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
}
zName[i] = 0;
}
static struct{
const char *zMasterName; /* Name of master branch */
int authorFlag; /* Use author as check-in committer */
int nGitAttr; /* Number of Git --attribute entries */
struct { /* Git --attribute details */
char *zUser;
char *zEmail;
} *gitUserInfo;
} ggit;
|
| ︙ | ︙ | |||
848 849 850 851 852 853 854 | const char *zTrunk; /* Name of trunk folder in repo root */ int lenTrunk; /* String length of zTrunk */ const char *zBranches; /* Name of branches folder in repo root */ int lenBranches; /* String length of zBranches */ const char *zTags; /* Name of tags folder in repo root */ int lenTags; /* String length of zTags */ Bag newBranches; /* Branches that were created in this revision */ | | | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 |
const char *zTrunk; /* Name of trunk folder in repo root */
int lenTrunk; /* String length of zTrunk */
const char *zBranches; /* Name of branches folder in repo root */
int lenBranches; /* String length of zBranches */
const char *zTags; /* Name of tags folder in repo root */
int lenTags; /* String length of zTags */
Bag newBranches; /* Branches that were created in this revision */
int revFlag; /* Add svn-rev-nn tags on every check-in */
const char *zRevPre; /* Prepended to revision tag names */
const char *zRevSuf; /* Appended to revision tag names */
const char **azIgnTree; /* NULL-terminated list of dirs to ignore */
} gsvn;
typedef struct {
char *zKey;
char *zVal;
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
50 51 52 53 54 55 56 | ** * The record ID ** * mtime and ctime ** * who signed it ** */ void show_common_info( int rid, /* The rid for the check-in to display info for */ | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
** * The record ID
** * mtime and ctime
** * who signed it
**
*/
void show_common_info(
int rid, /* The rid for the check-in to display info for */
const char *zRecDesc, /* Brief record description; e.g. "check-out:" */
int showComment, /* True to show the check-in comment */
int showFamily /* True to show parents and children */
){
Stmt q;
char *zComment = 0;
char *zTags;
char *zDate;
|
| ︙ | ︙ | |||
182 183 184 185 186 187 188 | ** ** If the argument is a repository name, then the --verbose option shows ** all known check-out locations for that repository and all URLs used ** to access the repository. The --verbose is (currently) a no-op if ** the argument is the name of an object within the repository. ** ** Use the "finfo" command to get information about a specific | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | ** ** If the argument is a repository name, then the --verbose option shows ** all known check-out locations for that repository and all URLs used ** to access the repository. The --verbose is (currently) a no-op if ** the argument is the name of an object within the repository. ** ** Use the "finfo" command to get information about a specific ** file in a check-out. ** ** Options: ** ** -R|--repository REPO Extract info from repository REPO ** -v|--verbose Show extra information about repositories ** ** See also: [[annotate]], [[artifact]], [[finfo]], [[timeline]] |
| ︙ | ︙ | |||
363 364 365 366 367 368 369 | } /* ** Write a line of web-page output that shows changes that have occurred ** to a file between two check-ins. */ static void append_file_change_line( | | | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
}
/*
** Write a line of web-page output that shows changes that have occurred
** to a file between two check-ins.
*/
static void append_file_change_line(
const char *zCkin, /* The check-in on which the change occurs */
const char *zName, /* Name of the file that has changed */
const char *zOld, /* blob.uuid before change. NULL for added files */
const char *zNew, /* blob.uuid after change. NULL for deletes */
const char *zOldName, /* Prior name. NULL if no name change. */
DiffConfig *pCfg, /* Flags for text_diff() or NULL to omit all */
int mperm /* executable or symlink permission for zNew */
){
|
| ︙ | ︙ | |||
817 818 819 820 821 822 823 |
&& ((okWiki = wiki_tagid2("checkin",zUuid))!=0 ||
blob_size(&wiki_read_links)>0)
&& db_get_boolean("wiki-about",1)
){
const char *zLinks = blob_str(&wiki_read_links);
@ <tr><th>Edit Wiki:</th><td>\
if( okWiki ){
| | | | 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 |
&& ((okWiki = wiki_tagid2("checkin",zUuid))!=0 ||
blob_size(&wiki_read_links)>0)
&& db_get_boolean("wiki-about",1)
){
const char *zLinks = blob_str(&wiki_read_links);
@ <tr><th>Edit Wiki:</th><td>\
if( okWiki ){
@ %z(href("%R/wikiedit?name=checkin/%s",zUuid))this check-in</a>\
}else if( zLinks[0] ){
zLinks += 3;
}
@ %s(zLinks)</td></tr>
}
/* Only show links to create new wiki pages if the users can write wiki
** and if the wiki pages do not already exist */
if( g.perm.WrWiki
&& g.perm.RdWiki
&& g.perm.Write
&& (blob_size(&wiki_add_links)>0 || !okWiki)
&& db_get_boolean("wiki-about",1)
){
const char *zLinks = blob_str(&wiki_add_links);
@ <tr><th>Add Wiki:</th><td>\
if( !okWiki ){
@ %z(href("%R/wikiedit?name=checkin/%s",zUuid))this check-in</a>\
}else if( zLinks[0] ){
zLinks += 3;
}
@ %s(zLinks)</td></tr>
}
if( g.perm.Hyperlink ){
|
| ︙ | ︙ | |||
3804 3805 3806 3807 3808 3809 3810 | ** Usage: %fossil describe ?VERSION? ?OPTIONS? ** ** Provide a description of the given VERSION by showing a non-propagating ** tag of the youngest tagged ancestor, followed by the number of commits ** since that, and the short hash of VERSION. Only tags applied to a single ** check-in are considered. ** | | | 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 | ** Usage: %fossil describe ?VERSION? ?OPTIONS? ** ** Provide a description of the given VERSION by showing a non-propagating ** tag of the youngest tagged ancestor, followed by the number of commits ** since that, and the short hash of VERSION. Only tags applied to a single ** check-in are considered. ** ** If no VERSION is provided, describe the currently checked-out version. ** ** If VERSION and the found ancestor refer to the same commit, the last two ** components are omitted, unless --long is provided. When no fitting tagged ** ancestor is found, show only the short hash of VERSION. ** ** Options: ** |
| ︙ | ︙ | |||
3846 3847 3848 3849 3850 3851 3852 |
if( g.argc<3 ){
zName = "current";
}else{
zName = g.argv[2];
}
if( bDirtyFlag ){
| | | 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 |
if( g.argc<3 ){
zName = "current";
}else{
zName = g.argv[2];
}
if( bDirtyFlag ){
if ( g.argc>=3 ) fossil_fatal("cannot use --dirty with specific check-in");
}
switch( describe_commit(zName, zMatchGlob, &descr) ){
case -1:
fossil_fatal("commit %s does not exist", zName);
break;
case -2:
|
| ︙ | ︙ |
Changes to src/json.c.
| ︙ | ︙ | |||
152 153 154 155 156 157 158 |
C(STMT_PREP,"Statement preparation failed");
C(STMT_BIND,"Statement parameter binding failed");
C(STMT_EXEC,"Statement execution/stepping failed");
C(DB_LOCKED,"Database is locked");
C(DB_NEEDS_REBUILD,"Fossil repository needs to be rebuilt");
C(DB_NOT_FOUND,"Fossil repository db file could not be found.");
C(DB_NOT_VALID, "Fossil repository db file is not valid.");
| | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
C(STMT_PREP,"Statement preparation failed");
C(STMT_BIND,"Statement parameter binding failed");
C(STMT_EXEC,"Statement execution/stepping failed");
C(DB_LOCKED,"Database is locked");
C(DB_NEEDS_REBUILD,"Fossil repository needs to be rebuilt");
C(DB_NOT_FOUND,"Fossil repository db file could not be found.");
C(DB_NOT_VALID, "Fossil repository db file is not valid.");
C(DB_NEEDS_CHECKOUT, "Command requires a local check-out.");
#undef C
default:
return "Unknown Error";
}
}
/*
|
| ︙ | ︙ |
Changes to src/login.c.
| ︙ | ︙ | |||
2123 2124 2125 2126 2127 2128 2129 | ** Usage: %fossil login-group ?SUBCOMMAND? ?OPTIONS? ** ** Run various subcommands to manage login-group related settings of the open ** repository or of the repository identified by the -R or --repository option. ** ** > fossil login-group ?-R REPO? ** | | | | | | | 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 | ** Usage: %fossil login-group ?SUBCOMMAND? ?OPTIONS? ** ** Run various subcommands to manage login-group related settings of the open ** repository or of the repository identified by the -R or --repository option. ** ** > fossil login-group ?-R REPO? ** ** Show the login-group to which REPO, or if invoked from within a check-out ** the repository on which the current check-out is based, belongs. ** ** > fossil login-group join ?-R? REPO ?--name NAME? ** ** This subcommand must be invoked from within a check-out to either: add ** the open repository to the login group that REPO is a member, in which ** case the optional "--name" argument is not required; or create a new ** login group between the open repository and REPO, in which case the new ** group NAME is determined by the mandatory "--name" option. REPO may be ** specified with or without the -R flag. ** ** > fossil login-group leave ?-R REPO? ** ** Take the repository REPO, or if invoked from within a check-out the ** repository on which the current check-out is based, out of whatever ** login group it is a member. ** ** About Login Groups: ** ** A login-group is a set of repositories that share user credentials. ** If a user is logged into one member of the group, then that user can ** access any other group member as long as they have an entry in the USER |
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
2973 2974 2975 2976 2977 2978 2979 | ** Usage: %fossil server ?OPTIONS? ?REPOSITORY? ** or: %fossil ui ?OPTIONS? ?REPOSITORY? ** ** Open a socket and begin listening and responding to HTTP requests on ** TCP port 8080, or on any other TCP port defined by the -P or ** --port option. The optional REPOSITORY argument is the name of the ** Fossil repository to be served. The REPOSITORY argument may be omitted | | | | | 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 | ** Usage: %fossil server ?OPTIONS? ?REPOSITORY? ** or: %fossil ui ?OPTIONS? ?REPOSITORY? ** ** Open a socket and begin listening and responding to HTTP requests on ** TCP port 8080, or on any other TCP port defined by the -P or ** --port option. The optional REPOSITORY argument is the name of the ** Fossil repository to be served. The REPOSITORY argument may be omitted ** if the working directory is within an open check-out, in which case the ** repository associated with that check-out is used. ** ** The "ui" command automatically starts a web browser after initializing ** the web server. The "ui" command also binds to 127.0.0.1 and so will ** only process HTTP traffic from the local machine. ** ** If REPOSITORY is a directory name which is the root of a ** check-out, then use the repository associated with that check-out. ** This only works for the "fossil ui" command, not the "fossil server" ** command. ** ** If REPOSITORY begins with a "HOST:" or "USER@HOST:" prefix, then ** the command is run on the remote host specified and the results are ** tunneled back to the local machine via SSH. This feature only works for ** the "fossil ui" command, not the "fossil server" command. |
| ︙ | ︙ | |||
3176 3177 3178 3179 3180 3181 3182 |
verify_all_options();
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
if( g.httpUseSSL && (flags & HTTP_SERVER_SCGI)!=0 ){
fossil_fatal("SCGI does not (yet) support TLS-encrypted connections");
}
if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
| | | | 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 |
verify_all_options();
if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
if( g.httpUseSSL && (flags & HTTP_SERVER_SCGI)!=0 ){
fossil_fatal("SCGI does not (yet) support TLS-encrypted connections");
}
if( isUiCmd && 3==g.argc && file_isdir(g.argv[2], ExtFILE)>0 ){
/* If REPOSITORY arg is the root of a check-out,
** chdir to that check-out so that the current version
** gets highlighted in the timeline by default. */
const char * zDir = g.argv[2];
if(dir_has_ckout_db(zDir)){
if(0!=file_chdir(zDir, 0)){
fossil_fatal("Cannot chdir to %s", zDir);
}
findServerArg = 99;
|
| ︙ | ︙ |
Changes to src/manifest.c.
| ︙ | ︙ | |||
1932 1933 1934 1935 1936 1937 1938 |
isPublic, 1, manifest_file_mperm(&p->aFile[i]));
}
}
return parentid;
}
/*
| | | 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 |
isPublic, 1, manifest_file_mperm(&p->aFile[i]));
}
}
return parentid;
}
/*
** There exists a "parent" tag against check-in rid that has value zValue.
** If value is well-formed (meaning that it is a list of hashes), then use
** zValue to reparent check-in rid.
*/
void manifest_reparent_checkin(int rid, const char *zValue){
int nParent = 0;
char *zCopy = 0;
char **azParent = 0;
|
| ︙ | ︙ |
Changes to src/merge.c.
| ︙ | ︙ | |||
133 134 135 136 137 138 139 | /* ** Add an entry to the FV table for all files renamed between ** version N and the version specified by vid. */ static void add_renames( const char *zFnCol, /* The FV column for the filename in vid */ | | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
/*
** Add an entry to the FV table for all files renamed between
** version N and the version specified by vid.
*/
static void add_renames(
const char *zFnCol, /* The FV column for the filename in vid */
int vid, /* The desired version's- RID */
int nid, /* The check-in rid for the name pivot */
int revOK, /* OK to move backwards (child->parent) if true */
const char *zDebug /* Generate trace output if not NULL */
){
int nChng; /* Number of file name changes */
int *aChng; /* An array of file name changes */
int i; /* Loop counter */
find_filename_changes(nid, vid, revOK, &nChng, &aChng, zDebug);
|
| ︙ | ︙ | |||
277 278 279 280 281 282 283 | /* ** COMMAND: merge ** COMMAND: cherry-pick ** ** Usage: %fossil merge ?OPTIONS? ?VERSION? ** ** The argument VERSION is a version that should be merged into the | | | | | | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | /* ** COMMAND: merge ** COMMAND: cherry-pick ** ** Usage: %fossil merge ?OPTIONS? ?VERSION? ** ** The argument VERSION is a version that should be merged into the ** current check-out. All changes from VERSION back to the nearest ** common ancestor are merged. Except, if either of the --cherrypick or ** --backout options are used only the changes associated with the ** single check-in VERSION are merged. The --backout option causes ** the changes associated with VERSION to be removed from the current ** check-out rather than added. When invoked with the name cherry-pick, ** this command works exactly like merge --cherrypick. ** ** If the VERSION argument is omitted, then Fossil attempts to find ** a recent fork on the current branch to merge. ** ** Only file content is merged. The result continues to use the ** file and directory names from the current check-out even if those ** names might have been changed in the branch being merged in. ** ** Options: ** ** --backout Do a reverse cherrypick merge against VERSION. ** In other words, back out the changes that were ** added by VERSION. ** ** --baseline BASELINE Use BASELINE as the "pivot" of the merge instead ** of the nearest common ancestor. This allows ** a sequence of changes in a branch to be merged ** without having to merge the entire branch. ** ** --binary GLOBPATTERN Treat files that match GLOBPATTERN as binary ** and do not try to merge parallel changes. This ** option overrides the "binary-glob" setting. ** ** --cherrypick Do a cherrypick merge VERSION into the current ** check-out. A cherrypick merge pulls in the changes ** of the single check-in VERSION, rather than all ** changes back to the nearest common ancestor. ** ** -f|--force Force the merge even if it would be a no-op. ** ** --force-missing Force the merge even if there is missing content. ** |
| ︙ | ︙ | |||
351 352 353 354 355 356 357 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */ Stmt q; /* Notation: ** | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
int nOverwrite = 0; /* Number of unmanaged files overwritten */
char vAncestor = 'p'; /* If P is an ancestor of V then 'p', else 'n' */
Stmt q;
/* Notation:
**
** V The current check-out
** M The version being merged in
** P The "pivot" - the most recent common ancestor of V and M.
** N The "name pivot" - for detecting renames
*/
undo_capture_command_line();
verboseFlag = find_option("verbose","v",0)!=0;
|
| ︙ | ︙ | |||
421 422 423 424 425 426 427 |
mid = name_to_typed_rid(g.argv[2], "ci");
if( mid==0 || !is_a_version(mid) ){
fossil_fatal("not a version: %s", g.argv[2]);
}
}else if( g.argc==2 ){
/* No version specified on the command-line so pick the most recent
** leaf that is (1) not the version currently checked out and (2)
| | | | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
mid = name_to_typed_rid(g.argv[2], "ci");
if( mid==0 || !is_a_version(mid) ){
fossil_fatal("not a version: %s", g.argv[2]);
}
}else if( g.argc==2 ){
/* No version specified on the command-line so pick the most recent
** leaf that is (1) not the version currently checked out and (2)
** has not already been merged into the current check-out and (3)
** the leaf is not closed and (4) the leaf is in the same branch
** as the current check-out.
*/
Stmt q;
if( pickFlag || backoutFlag || integrateFlag){
fossil_fatal("cannot use --backout, --cherrypick or --integrate "
"with a fork merge");
}
mid = fossil_find_nearest_fork(vid, db_open_local(0));
|
| ︙ | ︙ | |||
490 491 492 493 494 495 496 |
while( db_step(&q)==SQLITE_ROW ){
pivot_set_secondary(db_column_int(&q,0));
}
db_finalize(&q);
pid = pivot_find(0);
if( pid<=0 ){
fossil_fatal("cannot find a common ancestor between the current "
| | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
while( db_step(&q)==SQLITE_ROW ){
pivot_set_secondary(db_column_int(&q,0));
}
db_finalize(&q);
pid = pivot_find(0);
if( pid<=0 ){
fossil_fatal("cannot find a common ancestor between the current "
"check-out and %s", g.argv[2]);
}
}
pivot_set_primary(mid);
pivot_set_secondary(vid);
nid = pivot_find(1);
if( nid!=pid ){
pivot_set_primary(nid);
|
| ︙ | ︙ | |||
569 570 571 572 573 574 575 |
fossil_print("vAncestor = '%c'\n", vAncestor);
}
if( showVfileFlag ) debug_show_vfile();
/*
** The vfile.pathname field is used to match files against each other. The
** FV table contains one row for each each unique filename in
| | | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
fossil_print("vAncestor = '%c'\n", vAncestor);
}
if( showVfileFlag ) debug_show_vfile();
/*
** The vfile.pathname field is used to match files against each other. The
** FV table contains one row for each each unique filename in
** in the current check-out, the pivot, and the version being merged.
*/
db_multi_exec(
"DROP TABLE IF EXISTS fv;"
"CREATE TEMP TABLE fv(\n"
" fn TEXT UNIQUE %s,\n" /* The filename */
" idv INTEGER DEFAULT 0,\n" /* VFILE entry for current version */
" idp INTEGER DEFAULT 0,\n" /* VFILE entry for the pivot */
|
| ︙ | ︙ |
Changes to src/name.c.
| ︙ | ︙ | |||
263 264 265 266 267 268 269 | ** The following modifier prefixes may be applied to the above forms: ** ** * "root:BR" = The origin of the branch named BR. ** * "start:BR" = The first check-in of the branch named BR. ** * "merge-in:BR" = The most recent merge-in for the branch named BR. ** ** In those forms, BR may be any symbolic form but is assumed to be a | | | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | ** The following modifier prefixes may be applied to the above forms: ** ** * "root:BR" = The origin of the branch named BR. ** * "start:BR" = The first check-in of the branch named BR. ** * "merge-in:BR" = The most recent merge-in for the branch named BR. ** ** In those forms, BR may be any symbolic form but is assumed to be a ** check-in. Thus root:2021-02-01 would resolve to a check-in, possibly ** in a branch and possibly in the trunk, but never a wiki edit or ** forum post. ** ** Return the RID of the matching artifact. Or return 0 if the name does not ** match any known object. Or return -1 if the name is ambiguous. ** ** The zType parameter specifies the type of artifact: ci, t, w, e, g, f. |
| ︙ | ︙ | |||
1148 1149 1150 1151 1152 1153 1154 | */ static const char zDescTab[] = @ CREATE TEMP TABLE IF NOT EXISTS description( @ rid INTEGER PRIMARY KEY, -- RID of the object @ uuid TEXT, -- hash of the object @ ctime DATETIME, -- Time of creation @ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts | | | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | */ static const char zDescTab[] = @ CREATE TEMP TABLE IF NOT EXISTS description( @ rid INTEGER PRIMARY KEY, -- RID of the object @ uuid TEXT, -- hash of the object @ ctime DATETIME, -- Time of creation @ isPrivate BOOLEAN DEFAULT 0, -- True for unpublished artifacts @ type TEXT, -- file, check-in, wiki, ticket, etc. @ rcvid INT, -- When the artifact was received @ summary TEXT, -- Summary comment for the object @ ref TEXT -- hash of an object to link against @ ); @ CREATE INDEX IF NOT EXISTS desctype @ ON description(summary) WHERE summary='unknown'; ; |
| ︙ | ︙ |
Changes to src/patch.c.
| ︙ | ︙ | |||
46 47 48 49 50 51 52 | */ #define PATCH_DRYRUN 0x0001 #define PATCH_VERBOSE 0x0002 #define PATCH_FORCE 0x0004 /* ** Implementation of the "readfile(X)" SQL function. The entire content | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
*/
#define PATCH_DRYRUN 0x0001
#define PATCH_VERBOSE 0x0002
#define PATCH_FORCE 0x0004
/*
** Implementation of the "readfile(X)" SQL function. The entire content
** of the check-out file named X is read and returned as a BLOB.
*/
static void readfileFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
const char *zName;
|
| ︙ | ︙ | |||
373 374 375 376 377 378 379 |
void patch_apply(unsigned mFlags){
Stmt q;
Blob cmd;
blob_init(&cmd, 0, 0);
if( unsaved_changes(0) ){
if( (mFlags & PATCH_FORCE)==0 ){
| | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
void patch_apply(unsigned mFlags){
Stmt q;
Blob cmd;
blob_init(&cmd, 0, 0);
if( unsaved_changes(0) ){
if( (mFlags & PATCH_FORCE)==0 ){
fossil_fatal("there are unsaved changes in the current check-out");
}else{
blob_appendf(&cmd, "%$ revert", g.nameOfExe);
if( mFlags & PATCH_DRYRUN ){
fossil_print("%s\n", blob_str(&cmd));
}else{
int rc = fossil_system(blob_str(&cmd));
if( rc ){
|
| ︙ | ︙ |
Changes to src/pikchrshow.c.
| ︙ | ︙ | |||
565 566 567 568 569 570 571 | ** ** ** The -div-indent/center/left/right flags may not be combined. ** ** TH1-related Notes and Caveats: ** ** If the -th flag is used, this command must open a fossil database | | | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | ** ** ** The -div-indent/center/left/right flags may not be combined. ** ** TH1-related Notes and Caveats: ** ** If the -th flag is used, this command must open a fossil database ** for certain functionality to work (via a check-out or the -R REPO ** flag). If opening a db fails, execution will continue but any TH1 ** commands which require a db will trigger a fatal error. ** ** In Fossil skins, TH1 variables in the form $varName are expanded ** as-is and those in the form $<varName> are htmlized in the ** resulting output. This processor disables the htmlizing step, so $x ** and $<x> are equivalent unless the TH1-processed pikchr script |
| ︙ | ︙ |
Changes to src/pivot.c.
| ︙ | ︙ | |||
28 29 30 31 32 33 34 | ** Set the primary file. The primary version is one of the two ** files that have a common ancestor. The other file is the secondary. ** There can be multiple secondaries but only a single primary. ** The primary must be set first. ** ** In the merge algorithm, the file being merged in is the primary. ** The current check-out or other files that have been merged into | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
** Set the primary file. The primary version is one of the two
** files that have a common ancestor. The other file is the secondary.
** There can be multiple secondaries but only a single primary.
** The primary must be set first.
**
** In the merge algorithm, the file being merged in is the primary.
** The current check-out or other files that have been merged into
** the current check-out are the secondaries.
**
** The act of setting the primary resets the pivot-finding algorithm.
*/
void pivot_set_primary(int rid){
/* Set up table used to do the search */
db_multi_exec(
"CREATE TEMP TABLE IF NOT EXISTS aqueue("
|
| ︙ | ︙ | |||
154 155 156 157 158 159 160 | } /* ** COMMAND: merge-base ** ** Usage: %fossil merge-base ?options? PRIMARY SECONDARY ... ** | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
}
/*
** COMMAND: merge-base
**
** Usage: %fossil merge-base ?options? PRIMARY SECONDARY ...
**
** Find a common ancestor given two or more check-in versions to
** hypothetically merge.
**
** Options:
** --ignore-merges Ignore merges for discovering name pivots
*/
void merge_base_cmd(void){
int i, rid;
|
| ︙ | ︙ |
Changes to src/purge.c.
| ︙ | ︙ | |||
558 559 560 561 562 563 564 |
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
for(i=3; i<g.argc; i++){
int r = name_to_typed_rid(g.argv[i], "br");
compute_descendants(r, 1000000000);
}
vid = db_lget_int("checkout",0);
if( db_exists("SELECT 1 FROM ok WHERE rid=%d",vid) ){
| | | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 |
db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)");
for(i=3; i<g.argc; i++){
int r = name_to_typed_rid(g.argv[i], "br");
compute_descendants(r, 1000000000);
}
vid = db_lget_int("checkout",0);
if( db_exists("SELECT 1 FROM ok WHERE rid=%d",vid) ){
fossil_fatal("cannot purge the current check-out");
}
find_checkin_associates("ok", 1);
purge_artifact_list("ok", "", purgeFlags);
db_end_transaction(0);
}else if( strncmp(zSubcmd, "files", n)==0 ){
verify_all_options();
db_begin_transaction();
|
| ︙ | ︙ |
Changes to src/schema.c.
| ︙ | ︙ | |||
520 521 522 523 524 525 526 | # define TAG_PARENT 10 /* Change to parentage on a check-in */ # define TAG_NOTE 11 /* Extra text appended to a check-in comment */ #endif /* ** The schema for the local FOSSIL database file found at the root ** of every check-out. This database contains the complete state of | | | | | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 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 568 | # define TAG_PARENT 10 /* Change to parentage on a check-in */ # define TAG_NOTE 11 /* Extra text appended to a check-in comment */ #endif /* ** The schema for the local FOSSIL database file found at the root ** of every check-out. This database contains the complete state of ** the check-out. See also the addendum in zLocalSchemaVmerge[]. */ const char zLocalSchema[] = @ -- The VVAR table holds miscellanous information about the local database @ -- in the form of name-value pairs. This is similar to the VAR table @ -- table in the repository except that this table holds information that @ -- is specific to the local check-out. @ -- @ -- Important Variables: @ -- @ -- repository Full pathname of the repository database @ -- user-id Userid to use @ -- @ CREATE TABLE vvar( @ name TEXT PRIMARY KEY NOT NULL, -- Primary name of the entry @ value CLOB, -- Content of the named parameter @ CHECK( typeof(name)='text' AND length(name)>=1 ) @ ); @ @ -- Each entry in the vfile table represents a single file in the @ -- current check-out. @ -- @ -- The file.rid field is 0 for files or folders that have been @ -- added but not yet committed. @ -- @ -- Vfile.chnged meaning: @ -- 0 File is unmodified @ -- 1 Manually edited and/or modified as part of a merge command @ -- 2 Replaced by a merge command @ -- 3 Added by a merge command @ -- 4,5 Same as 2,3 except merge using --integrate @ -- @ CREATE TABLE vfile( @ id INTEGER PRIMARY KEY, -- ID of the checked-out file @ vid INTEGER REFERENCES blob, -- The check-in this file is part of. @ chnged INT DEFAULT 0, -- 0:unchng 1:edit 2:m-chng 3:m-add 4:i-chng 5:i-add @ deleted BOOLEAN DEFAULT 0, -- True if deleted @ isexe BOOLEAN, -- True if file should be executable @ islink BOOLEAN, -- True if file should be symlink @ rid INTEGER, -- Originally from this repository record @ mrid INTEGER, -- Based on this record due to a merge @ mtime INTEGER, -- Mtime of file on disk. sec since 1970 |
| ︙ | ︙ | |||
603 604 605 606 607 608 609 | @ -- vmerge table. This must be done with a trigger, since legacy Fossil @ -- uses INSERT OR IGNORE to update vmerge, and the OR IGNORE will cause @ -- a NOT NULL constraint to be silently ignored. @ @ CREATE TRIGGER vmerge_ck1 AFTER INSERT ON vmerge @ WHEN new.mhash IS NULL BEGIN @ SELECT raise(FAIL, | | | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | @ -- vmerge table. This must be done with a trigger, since legacy Fossil @ -- uses INSERT OR IGNORE to update vmerge, and the OR IGNORE will cause @ -- a NOT NULL constraint to be silently ignored. @ @ CREATE TRIGGER vmerge_ck1 AFTER INSERT ON vmerge @ WHEN new.mhash IS NULL BEGIN @ SELECT raise(FAIL, @ 'trying to update a newer check-out with an older version of Fossil'); @ END; @ ; /* ** The following table holds information about forum posts. It ** is created on-demand whenever the manifest parser encounters |
| ︙ | ︙ |
Changes to src/setup.c.
| ︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 |
@ <input type="submit" name="submit" value="Apply Changes" /></p>
@ <hr />
onoff_attribute("Associate Wiki Pages With Branches, Tags, or Checkins",
"wiki-about", "wiki-about", 1, 0);
@ <p>
@ Associate wiki pages with branches, tags, or checkins, based on
@ the wiki page name. Wiki pages that begin with "branch/", "checkin/"
| | | | 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 |
@ <input type="submit" name="submit" value="Apply Changes" /></p>
@ <hr />
onoff_attribute("Associate Wiki Pages With Branches, Tags, or Checkins",
"wiki-about", "wiki-about", 1, 0);
@ <p>
@ Associate wiki pages with branches, tags, or checkins, based on
@ the wiki page name. Wiki pages that begin with "branch/", "checkin/"
@ or "tag/" and which continue with the name of an existing branch, check-in
@ or tag are treated specially when this feature is enabled.
@ <ul>
@ <li> <b>branch/</b><i>branch-name</i>
@ <li> <b>checkin/</b><i>full-check-in-hash</i>
@ <li> <b>tag/</b><i>tag-name</i>
@ </ul>
@ (Property: "wiki-about")</p>
@ <hr />
entry_attribute("Allow Unsafe HTML In Markdown", 6,
"safe-html", "safe-html", "", 0);
@ <p>Allow "unsafe" HTML (ex: <script>, <form>, etc) to be
|
| ︙ | ︙ |
Changes to src/stash.c.
| ︙ | ︙ | |||
254 255 256 257 258 259 260 |
**
** If files are named on the command-line, then only stash the named
** files.
*/
static int stash_create(void){
const char *zComment; /* Comment to add to the stash */
int stashid; /* ID of the new stash */
| | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
**
** If files are named on the command-line, then only stash the named
** files.
*/
static int stash_create(void){
const char *zComment; /* Comment to add to the stash */
int stashid; /* ID of the new stash */
int vid; /* Current check-out */
zComment = find_option("comment", "m", 1);
verify_all_options();
if( zComment==0 ){
Blob prompt; /* Prompt for stash comment */
Blob comment; /* User comment reply */
#if defined(_WIN32) || defined(__CYGWIN__)
|
| ︙ | ︙ | |||
299 300 301 302 303 304 305 |
}else{
stash_add_file_or_dir(stashid, vid, g.zLocalRoot);
}
return stashid;
}
/*
| | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
}else{
stash_add_file_or_dir(stashid, vid, g.zLocalRoot);
}
return stashid;
}
/*
** Apply a stash to the current check-out.
*/
static void stash_apply(int stashid, int nConflict){
int vid;
Stmt q;
db_prepare(&q,
"SELECT blob.rid, isRemoved, isExec, isLink, origname, newname, delta"
" FROM stashfile, blob WHERE stashid=%d AND blob.uuid=stashfile.hash"
|
| ︙ | ︙ | |||
511 512 513 514 515 516 517 | ** > fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? ** ** Save the current changes in the working tree as a new stash. ** Then revert the changes back to the last check-in. If FILES ** are listed, then only stash and revert the named files. The ** "save" verb can be omitted if and only if there are no other ** arguments. The "snapshot" verb works the same as "save" but | | | | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | ** > fossil stash snapshot ?-m|--comment COMMENT? ?FILES...? ** ** Save the current changes in the working tree as a new stash. ** Then revert the changes back to the last check-in. If FILES ** are listed, then only stash and revert the named files. The ** "save" verb can be omitted if and only if there are no other ** arguments. The "snapshot" verb works the same as "save" but ** omits the revert, keeping the check-out unchanged. ** ** > fossil stash list|ls ?-v|--verbose? ?-W|--width NUM? ** ** List all changes sets currently stashed. Show information about ** individual files in each changeset if -v or --verbose is used. ** ** > fossil stash show|cat ?STASHID? ?DIFF-OPTIONS? ** > fossil stash gshow|gcat ?STASHID? ?DIFF-OPTIONS? ** ** Show the contents of a stash as a diff against its baseline. ** With gshow and gcat, gdiff-command is used instead of internal ** diff logic. ** ** > fossil stash pop ** > fossil stash apply ?STASHID? ** ** Apply STASHID or the most recently created stash to the current ** working check-out. The "pop" command deletes that changeset from ** the stash after applying it but the "apply" command retains the ** changeset. ** ** > fossil stash goto ?STASHID? ** ** Update to the baseline check-out for STASHID then apply the ** changes of STASHID. Keep STASHID so that it can be reused ** This command is undoable. ** ** > fossil stash drop|rm ?STASHID? ?-a|--all? ** ** Forget everything about STASHID. Forget the whole stash if the ** -a|--all flag is used. Individual drops are undoable but -a|--all |
| ︙ | ︙ |
Changes to src/sync.c.
| ︙ | ︙ | |||
103 104 105 106 107 108 109 | /* ** If the repository is configured for autosyncing, then do an ** autosync. Bits of the "flags" parameter determine details of behavior: ** ** SYNC_PULL Pull content from the server to the local repo ** SYNC_PUSH Push content from local up to the server | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | /* ** If the repository is configured for autosyncing, then do an ** autosync. Bits of the "flags" parameter determine details of behavior: ** ** SYNC_PULL Pull content from the server to the local repo ** SYNC_PUSH Push content from local up to the server ** SYNC_CKIN_LOCK Take a check-in lock on the current check-out. ** SYNC_VERBOSE Extra output ** ** Return the number of errors. ** ** The autosync setting can be a boolean or "pullonly". No autosync ** is attempted if the autosync setting is off, and only auto-pull is ** attempted if autosync is set to "pullonly". The check-in lock is |
| ︙ | ︙ | |||
510 511 512 513 514 515 516 | ** ** > fossil remote delete NAME ** ** Delete a named URL previously created by the "add" subcommand. ** ** > fossil remote hyperlink ?FILENAME? ?LINENUM? ?LINENUM? ** | | | | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | ** ** > fossil remote delete NAME ** ** Delete a named URL previously created by the "add" subcommand. ** ** > fossil remote hyperlink ?FILENAME? ?LINENUM? ?LINENUM? ** ** Print a URL that will access the current check-out on the remote ** repository. Or if the FILENAME argument is included, print the ** URL to access that particular file within the current check-out. ** If one or two linenumber arguments are provided after the filename, ** then the URL is for the line or range of lines specified. ** ** > fossil remote list|ls ** ** Show all remote repository URLs. ** |
| ︙ | ︙ | |||
544 545 546 547 548 549 550 | ** Forget any saved passwords for remote repositories, but continue ** to remember the URLs themselves. You will be prompted for the ** password the next time it is needed. ** ** > fossil remote ui ?FILENAME? ?LINENUM? ?LINENUM? ** ** Bring up a web browser pointing at the remote repository, and | | | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | ** Forget any saved passwords for remote repositories, but continue ** to remember the URLs themselves. You will be prompted for the ** password the next time it is needed. ** ** > fossil remote ui ?FILENAME? ?LINENUM? ?LINENUM? ** ** Bring up a web browser pointing at the remote repository, and ** specifically to the page that describes the current check-out ** on that remote repository. Or if FILENAME and/or LINENUM arguments ** are provided, to the specific file and range of lines. This ** command is similar to "fossil remote hyperlink" except that instead ** of printing the URL, it passes the URL off to the web browser. ** ** > fossil remote REF ** |
| ︙ | ︙ | |||
814 815 816 817 818 819 820 | ** ** Make a backup of the repository into the named file or into the named ** directory. This backup is guaranteed to be consistent even if there are ** concurrent changes taking place on the repository. In other words, it ** is safe to run "fossil backup" on a repository that is in active use. ** ** Only the main repository database is backed up by this command. The | | | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 | ** ** Make a backup of the repository into the named file or into the named ** directory. This backup is guaranteed to be consistent even if there are ** concurrent changes taking place on the repository. In other words, it ** is safe to run "fossil backup" on a repository that is in active use. ** ** Only the main repository database is backed up by this command. The ** open check-out file (if any) is not saved. Nor is the global configuration ** database. ** ** Options: ** ** --overwrite OK to overwrite an existing file ** -R NAME Filename of the repository to backup */ |
| ︙ | ︙ |
Changes to src/tag.c.
| ︙ | ︙ | |||
393 394 395 396 397 398 399 | ** Usage: %fossil tag SUBCOMMAND ... ** ** Run various subcommands to control tags and properties. ** ** > fossil tag add ?OPTIONS? TAGNAME ARTIFACT-ID ?VALUE? ** ** Add a new tag or property to an artifact referenced by | | | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | ** Usage: %fossil tag SUBCOMMAND ... ** ** Run various subcommands to control tags and properties. ** ** > fossil tag add ?OPTIONS? TAGNAME ARTIFACT-ID ?VALUE? ** ** Add a new tag or property to an artifact referenced by ** ARTIFACT-ID. For check-ins, the tag will be usable instead ** of a CHECK-IN in commands such as update and merge. If the ** --propagate flag is present and ARTIFACT-ID refers to a ** wiki page, forum post, technote, or check-in, the tag ** propagates to all descendants of that artifact. ** ** Options: ** --raw Raw tag name. Ignored for |
| ︙ | ︙ |
Changes to src/tar.c.
| ︙ | ︙ | |||
463 464 465 466 467 468 469 | ** added to as part of the tarball. It may be 0 or an empty string, in ** which case it is ignored. The intention is to create a tarball which ** politely expands into a subdir instead of filling your current dir ** with source files. For example, pass an artifact hash or "ProjectName". ** */ void tarball_of_checkin( | | | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
** added to as part of the tarball. It may be 0 or an empty string, in
** which case it is ignored. The intention is to create a tarball which
** politely expands into a subdir instead of filling your current dir
** with source files. For example, pass an artifact hash or "ProjectName".
**
*/
void tarball_of_checkin(
int rid, /* The RID of the check-in from which to form a tarball*/
Blob *pTar, /* Write the tarball into this blob */
const char *zDir, /* Directory prefix for all file added to tarball */
Glob *pInclude, /* Only add files matching this pattern */
Glob *pExclude, /* Exclude files matching this pattern */
int listFlag /* Show filenames on stdout */
){
Blob mfile, hash, file;
|
| ︙ | ︙ | |||
674 675 676 677 678 679 680 |
blob_reset(&tarball);
}
}
/*
** Check to see if the input string is of the form:
**
| | | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 |
blob_reset(&tarball);
}
}
/*
** Check to see if the input string is of the form:
**
** check-in-name/filename.ext
**
** In other words, check to see if the input contains a single '/'
** character that separates a valid check-in name from a filename.
**
** If the condition is true, return the check-in name and set the
** input string to be the filename.
**
|
| ︙ | ︙ |
Changes to src/th_main.c.
| ︙ | ︙ | |||
154 155 156 157 158 159 160 | } /* ** - adopted from ls_cmd_rev in checkin.c ** - adopted commands/error handling for usage within th1 ** - interface adopted to allow result creation as TH1 List ** | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | } /* ** - adopted from ls_cmd_rev in checkin.c ** - adopted commands/error handling for usage within th1 ** - interface adopted to allow result creation as TH1 List ** ** Takes a check-in identifier in zRev and an optiona glob pattern in zGLOB ** as parameter returns a TH list in pzList,pnList with filenames matching ** glob pattern with the checking */ static void dir_cmd_rev( Th_Interp *interp, char **pzList, int *pnList, |
| ︙ | ︙ | |||
1265 1266 1267 1268 1269 1270 1271 | Th_SetResult(interp, g.zRepositoryName, -1); return TH_OK; } /* ** TH1 command: checkout ?BOOLEAN? ** | | | | 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 |
Th_SetResult(interp, g.zRepositoryName, -1);
return TH_OK;
}
/*
** TH1 command: checkout ?BOOLEAN?
**
** Return the fully qualified directory name of the current check-out or an
** empty string if it is not available. Optionally, it will attempt to find
** the current check-out, opening the configuration ("user") database and the
** repository as necessary, if the boolean argument is non-zero.
*/
static int checkoutCmd(
Th_Interp *interp,
void *p,
int argc,
const char **argv,
|
| ︙ | ︙ | |||
1320 1321 1322 1323 1324 1325 1326 | /* ** TH1 command: globalState NAME ?DEFAULT? ** ** Returns a string containing the value of the specified global state ** variable -OR- the specified default value. Currently, the supported ** items are: ** | | | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | /* ** TH1 command: globalState NAME ?DEFAULT? ** ** Returns a string containing the value of the specified global state ** variable -OR- the specified default value. Currently, the supported ** items are: ** ** "checkout" = The active local check-out directory, if any. ** "configuration" = The active configuration database file name, ** if any. ** "executable" = The fully qualified executable file name. ** "flags" = The TH1 initialization flags. ** "log" = The error log file name, if any. ** "repository" = The active local repository file name, if ** any. |
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
180 181 182 183 184 185 186 | char zPrevDate[20]; GraphContext *pGraph = 0; int prevWasDivider = 0; /* True if previous output row was <hr> */ int fchngQueryInit = 0; /* True if fchngQuery is initialized */ Stmt fchngQuery; /* Query for file changes on check-ins */ static Stmt qbranch; int pendingEndTr = 0; /* True if a </td></tr> is needed */ | | | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
char zPrevDate[20];
GraphContext *pGraph = 0;
int prevWasDivider = 0; /* True if previous output row was <hr> */
int fchngQueryInit = 0; /* True if fchngQuery is initialized */
Stmt fchngQuery; /* Query for file changes on check-ins */
static Stmt qbranch;
int pendingEndTr = 0; /* True if a </td></tr> is needed */
int vid = 0; /* Current check-out version */
int dateFormat = 0; /* 0: HH:MM (default) */
int bCommentGitStyle = 0; /* Only show comments through first blank line */
const char *zStyle; /* Sub-name for classes for the style */
const char *zDateFmt;
int iTableId = timeline_tableid();
int bTimestampLinksToInfo; /* True if timestamp hyperlinks go to the /info
** page rather than the /timeline page */
|
| ︙ | ︙ | |||
3136 3137 3138 3139 3140 3141 3142 | ** -n|--limit N If N is positive, output the first N entries. If ** N is negative, output the first -N lines. If N is ** zero, no limit. Default is -20 meaning 20 lines. ** --offset P skip P changes ** -p|--path PATH Output items affecting PATH only. ** PATH can be a file or a sub directory. ** -R REPO_FILE Specifies the repository db to use. Default is | | | 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 | ** -n|--limit N If N is positive, output the first N entries. If ** N is negative, output the first -N lines. If N is ** zero, no limit. Default is -20 meaning 20 lines. ** --offset P skip P changes ** -p|--path PATH Output items affecting PATH only. ** PATH can be a file or a sub directory. ** -R REPO_FILE Specifies the repository db to use. Default is ** the current check-out's repository. ** --sql Show the SQL used to generate the timeline ** -t|--type TYPE Output items from the given types only, such as: ** ci = file commits only ** e = technical notes only ** f = forum posts only ** t = tickets only ** w = wiki commits only |
| ︙ | ︙ | |||
3186 3187 3188 3189 3190 3191 3192 |
zWidth = find_option("width","W",1);
zType = find_option("type","t",1);
zFilePattern = find_option("path","p",1);
zFormat = find_option("format","F",1);
zBr = find_option("branch","b",1);
if( find_option("current-branch","c",0)!=0 ){
if( !g.localOpen ){
| | | 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 |
zWidth = find_option("width","W",1);
zType = find_option("type","t",1);
zFilePattern = find_option("path","p",1);
zFormat = find_option("format","F",1);
zBr = find_option("branch","b",1);
if( find_option("current-branch","c",0)!=0 ){
if( !g.localOpen ){
fossil_fatal("not within an open check-out");
}else{
int vid = db_lget_int("checkout", 0);
zBr = db_text(0, "SELECT value FROM tagxref WHERE rid=%d AND tagid=%d",
vid, TAG_BRANCH);
}
}
if( find_option("oneline",0,0)!= 0 || fossil_strcmp(zFormat,"oneline")==0 )
|
| ︙ | ︙ | |||
3262 3263 3264 3265 3266 3267 3268 |
if( fossil_strcmp(zOrigin, "now")==0 ){
if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
fossil_fatal("cannot compute descendants or ancestors of a date");
}
zDate = mprintf("(SELECT datetime('now'))");
}else if( strncmp(zOrigin, "current", k)==0 ){
if( !g.localOpen ){
| | | 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 |
if( fossil_strcmp(zOrigin, "now")==0 ){
if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
fossil_fatal("cannot compute descendants or ancestors of a date");
}
zDate = mprintf("(SELECT datetime('now'))");
}else if( strncmp(zOrigin, "current", k)==0 ){
if( !g.localOpen ){
fossil_fatal("must be within a local check-out to use 'current'");
}
objid = db_lget_int("checkout",0);
zDate = mprintf("(SELECT mtime FROM plink WHERE cid=%d)", objid);
}else if( fossil_is_julianday(zOrigin) ){
const char *zShift = "";
if( mode==TIMELINE_MODE_CHILDREN || mode==TIMELINE_MODE_PARENTS ){
fossil_fatal("cannot compute descendants or ancestors of a date");
|
| ︙ | ︙ | |||
3349 3350 3351 3352 3353 3354 3355 |
" WHERE tagtype>0 AND tagname='sym-%q'\n"
" UNION\n" /* Tags */
" SELECT srcid FROM tagxref WHERE origid IN (\n"
" SELECT rid FROM tagxref NATURAL JOIN tag\n"
" WHERE tagname='sym-%q')\n"
" UNION\n" /* Branch wikis */
" SELECT objid FROM event WHERE comment LIKE '_branch/%q'\n"
| | | 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 |
" WHERE tagtype>0 AND tagname='sym-%q'\n"
" UNION\n" /* Tags */
" SELECT srcid FROM tagxref WHERE origid IN (\n"
" SELECT rid FROM tagxref NATURAL JOIN tag\n"
" WHERE tagname='sym-%q')\n"
" UNION\n" /* Branch wikis */
" SELECT objid FROM event WHERE comment LIKE '_branch/%q'\n"
" UNION\n" /* Check-in wikis */
" SELECT e.objid FROM event e\n"
" INNER JOIN blob b ON b.uuid=substr(e.comment, 10)\n"
" AND e.comment LIKE '_checkin/%%'\n"
" LEFT JOIN tagxref tx ON tx.rid=b.rid AND tx.tagid=%d\n"
" WHERE tx.value='%q'\n"
")\n" /* No merge closures */
" AND (tagxref.value IS NULL OR tagxref.value='%q')",
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
1547 1548 1549 1550 1551 1552 1553 |
*/
void ticket_cmd(void){
int n;
const char *zUser;
const char *zDate;
const char *zTktUuid;
| | | 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 |
*/
void ticket_cmd(void){
int n;
const char *zUser;
const char *zDate;
const char *zTktUuid;
/* do some ints, we want to be inside a check-out */
db_find_and_open_repository(0, 0);
user_select();
zUser = find_option("user-override",0,1);
if( zUser==0 ) zUser = login_name();
zDate = find_option("date-override",0,1);
if( zDate==0 ) zDate = "now";
|
| ︙ | ︙ |
Changes to src/undo.c.
| ︙ | ︙ | |||
453 454 455 456 457 458 459 | ** If the most recent command is not one of those listed as undoable, ** then the undo command might try to restore the state to be what it was ** prior to the last undoable command, or it might be a no-op. If in ** doubt about what the undo command will do, first run it with the -n ** option. ** ** A single level of undo/redo is supported. The undo/redo stack | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | ** If the most recent command is not one of those listed as undoable, ** then the undo command might try to restore the state to be what it was ** prior to the last undoable command, or it might be a no-op. If in ** doubt about what the undo command will do, first run it with the -n ** option. ** ** A single level of undo/redo is supported. The undo/redo stack ** is cleared by the commit and check-out commands. Other commands may ** or may not clear the undo stack. ** ** Future versions of Fossil might add new commands to the set of commands ** that are undoable. ** ** Options: ** -n|--dry-run Do not make changes but show what would be done |
| ︙ | ︙ |
Changes to src/update.c.
| ︙ | ︙ | |||
12 13 14 15 16 17 18 | ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code used to merge the changes in the current | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code used to merge the changes in the current ** check-out into a different version and switch to that version. */ #include "config.h" #include "update.h" #include <assert.h> /* ** Return true if artifact rid is a version |
| ︙ | ︙ | |||
60 61 62 63 64 65 66 | } /* ** COMMAND: update ** ** Usage: %fossil update ?OPTIONS? ?VERSION? ?FILES...? ** | | | | | | | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | } /* ** COMMAND: update ** ** Usage: %fossil update ?OPTIONS? ?VERSION? ?FILES...? ** ** Change the version of the current check-out to VERSION. Any ** uncommitted changes are retained and applied to the new check-out. ** ** The VERSION argument can be a specific version or tag or branch ** name. If the VERSION argument is omitted, then the leaf of the ** subtree that begins at the current version is used, if there is ** only a single leaf. VERSION can also be "current" to select the ** leaf of the current version or "latest" to select the most recent ** check-in. ** ** If one or more FILES are listed after the VERSION then only the ** named files are candidates to be updated, and any updates to them ** will be treated as edits to the current version. Using a directory ** name for one of the FILES arguments is the same as using every ** subdirectory and file beneath that directory. ** ** If FILES is omitted, all files in the current check-out are subject ** to being updated and the version of the current check-out is changed ** to VERSION. Any uncommitted changes are retained and applied to the ** new check-out. ** ** The -n or --dry-run option causes this command to do a "dry run". ** It prints out what would have happened but does not actually make ** any changes to the current check-out or the repository. ** ** The -v or --verbose option prints status information about ** unchanged files in addition to those file that actually do change. ** ** Options: ** --case-sensitive BOOL Override case-sensitive setting ** --debug Print debug information on stdout ** -n|--dry-run If given, display instead of run actions ** --force-missing Force update if missing content after sync ** -K|--keep-merge-files On merge conflict, retain the temporary files ** used for merging, named *-baseline, *-original, ** and *-merge. ** --latest Acceptable in place of VERSION, update to ** latest version ** --nosync Do not auto-sync prior to update ** --setmtime Set timestamps of all files to match their ** SCM-side times (the timestamp of the last ** check-in which modified them). ** -v|--verbose Print status information about all files ** -W|--width WIDTH Width of lines (default is to auto-detect). ** Must be more than 20 or 0 (= no limit, ** resulting in a single line per entry). ** ** See also: [[revert]] */ |
| ︙ | ︙ | |||
250 251 252 253 254 255 256 |
if( load_vfile_from_rid(tid) && !forceMissingFlag ){
fossil_fatal("missing content, unable to update");
};
/*
** The record.fn field is used to match files against each other. The
** FV table contains one row for each each unique filename in
| | | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
if( load_vfile_from_rid(tid) && !forceMissingFlag ){
fossil_fatal("missing content, unable to update");
};
/*
** The record.fn field is used to match files against each other. The
** FV table contains one row for each each unique filename in
** in the current check-out, the pivot, and the version being merged.
*/
db_multi_exec(
"DROP TABLE IF EXISTS fv;"
"CREATE TEMP TABLE fv("
" fn TEXT %s PRIMARY KEY," /* The filename relative to root */
" idv INTEGER," /* VFILE entry for current version */
" idt INTEGER," /* VFILE entry for target version */
|
| ︙ | ︙ | |||
387 388 389 390 391 392 393 |
blob_reset(&treename);
}
db_multi_exec("%s", blob_sql_text(&sql));
blob_reset(&sql);
}
/*
| | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
blob_reset(&treename);
}
db_multi_exec("%s", blob_sql_text(&sql));
blob_reset(&sql);
}
/*
** Alter the content of the check-out so that it conforms with the
** target
*/
db_prepare(&q,
"SELECT fn, idv, ridv, idt, ridt, chnged, fnt,"
" isexe, islinkv, islinkt, deleted FROM fv ORDER BY 1"
);
db_prepare(&mtimeXfer,
|
| ︙ | ︙ | |||
425 426 427 428 429 430 431 |
zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName);
nameChng = fossil_strcmp(zName, zNewName);
nUpdate++;
if( deleted ){
db_multi_exec("UPDATE vfile SET deleted=1 WHERE id=%d", idt);
}
if( idv>0 && ridv==0 && idt>0 && ridt>0 ){
| | | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
zFullNewPath = mprintf("%s%s", g.zLocalRoot, zNewName);
nameChng = fossil_strcmp(zName, zNewName);
nUpdate++;
if( deleted ){
db_multi_exec("UPDATE vfile SET deleted=1 WHERE id=%d", idt);
}
if( idv>0 && ridv==0 && idt>0 && ridt>0 ){
/* Conflict. This file has been added to the current check-out
** but also exists in the target check-out. Use the current version.
*/
fossil_print("CONFLICT %s\n", zName);
nConflict++;
}else if( idt>0 && idv==0 ){
/* File added in the target. */
if( file_isfile_or_link(zFullPath) ){
/* Name of backup file with Original content */
|
| ︙ | ︙ | |||
464 465 466 467 468 469 470 |
/* The file missing from the local check-out. Restore it to the
** version that appears in the target. */
fossil_print("UPDATE %s\n", zName);
if( !dryRunFlag && !internalUpdate ) undo_save(zName);
if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
}else if( idt==0 && idv>0 ){
if( ridv==0 ){
| | | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
/* The file missing from the local check-out. Restore it to the
** version that appears in the target. */
fossil_print("UPDATE %s\n", zName);
if( !dryRunFlag && !internalUpdate ) undo_save(zName);
if( !dryRunFlag ) vfile_to_disk(0, idt, 0, 0);
}else if( idt==0 && idv>0 ){
if( ridv==0 ){
/* Added in current check-out. Continue to hold the file as
** as an addition */
db_multi_exec("UPDATE vfile SET vid=%d WHERE id=%d", tid, idv);
}else if( chnged ){
/* Edited locally but deleted from the target. Do not track the
** file but keep the edited version around. */
fossil_print("CONFLICT %s - edited locally but deleted by update\n",
zName);
|
| ︙ | ︙ | |||
627 628 629 630 631 632 633 |
db_multi_exec(
"SELECT rmdir(%Q||name) FROM dir_to_delete"
" WHERE (%Q||name)<>%Q ORDER BY name DESC",
g.zLocalRoot, g.zLocalRoot, zPwd
);
fossil_free(zPwd);
if( g.argc<=3 ){
| | | | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
db_multi_exec(
"SELECT rmdir(%Q||name) FROM dir_to_delete"
" WHERE (%Q||name)<>%Q ORDER BY name DESC",
g.zLocalRoot, g.zLocalRoot, zPwd
);
fossil_free(zPwd);
if( g.argc<=3 ){
/* All files updated. Shift the current check-out to the target. */
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", tid);
checkout_set_all_exe(tid);
manifest_to_disk(tid);
db_set_checkout(tid);
}else{
/* A subset of files have been checked out. Keep the current
** check-out unchanged. */
db_multi_exec("DELETE FROM vfile WHERE vid!=%d", vid);
}
if( !internalUpdate ) undo_finish();
if( setmtimeFlag ) vfile_check_signature(tid, CKSIG_SETMTIME);
db_end_transaction(0);
}
}
|
| ︙ | ︙ | |||
694 695 696 697 698 699 700 |
}
blob_reset(&dirsList);
fossil_free(zEmptyDirs);
}
}
/*
| | | | | | | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 |
}
blob_reset(&dirsList);
fossil_free(zEmptyDirs);
}
}
/*
** Get the manifest record for a given revision, or the current check-out if
** zRevision is NULL.
*/
Manifest *historical_manifest(
const char *zRevision /* The check-in to query, or NULL for current */
){
int vid;
Manifest *pManifest;
/* Determine the check-in manifest artifact ID. Panic on failure. */
if( zRevision ){
vid = name_to_typed_rid(zRevision, "ci");
}else if( !g.localOpen ){
vid = name_to_typed_rid(db_get("main-branch", 0), "ci");
}else{
vid = db_lget_int("checkout", 0);
if( !is_a_version(vid) ){
if( vid==0 ) return 0;
zRevision = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", vid);
if( zRevision ){
fossil_fatal("check-out artifact is not a check-in: %s", zRevision);
}else{
fossil_fatal("invalid check-out artifact ID: %d", vid);
}
}
}
/* Parse the manifest, given its artifact ID. Panic on failure. */
if( !(pManifest = manifest_get(vid, CFTYPE_MANIFEST, 0)) ){
if( zRevision ){
fossil_fatal("could not parse manifest for check-in: %s", zRevision);
}else{
fossil_fatal("could not parse manifest for current check-out");
}
}
/* Return the manifest pointer. The caller must use manifest_destroy() to
* clean up when finished using the manifest. */
return pManifest;
}
/*
** Get the contents of a file within the check-in "zRevision". If
** zRevision==NULL then get the file content for the current check-out.
*/
int historical_blob(
const char *zRevision, /* The check-in containing the file */
const char *zFile, /* Full treename of the file */
Blob *pBlob, /* Put the content here */
int fatal /* If nonzero, panic if file/artifact not found */
){
|
| ︙ | ︙ | |||
811 812 813 814 815 816 817 |
** Options:
** -r|--revision VERSION Revert given FILE(s) back to given
** VERSION
**
** See also: [[redo]], [[undo]], [[checkout]], [[update]]
*/
void revert_cmd(void){
| | | | | | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 |
** Options:
** -r|--revision VERSION Revert given FILE(s) back to given
** VERSION
**
** See also: [[redo]], [[undo]], [[checkout]], [[update]]
*/
void revert_cmd(void){
Manifest *pCoManifest; /* Manifest of current check-out */
Manifest *pRvManifest; /* Manifest of selected revert version */
ManifestFile *pCoFile; /* File within current check-out manifest */
ManifestFile *pRvFile; /* File within revert version manifest */
const char *zFile; /* Filename relative to check-out root */
const char *zRevision; /* Selected revert version, NULL if current */
Blob record = BLOB_INITIALIZER; /* Contents of each reverted file */
int i;
Stmt q;
int revertAll = 0;
int revisionOptNotSupported = 0;
undo_capture_command_line();
zRevision = find_option("revision", "r", 1);
verify_all_options();
if( g.argc<2 ){
usage("?OPTIONS? [FILE] ...");
}
if( zRevision && g.argc<3 ){
fossil_fatal("directories or the entire tree can only be reverted"
" back to current version");
}
db_must_be_within_tree();
/* Get manifests of revert version and (if different) current check-out. */
pRvManifest = historical_manifest(zRevision);
pCoManifest = zRevision ? historical_manifest(0) : 0;
db_begin_transaction();
undo_begin();
db_multi_exec("CREATE TEMP TABLE torevert(name UNIQUE);");
|
| ︙ | ︙ | |||
956 957 958 959 960 961 962 |
}else if( file_unsafe_in_tree_path(zFull) ){
/* Ignore this file */
}else{
sqlite3_int64 mtime;
int rvChnged = 0;
int rvPerm = manifest_file_mperm(pRvFile);
| | | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 |
}else if( file_unsafe_in_tree_path(zFull) ){
/* Ignore this file */
}else{
sqlite3_int64 mtime;
int rvChnged = 0;
int rvPerm = manifest_file_mperm(pRvFile);
/* Determine if reverted-to file is different than checked-out file. */
if( pCoManifest && (pCoFile = manifest_file_find(pCoManifest, zFile)) ){
rvChnged = manifest_file_mperm(pRvFile)!=rvPerm
|| fossil_strcmp(pRvFile->zUuid, pCoFile->zUuid)!=0;
}
/* Get contents of reverted-to file. */
content_get(fast_uuid_to_rid(pRvFile->zUuid), &record);
|
| ︙ | ︙ |
Changes to src/user.c.
| ︙ | ︙ | |||
557 558 559 560 561 562 563 |
** Print details about sources of fossil usernames.
*/
void test_usernames_cmd(void){
db_find_and_open_repository(0, 0);
fossil_print("Initial g.zLogin: %s\n", g.zLogin);
fossil_print("Initial g.userUid: %d\n", g.userUid);
| | | | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 |
** Print details about sources of fossil usernames.
*/
void test_usernames_cmd(void){
db_find_and_open_repository(0, 0);
fossil_print("Initial g.zLogin: %s\n", g.zLogin);
fossil_print("Initial g.userUid: %d\n", g.userUid);
fossil_print("check-out default-user: %s\n", g.localOpen ?
db_lget("default-user","") : "<<no open check-out>>");
fossil_print("default-user: %s\n", db_get("default-user",""));
fossil_print("FOSSIL_USER: %s\n", fossil_getenv("FOSSIL_USER"));
fossil_print("USER: %s\n", fossil_getenv("USER"));
fossil_print("LOGNAME: %s\n", fossil_getenv("LOGNAME"));
fossil_print("USERNAME: %s\n", fossil_getenv("USERNAME"));
url_parse(0, URL_USE_CONFIG);
fossil_print("URL user: %s\n", g.url.user);
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
361 362 363 364 365 366 367 |
db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d",
file_mtime(zName, RepoFILE), id);
}
db_finalize(&q);
}
/*
| | | | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d",
file_mtime(zName, RepoFILE), id);
}
db_finalize(&q);
}
/*
** Check to see if the directory named in zPath is the top of a check-out.
** In other words, check to see if directory pPath contains a file named
** "_FOSSIL_" or ".fslckout". Return true or false.
*/
int vfile_top_of_checkout(const char *zPath){
char *zFile;
int fileFound = 0;
zFile = mprintf("%s/_FOSSIL_", zPath);
fileFound = file_size(zFile, ExtFILE)>=1024;
fossil_free(zFile);
if( !fileFound ){
zFile = mprintf("%s/.fslckout", zPath);
fileFound = file_size(zFile, ExtFILE)>=1024;
fossil_free(zFile);
}
/* Check for ".fos" for legacy support. But the use of ".fos" as the
** per-check-out database name is deprecated. At some point, all support
** for ".fos" will end and this code should be removed. This comment
** added on 2012-02-04.
*/
if( !fileFound ){
zFile = mprintf("%s/.fos", zPath);
fileFound = file_size(zFile, ExtFILE)>=1024;
fossil_free(zFile);
|
| ︙ | ︙ |
Changes to src/wiki.c.
| ︙ | ︙ | |||
465 466 467 468 469 470 471 |
break;
}
case WIKITYPE_CHECKIN: {
zPageName += 8;
if( zExtra[0]==0 && !P("p") ){
cgi_redirectf("%R/info/%s",zPageName);
}else{
| | | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
break;
}
case WIKITYPE_CHECKIN: {
zPageName += 8;
if( zExtra[0]==0 && !P("p") ){
cgi_redirectf("%R/info/%s",zPageName);
}else{
style_header("Notes About Check-in %S", zPageName);
style_submenu_element("Check-in Timeline","%R/timeline?f=%s", zPageName);
style_submenu_element("Check-in Info","%R/info/%s", zPageName);
}
break;
}
case WIKITYPE_BRANCH: {
zPageName += 7;
if( zExtra[0]==0 && !P("p") ){
cgi_redirectf("%R/timeline?r=%t", zPageName);
|
| ︙ | ︙ | |||
1131 1132 1133 1134 1135 1136 1137 |
** Outputs the wiki page list in JSON form. If verbose is false then
** it emits an array of strings (page names). If verbose is true it outputs
** an array of objects in this form:
**
** { name: string, version: string or null of sandbox box,
** parent: uuid or null for first version or sandbox,
** mimetype: string,
| | | 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 |
** Outputs the wiki page list in JSON form. If verbose is false then
** it emits an array of strings (page names). If verbose is true it outputs
** an array of objects in this form:
**
** { name: string, version: string or null of sandbox box,
** parent: uuid or null for first version or sandbox,
** mimetype: string,
** type: string (normal, branch, tag, check-in, or sandbox)
** }
**
** If includeContent is true, the object contains a "content" member
** with the raw page content. includeContent is ignored if verbose is
** false.
**
*/
|
| ︙ | ︙ | |||
2502 2503 2504 2505 2506 2507 2508 |
const char *zPrefix, /* "branch", "tag", or "checkin" */
const char *zName, /* Name of the object */
unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
){
if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
@ <div class="section accordion">About</div>
}else if( zPrefix[0]=='c' ){ /* checkin/... */
| | | 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 |
const char *zPrefix, /* "branch", "tag", or "checkin" */
const char *zName, /* Name of the object */
unsigned int mFlags /* Zero or more WIKIASSOC_* flags */
){
if( (mFlags & WIKIASSOC_FULL_TITLE)==0 ){
@ <div class="section accordion">About</div>
}else if( zPrefix[0]=='c' ){ /* checkin/... */
@ <div class="section accordion">About check-in %.20h(zName)</div>
}else{
@ <div class="section accordion">About %s(zPrefix) %h(zName)</div>
}
}
/*
** Add an "Wiki" button in a submenu that links to the read-wiki page.
|
| ︙ | ︙ |
Changes to src/winhttp.c.
| ︙ | ︙ | |||
407 408 409 410 411 412 413 |
}else{
break;
}
wanted -= got;
}
/*
| | | | 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
}else{
break;
}
wanted -= got;
}
/*
** The repository name is only needed if there was no open check-out. This
** is designed to allow the open check-out for the interactive user to work
** with the local Fossil server started via the "ui" command.
*/
zIp = SocketAddr_toString(&p->addr);
if( (p->flags & HTTP_SERVER_HAD_CHECKOUT)==0 ){
assert( g.zRepositoryName && g.zRepositoryName[0] );
sqlite3_snprintf(sizeof(zCmd), zCmd, "%s--in %s\n--out %s\n--ipaddr %s\n%s",
get_utf8_bom(0), zRequestFName, zReplyFName, zIp, g.zRepositoryName
|
| ︙ | ︙ | |||
1026 1027 1028 1029 1030 1031 1032 | ** Specifies the TCP port (default port is 8080) on which the ** server should listen. ** ** -R|--repository REPO ** ** Specifies the name of the repository to be served. ** The repository option may be omitted if the working directory | | | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | ** Specifies the TCP port (default port is 8080) on which the ** server should listen. ** ** -R|--repository REPO ** ** Specifies the name of the repository to be served. ** The repository option may be omitted if the working directory ** is within an open check-out. ** The REPOSITORY can be a directory (aka folder) that contains ** one or more repositories with names ending in ".fossil". ** In that case, the first element of the URL is used to select ** among the various repositories. ** ** --notfound URL ** |
| ︙ | ︙ |
Changes to src/zip.c.
| ︙ | ︙ | |||
612 613 614 615 616 617 618 | ** in which case it is ignored. The intention is to create a zip which ** politely expands into a subdir instead of filling your current dir ** with source files. For example, pass a commit hash or "ProjectName". ** */ static void zip_of_checkin( int eType, /* Type of archive (ZIP or SQLAR) */ | | | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
** in which case it is ignored. The intention is to create a zip which
** politely expands into a subdir instead of filling your current dir
** with source files. For example, pass a commit hash or "ProjectName".
**
*/
static void zip_of_checkin(
int eType, /* Type of archive (ZIP or SQLAR) */
int rid, /* The RID of the check-in to build the archive from */
Blob *pZip, /* Write the archive content into this blob */
const char *zDir, /* Top-level directory of the archive */
Glob *pInclude, /* Only include files that match this pattern */
Glob *pExclude, /* Exclude files that match this pattern */
int listFlag /* Print each file on stdout */
){
Blob mfile, hash, file;
|
| ︙ | ︙ |