Fossil SCM

If the "fossil diff" command has a directory argument, then run a "fossil ui" diff on that check-out.

drh 2024-12-10 13:58 trunk
Commit 099ed5b97b2d1194f6bd4794af6ef3e838dea2c04f018d5cc34f30b100f96b10
1 file changed +24
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1314,10 +1314,34 @@
13141314
if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){
13151315
fossil_fatal("cannot use --checkin together with --from or --to");
13161316
}
13171317
diff_options(&DCfg, isGDiff, 0);
13181318
determine_exec_relative_option(1);
1319
+
1320
+ /* If there is a single argument which is the name of a directory that
1321
+ ** appears to be a Fossil check-out, then convert this "diff" into
1322
+ ** a command like the following that runs a diff on the checkout that
1323
+ ** appears in the browser.
1324
+ **
1325
+ ** fossil ui DIR --page ckout
1326
+ */
1327
+ if( g.argc==3
1328
+ && (dir_has_ckout_db(g.argv[2]) || file_skip_userhost(g.argv[2]))
1329
+ ){
1330
+ char *azNew[10];
1331
+ azNew[0] = g.argv[0];
1332
+ azNew[1] = "ui";
1333
+ azNew[2] = g.argv[2];
1334
+ azNew[3] = "--page";
1335
+ azNew[4] = "ckout";
1336
+ azNew[5] = 0;
1337
+ g.argc = 5;
1338
+ g.argv = azNew;
1339
+ cmd_webserver();
1340
+ return;
1341
+ }
1342
+
13191343
if( 0==zCheckin ){
13201344
if( zTo==0 || againstUndo ){
13211345
db_must_be_within_tree();
13221346
}else if( zFrom==0 ){
13231347
fossil_fatal("must use --from if --to is present");
13241348
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1314,10 +1314,34 @@
1314 if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){
1315 fossil_fatal("cannot use --checkin together with --from or --to");
1316 }
1317 diff_options(&DCfg, isGDiff, 0);
1318 determine_exec_relative_option(1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1319 if( 0==zCheckin ){
1320 if( zTo==0 || againstUndo ){
1321 db_must_be_within_tree();
1322 }else if( zFrom==0 ){
1323 fossil_fatal("must use --from if --to is present");
1324
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1314,10 +1314,34 @@
1314 if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){
1315 fossil_fatal("cannot use --checkin together with --from or --to");
1316 }
1317 diff_options(&DCfg, isGDiff, 0);
1318 determine_exec_relative_option(1);
1319
1320 /* If there is a single argument which is the name of a directory that
1321 ** appears to be a Fossil check-out, then convert this "diff" into
1322 ** a command like the following that runs a diff on the checkout that
1323 ** appears in the browser.
1324 **
1325 ** fossil ui DIR --page ckout
1326 */
1327 if( g.argc==3
1328 && (dir_has_ckout_db(g.argv[2]) || file_skip_userhost(g.argv[2]))
1329 ){
1330 char *azNew[10];
1331 azNew[0] = g.argv[0];
1332 azNew[1] = "ui";
1333 azNew[2] = g.argv[2];
1334 azNew[3] = "--page";
1335 azNew[4] = "ckout";
1336 azNew[5] = 0;
1337 g.argc = 5;
1338 g.argv = azNew;
1339 cmd_webserver();
1340 return;
1341 }
1342
1343 if( 0==zCheckin ){
1344 if( zTo==0 || againstUndo ){
1345 db_must_be_within_tree();
1346 }else if( zFrom==0 ){
1347 fossil_fatal("must use --from if --to is present");
1348

Keyboard Shortcuts

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