Fossil Forum

RFC: substitution parameter for named lists of files and globs
Login

RFC: substitution parameter for named lists of files and globs

RFC: substitution parameter for named lists of files and globs

(1) By MBL (RoboManni) on 2023-02-17 16:37:36 [source]

I have some check-outs with many files but only of some few types: scripts, configurations, executables, etc. or by name of their source.

When I create check-ins often I want and have to select several files out of many for a commit and for that I have to list the files individually.

In other cases I have to change the check-out ( with co --force --keep ) to do a check-in of some few files out of them all; every day the same procedure.

From what I know of GIT they use a so-called stage to get the files worked-on for a commit together. Fossil-scm is not GIT, I know, but something similar or even more powerful could be created with big benefit for fossil. Let me explain my proposal.

With a new command fossil stage add NAME <list of files and globs...> some kind of key-value lookup table could be filled.

With two other commands stage edit and stage delete the list could be adapted; this is analog to how the hook function calls are registered.

Fossil commands, where a list of files or globs are permitted, could be enhanced to know about a new parameter, eg. -s or --stage or --substitute

fossil update -s NAME

fossil changes --all -s NAME

fossil commit -s NAME

fossil commit -s NAME [other files and globs]

-s NAME would be the short form for all the listed files and folders (and optional additional files in usual form are still possible).

The storage place could be in the repository or in the global config file or inside the vvar table of the checkout file; all would be good.

In more generalized form -s could be used for any command line parameter substitutions; an alias for a common set of command line parameters.

The fossil command parameter line check could use the -s NAME to substitute it with the list of the looked-up files and globs.

Does this sound feasible and of bigger help also for a bigger group of fossil users?

(2) By Kees Nuyt (knu) on 2023-02-17 19:05:42 in reply to 1 [link] [source]

Just my 2 cents: I don't see the need.

First of all, remember you can have multiple independent checkouts of the same repository, each with a different set of files you are working on.

The functions of your stage proposal can easily be done with bash (or any other shell):

STAGED='<list of files and globs...>'
fossil commit -m 'checkin message' $STAGED

# stage add:
STAGED+='another name'

# stage delete:
STAGED=$(echo $STAGED | grep -v 'name_to_delete')
or
STAGED=${STAGED/name_to_delete/}

Just don't use whitespace in the names of directories and files.