Fossil SCM

Removed some irrelevant comments.

stephan 2020-05-02 22:34 UTC checkin-without-checkout
Commit 7243aea14a7cde83f589009e2170e725497cb8915ed30ba9339df8be3124f582
1 file changed +16 -22
+16 -22
--- src/checkin.c
+++ src/checkin.c
@@ -2699,10 +2699,13 @@
26992699
27002700
/*
27012701
** State for the "mini-checkin" infrastructure, which enables the
27022702
** ability to commit changes to a single file without a checkout
27032703
** db, e.g. for use via an HTTP request.
2704
+**
2705
+** Use CheckinMiniInfo_init() to cleanly initialize one to a known
2706
+** valid/empty default state.
27042707
**
27052708
** Memory for all non-const (char *) members is owned by the
27062709
** CheckinMiniInfo instance and is freed by CheckinMiniInfo_cleanup().
27072710
*/
27082711
struct CheckinMiniInfo {
@@ -3566,11 +3569,10 @@
35663569
char * zGlobs = db_get("fileedit-glob",0);
35673570
once = 1;
35683571
if(0==zGlobs) return 0;
35693572
pGlobs = glob_create(zGlobs);
35703573
fossil_free(zGlobs);
3571
- once = 1;
35723574
}
35733575
return glob_match(pGlobs, zFilename);
35743576
}
35753577
35763578
static void fileedit_emit_script(int phase){
@@ -3647,22 +3649,17 @@
36473649
** EXPERIMENTAL and subject to change and removal at any time. The goal
36483650
** is to allow online edits of files.
36493651
**
36503652
** Query parameters:
36513653
**
3652
-** file=FILE Repo-relative path to the file.
3653
-** r=VERSION Checkin version
3654
-**
3655
-** Parameters intended to be passed in only via the editor's own form:
3656
-**
3657
-** diff If true, show diff from prev version.
3658
-** preview If true, preview (how depends on mimetype).
3659
-** content File content.
3660
-** comment Checkin comment.
3661
-** n Optional comment mimetype ("n" as in N-card).
3662
-**
3663
-**
3654
+** file=FILENAME Repo-relative path to the file.
3655
+** r=VERSION Checkin version, using any unambiguous
3656
+** supported symbolic version name.
3657
+**
3658
+** All other parameters are for internal use only, submitted via the
3659
+** form-submission process, and may change with any given revision of
3660
+** this code.
36643661
*/
36653662
void fileedit_page(){
36663663
const char * zFilename = PD("file",P("name")); /* filename */
36673664
const char * zRev = P("r"); /* checkin version */
36683665
const char * zContent = P("content"); /* file content */
@@ -3697,19 +3694,16 @@
36973694
if(zFlagCheck){
36983695
cimi.zMimetype = mprintf("%s",zFlagCheck);
36993696
zFlagCheck = 0;
37003697
}
37013698
cimi.zUser = mprintf("%s",g.zLogin);
3702
- /*
3703
- ** TODOs include, but are not limited to:
3704
- **
3705
- ** - Preview button + view
3706
- **
3707
- ** - Diff button + view
3708
- **
3709
- */
3699
+
37103700
style_header("File Editor");
3701
+ /* As of this point, don't use return or fossil_fatal(), use
3702
+ ** fail((&err,...)) instead so that we can be sure to do any
3703
+ ** cleanup and end the transaction cleanly.
3704
+ */
37113705
if(!zRev || !*zRev || !zFilename || !*zFilename){
37123706
fail((&err,"Missing required URL parameters."));
37133707
}
37143708
if(0==fileedit_is_editable(zFilename)){
37153709
fail((&err,"Filename <code>%h</code> is disallowed "
@@ -3762,11 +3756,11 @@
37623756
/* ^^^ Appologies, Richard, but the @ form plays havoc with emacs */
37633757
37643758
fp("<h1>Editing:</h1>");
37653759
fp("<p class='fileedit-hint'>");
37663760
fp("File: <code>%h</code><br>"
3767
- "Version: <code id='r-label'>%s</code><br>",
3761
+ "Checkin Version: <code id='r-label'>%s</code><br>",
37683762
zFilename, cimi.zParentUuid);
37693763
fp("Permalink: <code>"
37703764
"<a id='permalink' href='%R/fileedit?file=%T&r=%!S'>"
37713765
"/fileedit?file=%T&r=%!S</a></code><br>"
37723766
"(Clicking the permalink will reload the page and discard "
37733767
--- src/checkin.c
+++ src/checkin.c
@@ -2699,10 +2699,13 @@
2699
2700 /*
2701 ** State for the "mini-checkin" infrastructure, which enables the
2702 ** ability to commit changes to a single file without a checkout
2703 ** db, e.g. for use via an HTTP request.
 
 
 
2704 **
2705 ** Memory for all non-const (char *) members is owned by the
2706 ** CheckinMiniInfo instance and is freed by CheckinMiniInfo_cleanup().
2707 */
2708 struct CheckinMiniInfo {
@@ -3566,11 +3569,10 @@
3566 char * zGlobs = db_get("fileedit-glob",0);
3567 once = 1;
3568 if(0==zGlobs) return 0;
3569 pGlobs = glob_create(zGlobs);
3570 fossil_free(zGlobs);
3571 once = 1;
3572 }
3573 return glob_match(pGlobs, zFilename);
3574 }
3575
3576 static void fileedit_emit_script(int phase){
@@ -3647,22 +3649,17 @@
3647 ** EXPERIMENTAL and subject to change and removal at any time. The goal
3648 ** is to allow online edits of files.
3649 **
3650 ** Query parameters:
3651 **
3652 ** file=FILE Repo-relative path to the file.
3653 ** r=VERSION Checkin version
3654 **
3655 ** Parameters intended to be passed in only via the editor's own form:
3656 **
3657 ** diff If true, show diff from prev version.
3658 ** preview If true, preview (how depends on mimetype).
3659 ** content File content.
3660 ** comment Checkin comment.
3661 ** n Optional comment mimetype ("n" as in N-card).
3662 **
3663 **
3664 */
3665 void fileedit_page(){
3666 const char * zFilename = PD("file",P("name")); /* filename */
3667 const char * zRev = P("r"); /* checkin version */
3668 const char * zContent = P("content"); /* file content */
@@ -3697,19 +3694,16 @@
3697 if(zFlagCheck){
3698 cimi.zMimetype = mprintf("%s",zFlagCheck);
3699 zFlagCheck = 0;
3700 }
3701 cimi.zUser = mprintf("%s",g.zLogin);
3702 /*
3703 ** TODOs include, but are not limited to:
3704 **
3705 ** - Preview button + view
3706 **
3707 ** - Diff button + view
3708 **
3709 */
3710 style_header("File Editor");
 
 
 
 
3711 if(!zRev || !*zRev || !zFilename || !*zFilename){
3712 fail((&err,"Missing required URL parameters."));
3713 }
3714 if(0==fileedit_is_editable(zFilename)){
3715 fail((&err,"Filename <code>%h</code> is disallowed "
@@ -3762,11 +3756,11 @@
3762 /* ^^^ Appologies, Richard, but the @ form plays havoc with emacs */
3763
3764 fp("<h1>Editing:</h1>");
3765 fp("<p class='fileedit-hint'>");
3766 fp("File: <code>%h</code><br>"
3767 "Version: <code id='r-label'>%s</code><br>",
3768 zFilename, cimi.zParentUuid);
3769 fp("Permalink: <code>"
3770 "<a id='permalink' href='%R/fileedit?file=%T&r=%!S'>"
3771 "/fileedit?file=%T&r=%!S</a></code><br>"
3772 "(Clicking the permalink will reload the page and discard "
3773
--- src/checkin.c
+++ src/checkin.c
@@ -2699,10 +2699,13 @@
2699
2700 /*
2701 ** State for the "mini-checkin" infrastructure, which enables the
2702 ** ability to commit changes to a single file without a checkout
2703 ** db, e.g. for use via an HTTP request.
2704 **
2705 ** Use CheckinMiniInfo_init() to cleanly initialize one to a known
2706 ** valid/empty default state.
2707 **
2708 ** Memory for all non-const (char *) members is owned by the
2709 ** CheckinMiniInfo instance and is freed by CheckinMiniInfo_cleanup().
2710 */
2711 struct CheckinMiniInfo {
@@ -3566,11 +3569,10 @@
3569 char * zGlobs = db_get("fileedit-glob",0);
3570 once = 1;
3571 if(0==zGlobs) return 0;
3572 pGlobs = glob_create(zGlobs);
3573 fossil_free(zGlobs);
 
3574 }
3575 return glob_match(pGlobs, zFilename);
3576 }
3577
3578 static void fileedit_emit_script(int phase){
@@ -3647,22 +3649,17 @@
3649 ** EXPERIMENTAL and subject to change and removal at any time. The goal
3650 ** is to allow online edits of files.
3651 **
3652 ** Query parameters:
3653 **
3654 ** file=FILENAME Repo-relative path to the file.
3655 ** r=VERSION Checkin version, using any unambiguous
3656 ** supported symbolic version name.
3657 **
3658 ** All other parameters are for internal use only, submitted via the
3659 ** form-submission process, and may change with any given revision of
3660 ** this code.
 
 
 
 
 
3661 */
3662 void fileedit_page(){
3663 const char * zFilename = PD("file",P("name")); /* filename */
3664 const char * zRev = P("r"); /* checkin version */
3665 const char * zContent = P("content"); /* file content */
@@ -3697,19 +3694,16 @@
3694 if(zFlagCheck){
3695 cimi.zMimetype = mprintf("%s",zFlagCheck);
3696 zFlagCheck = 0;
3697 }
3698 cimi.zUser = mprintf("%s",g.zLogin);
3699
 
 
 
 
 
 
 
3700 style_header("File Editor");
3701 /* As of this point, don't use return or fossil_fatal(), use
3702 ** fail((&err,...)) instead so that we can be sure to do any
3703 ** cleanup and end the transaction cleanly.
3704 */
3705 if(!zRev || !*zRev || !zFilename || !*zFilename){
3706 fail((&err,"Missing required URL parameters."));
3707 }
3708 if(0==fileedit_is_editable(zFilename)){
3709 fail((&err,"Filename <code>%h</code> is disallowed "
@@ -3762,11 +3756,11 @@
3756 /* ^^^ Appologies, Richard, but the @ form plays havoc with emacs */
3757
3758 fp("<h1>Editing:</h1>");
3759 fp("<p class='fileedit-hint'>");
3760 fp("File: <code>%h</code><br>"
3761 "Checkin Version: <code id='r-label'>%s</code><br>",
3762 zFilename, cimi.zParentUuid);
3763 fp("Permalink: <code>"
3764 "<a id='permalink' href='%R/fileedit?file=%T&r=%!S'>"
3765 "/fileedit?file=%T&r=%!S</a></code><br>"
3766 "(Clicking the permalink will reload the page and discard "
3767

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button