Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | The "-f" flag on "fossil patch create" causes an existing patch with the same name to be overwritten. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
a332f1a64fb890b37dc25c9decd083a1 |
| User & Date: | drh 2021-06-23 19:14:28.040 |
Context
|
2021-06-23
| ||
| 19:55 | The "fossil patch diff" command should now emit an error message if there is a repository mismatch or a base artifact is missing. ... (check-in: 962694ada0 user: drh tags: trunk) | |
| 19:14 | The "-f" flag on "fossil patch create" causes an existing patch with the same name to be overwritten. ... (check-in: a332f1a64f user: drh tags: trunk) | |
| 19:06 | Enhance "fossil patch" to record the project name as part of the patch. Show the project name in "fossil patch view" output, if it exists. Show lots of metadata in "fossil project view" with the -v flag. ... (check-in: 5a28d7c094 user: drh tags: trunk) | |
Changes
Changes to src/patch.c.
| ︙ | ︙ | |||
143 144 145 146 147 148 149 | } /* ** Generate a binary patch file and store it into the file ** named zOut. */ | | > > > > | > | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
}
/*
** Generate a binary patch file and store it into the file
** named zOut.
*/
void patch_create(unsigned mFlags, const char *zOut, FILE *out){
int vid;
char *z;
if( zOut && file_isdir(zOut, ExtFILE)!=0 ){
if( mFlags & PATCH_FORCE ){
file_delete(zOut);
}
if( file_isdir(zOut, ExtFILE)!=0 ){
fossil_fatal("patch file already exists: %s", zOut);
}
}
add_content_sql_commands(g.db);
deltafunc_init(g.db);
sqlite3_create_function(g.db, "read_co_file", 1, SQLITE_UTF8, 0,
readfileFunc, 0, 0);
sqlite3_create_function(g.db, "mkdelta", 2, SQLITE_UTF8, 0,
mkdeltaFunc, 0, 0);
|
| ︙ | ︙ | |||
773 774 775 776 777 778 779 780 781 782 783 784 785 786 | ** > fossil patch create [DIRECTORY] FILENAME ** ** Create a new binary patch in FILENAME that captures all uncommitted ** changes in the check-out at DIRECTORY, or the current directory if ** DIRECTORY is omitted. If FILENAME is "-" then the binary patch ** is written to standard output. ** ** > fossil patch apply [DIRECTORY] FILENAME ** ** Apply the changes in FILENAME to the check-out a DIRECTORY, or ** in the current directory if DIRECTORY is omitted. Options: ** ** -f|--force Apply the patch even though there are unsaved ** changes in the current check-out. | > > | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | ** > fossil patch create [DIRECTORY] FILENAME ** ** Create a new binary patch in FILENAME that captures all uncommitted ** changes in the check-out at DIRECTORY, or the current directory if ** DIRECTORY is omitted. If FILENAME is "-" then the binary patch ** is written to standard output. ** ** -f|--force Overwrite an existing patch with the same name. ** ** > fossil patch apply [DIRECTORY] FILENAME ** ** Apply the changes in FILENAME to the check-out a DIRECTORY, or ** in the current directory if DIRECTORY is omitted. Options: ** ** -f|--force Apply the patch even though there are unsaved ** changes in the current check-out. |
| ︙ | ︙ | |||
814 815 816 817 818 819 820 821 822 823 824 825 826 827 |
** changes in the current check-out.
** -n|--dryrun Do nothing, but print what would have happened.
** -v|--verbose Extra output explaining what happens.
**
** > fossil patch view FILENAME
**
** View a summary of the the changes in the binary patch FILENAME.
**
*/
void patch_cmd(void){
const char *zCmd;
size_t n;
if( g.argc<3 ){
patch_usage:
| > > > | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 |
** changes in the current check-out.
** -n|--dryrun Do nothing, but print what would have happened.
** -v|--verbose Extra output explaining what happens.
**
** > fossil patch view FILENAME
**
** View a summary of the the changes in the binary patch FILENAME.
** Use "fossil patch diff" for detailed patch content.
**
** -v|--verbose Show extra detail about the patch.
**
*/
void patch_cmd(void){
const char *zCmd;
size_t n;
if( g.argc<3 ){
patch_usage:
|
| ︙ | ︙ | |||
839 840 841 842 843 844 845 846 847 |
db_must_be_within_tree();
patch_attach(zIn, stdin);
patch_apply(flags);
fossil_free(zIn);
}else
if( strncmp(zCmd, "create", n)==0 ){
char *zOut;
zOut = patch_find_patch_filename("create");
db_must_be_within_tree();
| > > > | | 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 |
db_must_be_within_tree();
patch_attach(zIn, stdin);
patch_apply(flags);
fossil_free(zIn);
}else
if( strncmp(zCmd, "create", n)==0 ){
char *zOut;
unsigned flags = 0;
if( find_option("force","f",0) ) flags |= PATCH_FORCE;
zOut = patch_find_patch_filename("create");
verify_all_options();
db_must_be_within_tree();
patch_create(flags, zOut, stdout);
fossil_free(zOut);
}else
if( strncmp(zCmd, "diff", n)==0 ){
const char *zDiffCmd = 0;
const char *zBinGlob = 0;
int fIncludeBinary = 0;
u64 diffFlags;
|
| ︙ | ︙ | |||
897 898 899 900 901 902 903 |
if( find_option("dryrun","n",0) ) flags |= PATCH_DRYRUN;
if( find_option("verbose","v",0) ) flags |= PATCH_VERBOSE;
if( find_option("force","f",0) ) flags |= PATCH_FORCE;
db_must_be_within_tree();
verify_all_options();
pOut = patch_remote_command(flags, "push", "apply", "w");
if( pOut ){
| | | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 |
if( find_option("dryrun","n",0) ) flags |= PATCH_DRYRUN;
if( find_option("verbose","v",0) ) flags |= PATCH_VERBOSE;
if( find_option("force","f",0) ) flags |= PATCH_FORCE;
db_must_be_within_tree();
verify_all_options();
pOut = patch_remote_command(flags, "push", "apply", "w");
if( pOut ){
patch_create(0, 0, pOut);
pclose(pOut);
}
}else
if( strncmp(zCmd, "view", n)==0 ){
const char *zIn;
unsigned int flags = 0;
if( find_option("verbose","v",0) ) flags |= PATCH_VERBOSE;
|
| ︙ | ︙ |