Fossil SCM
Add '--no-prompt' option to the 'commit' command.
Commit
29ef4f5d06f9a73f7423c5705718073f03061042
Parent
9595cfcd456c953…
1 file changed
+55
-16
+55
-16
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1470,10 +1470,11 @@ | ||
| 1470 | 1470 | static int commit_warning( |
| 1471 | 1471 | Blob *p, /* The content of the file being committed. */ |
| 1472 | 1472 | int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */ |
| 1473 | 1473 | int binOk, /* Non-zero if binary warnings should be disabled. */ |
| 1474 | 1474 | int encodingOk, /* Non-zero if encoding warnings should be disabled. */ |
| 1475 | + int noPrompt, /* Non-zero to disable prompts and assume 'No'. */ | |
| 1475 | 1476 | const char *zFilename /* The full name of the file being committed. */ |
| 1476 | 1477 | ){ |
| 1477 | 1478 | int bReverse; /* UTF-16 byte order is reversed? */ |
| 1478 | 1479 | int fUnicode; /* return value of could_be_utf16() */ |
| 1479 | 1480 | int fBinary; /* does the blob content appear to be binary? */ |
| @@ -1562,13 +1563,18 @@ | ||
| 1562 | 1563 | zMsg = mprintf( |
| 1563 | 1564 | "%s contains %s. Use --no-warnings or the %s to" |
| 1564 | 1565 | " disable this warning.\n" |
| 1565 | 1566 | "Commit anyhow (a=all/%sy/N)? ", |
| 1566 | 1567 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 1567 | - prompt_user(zMsg, &ans); | |
| 1568 | + if( !noPrompt ){ | |
| 1569 | + prompt_user(zMsg, &ans); | |
| 1570 | + cReply = blob_str(&ans)[0]; | |
| 1571 | + blob_reset(&ans); | |
| 1572 | + }else{ | |
| 1573 | + cReply = 'N'; | |
| 1574 | + } | |
| 1568 | 1575 | fossil_free(zMsg); |
| 1569 | - cReply = blob_str(&ans)[0]; | |
| 1570 | 1576 | if( cReply=='a' || cReply=='A' ){ |
| 1571 | 1577 | allOk = 1; |
| 1572 | 1578 | }else if( *zConvert && (cReply=='c' || cReply=='C') ){ |
| 1573 | 1579 | char *zOrig = file_newname(zFilename, "original", 1); |
| 1574 | 1580 | FILE *f; |
| @@ -1595,11 +1601,10 @@ | ||
| 1595 | 1601 | return 1; |
| 1596 | 1602 | }else if( cReply!='y' && cReply!='Y' ){ |
| 1597 | 1603 | fossil_fatal("Abandoning commit due to %s in %s", |
| 1598 | 1604 | zWarning, blob_str(&fname)); |
| 1599 | 1605 | } |
| 1600 | - blob_reset(&ans); | |
| 1601 | 1606 | blob_reset(&fname); |
| 1602 | 1607 | } |
| 1603 | 1608 | return 0; |
| 1604 | 1609 | } |
| 1605 | 1610 | |
| @@ -1683,10 +1688,13 @@ | ||
| 1683 | 1688 | ** --integrate close all merged-in branches |
| 1684 | 1689 | ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment |
| 1685 | 1690 | ** -M|--message-file FILE read the commit comment from given file |
| 1686 | 1691 | ** --mimetype MIMETYPE mimetype of check-in comment |
| 1687 | 1692 | ** -n|--dry-run If given, display instead of run actions |
| 1693 | +** --no-prompt This option disables prompting the user for | |
| 1694 | +** input and assumes an answer of 'No' for every | |
| 1695 | +** question. | |
| 1688 | 1696 | ** --no-warnings omit all warnings about file contents |
| 1689 | 1697 | ** --nosign do not attempt to sign this commit with gpg |
| 1690 | 1698 | ** --private do not sync changes and their descendants |
| 1691 | 1699 | ** --sha1sum verify file status using SHA1 hashing rather |
| 1692 | 1700 | ** than relying on file mtimes |
| @@ -1713,10 +1721,11 @@ | ||
| 1713 | 1721 | char *zUuid; /* UUID of the new check-in */ |
| 1714 | 1722 | int useSha1sum = 0; /* True to verify file status using SHA1 hashing */ |
| 1715 | 1723 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1716 | 1724 | int isAMerge = 0; /* True if checking in a merge */ |
| 1717 | 1725 | int noWarningFlag = 0; /* True if skipping all warnings */ |
| 1726 | + int noPrompt = 0; /* True if skipping all prompts */ | |
| 1718 | 1727 | int forceFlag = 0; /* Undocumented: Disables all checks */ |
| 1719 | 1728 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1720 | 1729 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1721 | 1730 | int allowConflict = 0; /* Allow unresolve merge conflicts */ |
| 1722 | 1731 | int allowEmpty = 0; /* Allow a commit with no changes */ |
| @@ -1760,10 +1769,11 @@ | ||
| 1760 | 1769 | forceFlag = find_option("force", "f", 0)!=0; |
| 1761 | 1770 | allowConflict = find_option("allow-conflict",0,0)!=0; |
| 1762 | 1771 | allowEmpty = find_option("allow-empty",0,0)!=0; |
| 1763 | 1772 | allowFork = find_option("allow-fork",0,0)!=0; |
| 1764 | 1773 | allowOlder = find_option("allow-older",0,0)!=0; |
| 1774 | + noPrompt = find_option("no-prompt", 0, 0)!=0; | |
| 1765 | 1775 | noWarningFlag = find_option("no-warnings", 0, 0)!=0; |
| 1766 | 1776 | sCiInfo.zBranch = find_option("branch","b",1); |
| 1767 | 1777 | sCiInfo.zColor = find_option("bgcolor",0,1); |
| 1768 | 1778 | sCiInfo.zBrClr = find_option("branchcolor",0,1); |
| 1769 | 1779 | sCiInfo.closeFlag = find_option("close",0,0)!=0; |
| @@ -1829,12 +1839,18 @@ | ||
| 1829 | 1839 | |
| 1830 | 1840 | /* Require confirmation to continue with the check-in if there is |
| 1831 | 1841 | ** clock skew |
| 1832 | 1842 | */ |
| 1833 | 1843 | if( g.clockSkewSeen ){ |
| 1834 | - prompt_user("continue in spite of time skew (y/N)? ", &ans); | |
| 1835 | - cReply = blob_str(&ans)[0]; | |
| 1844 | + if( !noPrompt ){ | |
| 1845 | + prompt_user("continue in spite of time skew (y/N)? ", &ans); | |
| 1846 | + cReply = blob_str(&ans)[0]; | |
| 1847 | + blob_reset(&ans); | |
| 1848 | + }else{ | |
| 1849 | + fossil_print("Abandoning commit due to time skew\n"); | |
| 1850 | + cReply = 'N'; | |
| 1851 | + } | |
| 1836 | 1852 | if( cReply!='y' && cReply!='Y' ){ |
| 1837 | 1853 | fossil_exit(1); |
| 1838 | 1854 | } |
| 1839 | 1855 | } |
| 1840 | 1856 | |
| @@ -1847,13 +1863,20 @@ | ||
| 1847 | 1863 | ** array is allocated to contain the "id" field from the vfile table |
| 1848 | 1864 | ** for each file to be committed. Or, if aCommitFile is NULL, all files |
| 1849 | 1865 | ** should be committed. |
| 1850 | 1866 | */ |
| 1851 | 1867 | if( select_commit_files() ){ |
| 1852 | - prompt_user("continue (y/N)? ", &ans); | |
| 1853 | - cReply = blob_str(&ans)[0]; | |
| 1854 | - if( cReply!='y' && cReply!='Y' ) fossil_exit(1); | |
| 1868 | + if( !noPrompt ){ | |
| 1869 | + prompt_user("continue (y/N)? ", &ans); | |
| 1870 | + cReply = blob_str(&ans)[0]; | |
| 1871 | + blob_reset(&ans); | |
| 1872 | + }else{ | |
| 1873 | + cReply = 'N'; | |
| 1874 | + } | |
| 1875 | + if( cReply!='y' && cReply!='Y' ){ | |
| 1876 | + fossil_exit(1); | |
| 1877 | + } | |
| 1855 | 1878 | } |
| 1856 | 1879 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1857 | 1880 | if( g.aCommitFile && isAMerge ){ |
| 1858 | 1881 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1859 | 1882 | } |
| @@ -1954,26 +1977,35 @@ | ||
| 1954 | 1977 | blob_append(&comment, zComment, -1); |
| 1955 | 1978 | }else if( zComFile ){ |
| 1956 | 1979 | blob_zero(&comment); |
| 1957 | 1980 | blob_read_from_file(&comment, zComFile); |
| 1958 | 1981 | blob_to_utf8_no_bom(&comment, 1); |
| 1959 | - }else if(dryRunFlag){ | |
| 1982 | + }else if( dryRunFlag ){ | |
| 1960 | 1983 | blob_zero(&comment); |
| 1961 | - }else{ | |
| 1984 | + }else if( !noPrompt ){ | |
| 1962 | 1985 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1963 | 1986 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1964 | 1987 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1965 | 1988 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1966 | 1989 | cReply = blob_str(&ans)[0]; |
| 1967 | - if( cReply!='y' && cReply!='Y' ) fossil_exit(1); | |
| 1990 | + blob_reset(&ans); | |
| 1991 | + if( cReply!='y' && cReply!='Y' ){ | |
| 1992 | + fossil_exit(1); | |
| 1993 | + } | |
| 1968 | 1994 | } |
| 1969 | 1995 | free(zInit); |
| 1970 | 1996 | } |
| 1971 | 1997 | if( blob_size(&comment)==0 ){ |
| 1972 | 1998 | if( !dryRunFlag ){ |
| 1973 | - prompt_user("empty check-in comment. continue (y/N)? ", &ans); | |
| 1974 | - cReply = blob_str(&ans)[0]; | |
| 1999 | + if( !noPrompt ){ | |
| 2000 | + prompt_user("empty check-in comment. continue (y/N)? ", &ans); | |
| 2001 | + cReply = blob_str(&ans)[0]; | |
| 2002 | + blob_reset(&ans); | |
| 2003 | + }else{ | |
| 2004 | + fossil_print("Abandoning commit due to empty check-in comment\n"); | |
| 2005 | + cReply = 'N'; | |
| 2006 | + } | |
| 1975 | 2007 | if( cReply!='y' && cReply!='Y' ){ |
| 1976 | 2008 | fossil_exit(1); |
| 1977 | 2009 | } |
| 1978 | 2010 | } |
| 1979 | 2011 | }else{ |
| @@ -2023,11 +2055,12 @@ | ||
| 2023 | 2055 | blob_read_from_file(&content, zFullname); |
| 2024 | 2056 | } |
| 2025 | 2057 | /* Do not emit any warnings when they are disabled. */ |
| 2026 | 2058 | if( !noWarningFlag ){ |
| 2027 | 2059 | abortCommit |= commit_warning(&content, crnlOk, binOk, |
| 2028 | - encodingOk, zFullname); | |
| 2060 | + encodingOk, noPrompt, | |
| 2061 | + zFullname); | |
| 2029 | 2062 | } |
| 2030 | 2063 | if( contains_merge_marker(&content) ){ |
| 2031 | 2064 | Blob fname; /* Relative pathname of the file */ |
| 2032 | 2065 | |
| 2033 | 2066 | nConflict++; |
| @@ -2107,12 +2140,18 @@ | ||
| 2107 | 2140 | }else if( forceDelta ){ |
| 2108 | 2141 | fossil_fatal("unable to find a baseline-manifest for the delta"); |
| 2109 | 2142 | } |
| 2110 | 2143 | } |
| 2111 | 2144 | if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){ |
| 2112 | - prompt_user("unable to sign manifest. continue (y/N)? ", &ans); | |
| 2113 | - cReply = blob_str(&ans)[0]; | |
| 2145 | + if( !noPrompt ){ | |
| 2146 | + prompt_user("unable to sign manifest. continue (y/N)? ", &ans); | |
| 2147 | + cReply = blob_str(&ans)[0]; | |
| 2148 | + blob_reset(&ans); | |
| 2149 | + }else{ | |
| 2150 | + fossil_print("Abandoning commit due to manifest signing failure\n"); | |
| 2151 | + cReply = 'N'; | |
| 2152 | + } | |
| 2114 | 2153 | if( cReply!='y' && cReply!='Y' ){ |
| 2115 | 2154 | fossil_exit(1); |
| 2116 | 2155 | } |
| 2117 | 2156 | } |
| 2118 | 2157 | |
| 2119 | 2158 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1470,10 +1470,11 @@ | |
| 1470 | static int commit_warning( |
| 1471 | Blob *p, /* The content of the file being committed. */ |
| 1472 | int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */ |
| 1473 | int binOk, /* Non-zero if binary warnings should be disabled. */ |
| 1474 | int encodingOk, /* Non-zero if encoding warnings should be disabled. */ |
| 1475 | const char *zFilename /* The full name of the file being committed. */ |
| 1476 | ){ |
| 1477 | int bReverse; /* UTF-16 byte order is reversed? */ |
| 1478 | int fUnicode; /* return value of could_be_utf16() */ |
| 1479 | int fBinary; /* does the blob content appear to be binary? */ |
| @@ -1562,13 +1563,18 @@ | |
| 1562 | zMsg = mprintf( |
| 1563 | "%s contains %s. Use --no-warnings or the %s to" |
| 1564 | " disable this warning.\n" |
| 1565 | "Commit anyhow (a=all/%sy/N)? ", |
| 1566 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 1567 | prompt_user(zMsg, &ans); |
| 1568 | fossil_free(zMsg); |
| 1569 | cReply = blob_str(&ans)[0]; |
| 1570 | if( cReply=='a' || cReply=='A' ){ |
| 1571 | allOk = 1; |
| 1572 | }else if( *zConvert && (cReply=='c' || cReply=='C') ){ |
| 1573 | char *zOrig = file_newname(zFilename, "original", 1); |
| 1574 | FILE *f; |
| @@ -1595,11 +1601,10 @@ | |
| 1595 | return 1; |
| 1596 | }else if( cReply!='y' && cReply!='Y' ){ |
| 1597 | fossil_fatal("Abandoning commit due to %s in %s", |
| 1598 | zWarning, blob_str(&fname)); |
| 1599 | } |
| 1600 | blob_reset(&ans); |
| 1601 | blob_reset(&fname); |
| 1602 | } |
| 1603 | return 0; |
| 1604 | } |
| 1605 | |
| @@ -1683,10 +1688,13 @@ | |
| 1683 | ** --integrate close all merged-in branches |
| 1684 | ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment |
| 1685 | ** -M|--message-file FILE read the commit comment from given file |
| 1686 | ** --mimetype MIMETYPE mimetype of check-in comment |
| 1687 | ** -n|--dry-run If given, display instead of run actions |
| 1688 | ** --no-warnings omit all warnings about file contents |
| 1689 | ** --nosign do not attempt to sign this commit with gpg |
| 1690 | ** --private do not sync changes and their descendants |
| 1691 | ** --sha1sum verify file status using SHA1 hashing rather |
| 1692 | ** than relying on file mtimes |
| @@ -1713,10 +1721,11 @@ | |
| 1713 | char *zUuid; /* UUID of the new check-in */ |
| 1714 | int useSha1sum = 0; /* True to verify file status using SHA1 hashing */ |
| 1715 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1716 | int isAMerge = 0; /* True if checking in a merge */ |
| 1717 | int noWarningFlag = 0; /* True if skipping all warnings */ |
| 1718 | int forceFlag = 0; /* Undocumented: Disables all checks */ |
| 1719 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1720 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1721 | int allowConflict = 0; /* Allow unresolve merge conflicts */ |
| 1722 | int allowEmpty = 0; /* Allow a commit with no changes */ |
| @@ -1760,10 +1769,11 @@ | |
| 1760 | forceFlag = find_option("force", "f", 0)!=0; |
| 1761 | allowConflict = find_option("allow-conflict",0,0)!=0; |
| 1762 | allowEmpty = find_option("allow-empty",0,0)!=0; |
| 1763 | allowFork = find_option("allow-fork",0,0)!=0; |
| 1764 | allowOlder = find_option("allow-older",0,0)!=0; |
| 1765 | noWarningFlag = find_option("no-warnings", 0, 0)!=0; |
| 1766 | sCiInfo.zBranch = find_option("branch","b",1); |
| 1767 | sCiInfo.zColor = find_option("bgcolor",0,1); |
| 1768 | sCiInfo.zBrClr = find_option("branchcolor",0,1); |
| 1769 | sCiInfo.closeFlag = find_option("close",0,0)!=0; |
| @@ -1829,12 +1839,18 @@ | |
| 1829 | |
| 1830 | /* Require confirmation to continue with the check-in if there is |
| 1831 | ** clock skew |
| 1832 | */ |
| 1833 | if( g.clockSkewSeen ){ |
| 1834 | prompt_user("continue in spite of time skew (y/N)? ", &ans); |
| 1835 | cReply = blob_str(&ans)[0]; |
| 1836 | if( cReply!='y' && cReply!='Y' ){ |
| 1837 | fossil_exit(1); |
| 1838 | } |
| 1839 | } |
| 1840 | |
| @@ -1847,13 +1863,20 @@ | |
| 1847 | ** array is allocated to contain the "id" field from the vfile table |
| 1848 | ** for each file to be committed. Or, if aCommitFile is NULL, all files |
| 1849 | ** should be committed. |
| 1850 | */ |
| 1851 | if( select_commit_files() ){ |
| 1852 | prompt_user("continue (y/N)? ", &ans); |
| 1853 | cReply = blob_str(&ans)[0]; |
| 1854 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1); |
| 1855 | } |
| 1856 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1857 | if( g.aCommitFile && isAMerge ){ |
| 1858 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1859 | } |
| @@ -1954,26 +1977,35 @@ | |
| 1954 | blob_append(&comment, zComment, -1); |
| 1955 | }else if( zComFile ){ |
| 1956 | blob_zero(&comment); |
| 1957 | blob_read_from_file(&comment, zComFile); |
| 1958 | blob_to_utf8_no_bom(&comment, 1); |
| 1959 | }else if(dryRunFlag){ |
| 1960 | blob_zero(&comment); |
| 1961 | }else{ |
| 1962 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1963 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1964 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1965 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1966 | cReply = blob_str(&ans)[0]; |
| 1967 | if( cReply!='y' && cReply!='Y' ) fossil_exit(1); |
| 1968 | } |
| 1969 | free(zInit); |
| 1970 | } |
| 1971 | if( blob_size(&comment)==0 ){ |
| 1972 | if( !dryRunFlag ){ |
| 1973 | prompt_user("empty check-in comment. continue (y/N)? ", &ans); |
| 1974 | cReply = blob_str(&ans)[0]; |
| 1975 | if( cReply!='y' && cReply!='Y' ){ |
| 1976 | fossil_exit(1); |
| 1977 | } |
| 1978 | } |
| 1979 | }else{ |
| @@ -2023,11 +2055,12 @@ | |
| 2023 | blob_read_from_file(&content, zFullname); |
| 2024 | } |
| 2025 | /* Do not emit any warnings when they are disabled. */ |
| 2026 | if( !noWarningFlag ){ |
| 2027 | abortCommit |= commit_warning(&content, crnlOk, binOk, |
| 2028 | encodingOk, zFullname); |
| 2029 | } |
| 2030 | if( contains_merge_marker(&content) ){ |
| 2031 | Blob fname; /* Relative pathname of the file */ |
| 2032 | |
| 2033 | nConflict++; |
| @@ -2107,12 +2140,18 @@ | |
| 2107 | }else if( forceDelta ){ |
| 2108 | fossil_fatal("unable to find a baseline-manifest for the delta"); |
| 2109 | } |
| 2110 | } |
| 2111 | if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){ |
| 2112 | prompt_user("unable to sign manifest. continue (y/N)? ", &ans); |
| 2113 | cReply = blob_str(&ans)[0]; |
| 2114 | if( cReply!='y' && cReply!='Y' ){ |
| 2115 | fossil_exit(1); |
| 2116 | } |
| 2117 | } |
| 2118 | |
| 2119 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1470,10 +1470,11 @@ | |
| 1470 | static int commit_warning( |
| 1471 | Blob *p, /* The content of the file being committed. */ |
| 1472 | int crnlOk, /* Non-zero if CR/NL warnings should be disabled. */ |
| 1473 | int binOk, /* Non-zero if binary warnings should be disabled. */ |
| 1474 | int encodingOk, /* Non-zero if encoding warnings should be disabled. */ |
| 1475 | int noPrompt, /* Non-zero to disable prompts and assume 'No'. */ |
| 1476 | const char *zFilename /* The full name of the file being committed. */ |
| 1477 | ){ |
| 1478 | int bReverse; /* UTF-16 byte order is reversed? */ |
| 1479 | int fUnicode; /* return value of could_be_utf16() */ |
| 1480 | int fBinary; /* does the blob content appear to be binary? */ |
| @@ -1562,13 +1563,18 @@ | |
| 1563 | zMsg = mprintf( |
| 1564 | "%s contains %s. Use --no-warnings or the %s to" |
| 1565 | " disable this warning.\n" |
| 1566 | "Commit anyhow (a=all/%sy/N)? ", |
| 1567 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 1568 | if( !noPrompt ){ |
| 1569 | prompt_user(zMsg, &ans); |
| 1570 | cReply = blob_str(&ans)[0]; |
| 1571 | blob_reset(&ans); |
| 1572 | }else{ |
| 1573 | cReply = 'N'; |
| 1574 | } |
| 1575 | fossil_free(zMsg); |
| 1576 | if( cReply=='a' || cReply=='A' ){ |
| 1577 | allOk = 1; |
| 1578 | }else if( *zConvert && (cReply=='c' || cReply=='C') ){ |
| 1579 | char *zOrig = file_newname(zFilename, "original", 1); |
| 1580 | FILE *f; |
| @@ -1595,11 +1601,10 @@ | |
| 1601 | return 1; |
| 1602 | }else if( cReply!='y' && cReply!='Y' ){ |
| 1603 | fossil_fatal("Abandoning commit due to %s in %s", |
| 1604 | zWarning, blob_str(&fname)); |
| 1605 | } |
| 1606 | blob_reset(&fname); |
| 1607 | } |
| 1608 | return 0; |
| 1609 | } |
| 1610 | |
| @@ -1683,10 +1688,13 @@ | |
| 1688 | ** --integrate close all merged-in branches |
| 1689 | ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment |
| 1690 | ** -M|--message-file FILE read the commit comment from given file |
| 1691 | ** --mimetype MIMETYPE mimetype of check-in comment |
| 1692 | ** -n|--dry-run If given, display instead of run actions |
| 1693 | ** --no-prompt This option disables prompting the user for |
| 1694 | ** input and assumes an answer of 'No' for every |
| 1695 | ** question. |
| 1696 | ** --no-warnings omit all warnings about file contents |
| 1697 | ** --nosign do not attempt to sign this commit with gpg |
| 1698 | ** --private do not sync changes and their descendants |
| 1699 | ** --sha1sum verify file status using SHA1 hashing rather |
| 1700 | ** than relying on file mtimes |
| @@ -1713,10 +1721,11 @@ | |
| 1721 | char *zUuid; /* UUID of the new check-in */ |
| 1722 | int useSha1sum = 0; /* True to verify file status using SHA1 hashing */ |
| 1723 | int noSign = 0; /* True to omit signing the manifest using GPG */ |
| 1724 | int isAMerge = 0; /* True if checking in a merge */ |
| 1725 | int noWarningFlag = 0; /* True if skipping all warnings */ |
| 1726 | int noPrompt = 0; /* True if skipping all prompts */ |
| 1727 | int forceFlag = 0; /* Undocumented: Disables all checks */ |
| 1728 | int forceDelta = 0; /* Force a delta-manifest */ |
| 1729 | int forceBaseline = 0; /* Force a baseline-manifest */ |
| 1730 | int allowConflict = 0; /* Allow unresolve merge conflicts */ |
| 1731 | int allowEmpty = 0; /* Allow a commit with no changes */ |
| @@ -1760,10 +1769,11 @@ | |
| 1769 | forceFlag = find_option("force", "f", 0)!=0; |
| 1770 | allowConflict = find_option("allow-conflict",0,0)!=0; |
| 1771 | allowEmpty = find_option("allow-empty",0,0)!=0; |
| 1772 | allowFork = find_option("allow-fork",0,0)!=0; |
| 1773 | allowOlder = find_option("allow-older",0,0)!=0; |
| 1774 | noPrompt = find_option("no-prompt", 0, 0)!=0; |
| 1775 | noWarningFlag = find_option("no-warnings", 0, 0)!=0; |
| 1776 | sCiInfo.zBranch = find_option("branch","b",1); |
| 1777 | sCiInfo.zColor = find_option("bgcolor",0,1); |
| 1778 | sCiInfo.zBrClr = find_option("branchcolor",0,1); |
| 1779 | sCiInfo.closeFlag = find_option("close",0,0)!=0; |
| @@ -1829,12 +1839,18 @@ | |
| 1839 | |
| 1840 | /* Require confirmation to continue with the check-in if there is |
| 1841 | ** clock skew |
| 1842 | */ |
| 1843 | if( g.clockSkewSeen ){ |
| 1844 | if( !noPrompt ){ |
| 1845 | prompt_user("continue in spite of time skew (y/N)? ", &ans); |
| 1846 | cReply = blob_str(&ans)[0]; |
| 1847 | blob_reset(&ans); |
| 1848 | }else{ |
| 1849 | fossil_print("Abandoning commit due to time skew\n"); |
| 1850 | cReply = 'N'; |
| 1851 | } |
| 1852 | if( cReply!='y' && cReply!='Y' ){ |
| 1853 | fossil_exit(1); |
| 1854 | } |
| 1855 | } |
| 1856 | |
| @@ -1847,13 +1863,20 @@ | |
| 1863 | ** array is allocated to contain the "id" field from the vfile table |
| 1864 | ** for each file to be committed. Or, if aCommitFile is NULL, all files |
| 1865 | ** should be committed. |
| 1866 | */ |
| 1867 | if( select_commit_files() ){ |
| 1868 | if( !noPrompt ){ |
| 1869 | prompt_user("continue (y/N)? ", &ans); |
| 1870 | cReply = blob_str(&ans)[0]; |
| 1871 | blob_reset(&ans); |
| 1872 | }else{ |
| 1873 | cReply = 'N'; |
| 1874 | } |
| 1875 | if( cReply!='y' && cReply!='Y' ){ |
| 1876 | fossil_exit(1); |
| 1877 | } |
| 1878 | } |
| 1879 | isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2"); |
| 1880 | if( g.aCommitFile && isAMerge ){ |
| 1881 | fossil_fatal("cannot do a partial commit of a merge"); |
| 1882 | } |
| @@ -1954,26 +1977,35 @@ | |
| 1977 | blob_append(&comment, zComment, -1); |
| 1978 | }else if( zComFile ){ |
| 1979 | blob_zero(&comment); |
| 1980 | blob_read_from_file(&comment, zComFile); |
| 1981 | blob_to_utf8_no_bom(&comment, 1); |
| 1982 | }else if( dryRunFlag ){ |
| 1983 | blob_zero(&comment); |
| 1984 | }else if( !noPrompt ){ |
| 1985 | char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'"); |
| 1986 | prepare_commit_comment(&comment, zInit, &sCiInfo, vid); |
| 1987 | if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){ |
| 1988 | prompt_user("unchanged check-in comment. continue (y/N)? ", &ans); |
| 1989 | cReply = blob_str(&ans)[0]; |
| 1990 | blob_reset(&ans); |
| 1991 | if( cReply!='y' && cReply!='Y' ){ |
| 1992 | fossil_exit(1); |
| 1993 | } |
| 1994 | } |
| 1995 | free(zInit); |
| 1996 | } |
| 1997 | if( blob_size(&comment)==0 ){ |
| 1998 | if( !dryRunFlag ){ |
| 1999 | if( !noPrompt ){ |
| 2000 | prompt_user("empty check-in comment. continue (y/N)? ", &ans); |
| 2001 | cReply = blob_str(&ans)[0]; |
| 2002 | blob_reset(&ans); |
| 2003 | }else{ |
| 2004 | fossil_print("Abandoning commit due to empty check-in comment\n"); |
| 2005 | cReply = 'N'; |
| 2006 | } |
| 2007 | if( cReply!='y' && cReply!='Y' ){ |
| 2008 | fossil_exit(1); |
| 2009 | } |
| 2010 | } |
| 2011 | }else{ |
| @@ -2023,11 +2055,12 @@ | |
| 2055 | blob_read_from_file(&content, zFullname); |
| 2056 | } |
| 2057 | /* Do not emit any warnings when they are disabled. */ |
| 2058 | if( !noWarningFlag ){ |
| 2059 | abortCommit |= commit_warning(&content, crnlOk, binOk, |
| 2060 | encodingOk, noPrompt, |
| 2061 | zFullname); |
| 2062 | } |
| 2063 | if( contains_merge_marker(&content) ){ |
| 2064 | Blob fname; /* Relative pathname of the file */ |
| 2065 | |
| 2066 | nConflict++; |
| @@ -2107,12 +2140,18 @@ | |
| 2140 | }else if( forceDelta ){ |
| 2141 | fossil_fatal("unable to find a baseline-manifest for the delta"); |
| 2142 | } |
| 2143 | } |
| 2144 | if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){ |
| 2145 | if( !noPrompt ){ |
| 2146 | prompt_user("unable to sign manifest. continue (y/N)? ", &ans); |
| 2147 | cReply = blob_str(&ans)[0]; |
| 2148 | blob_reset(&ans); |
| 2149 | }else{ |
| 2150 | fossil_print("Abandoning commit due to manifest signing failure\n"); |
| 2151 | cReply = 'N'; |
| 2152 | } |
| 2153 | if( cReply!='y' && cReply!='Y' ){ |
| 2154 | fossil_exit(1); |
| 2155 | } |
| 2156 | } |
| 2157 | |
| 2158 |