FossilSCM, ignoring files on add - fossil

I've done some research, but honestly can't seem to figure this out.
You can set some set some options to have fossil extras ignore files, but not fossil add? The configuration options through the web interface is great, and I'm pleased that it does work for the extras command, but it doesn't apply to the add command?
How does one configure fossil to ignore files on fossil add .?

You can use the settings ignore-glob command to list the directories/files to ignore as a comma-separated list.
On your repository's web interface, go to the Admin menu, select Settings and type the comma-separated list of directories to ignore; for example: */*.suo,*/*/bin/*,*/*/obj/*.
Alternatively, on the command line you can type fossil settings ignore-glob to list the applied ignore list, or fossil settings ignore-glob list-of-files.
You can also create/edit the .fossil-settings/ignore-glob at the root of the project and insert the comma-separated list of files/directories to ignore; I have not personally tested this, but I remember reading this online.
For example, on the command line you can do:
fossil settings ignore-glob "*/*.suo,*/*/bin/*,*/*/obj/*"
This would ignore all .suo files in every subdirectory at the Fossil repository root tree, and all the files in the bin and dir subdirectories at the each of the directory in the root directory.

If you want something like .gitignore or .hgignore, you can read https://www.fossil-scm.org/index.html/doc/tip/www/settings.wiki
mkdir .fossil-settings
echo '*/*.suo' >> .fossil-settings/ignore-glob
echo '*/*/bin/*' >> .fossil-settings/ignore-glob
fossil add .fossil-settings

See this check-in in fossil development repository. What you asked for has been implemented.

very recent versions of Fossil have an addremove command that will add all extras and remove all missing files in your working tree. The --ignore-glob switch is available.
Perhaps this is what you are looking for?
Otherwise you could probably just do :
fossil extras | xargs fossil add

On Windows 7 (not tested on other platforms)
If you do
fossil add *.*
All ignore-glob settings are ignored (all files are added).
If you do
fossil add .
then ignore-glob settings are used.

It is because I have already added the file, and fossil skipped the duplicated "add" operation, OMG.

Related

list directories (and subdirectories) of a svn remore repo

I need to list all directories and subdirectories recursively of a remote svn repo,
I tried to use
svn list http://....myrepository -R --depth=infinity
but I get also the files.
Is there a vay to instruct "svn list" in order to list only the folders without using any post processing as grep...?
No i am pretty sure it is not possible as of release 1.14.
What svn ls outputs is path and an option whether the path is a DIR or a FILE(you can check it out by exporting the ls in xml format).
There is a search option in svn ls that allows you to search "glob syntax" terms on path. There is no way to pass a glob argument to search that will only filter out the directories. You will have to use a post processing like grep or use an output xml file.
Additional example information,
if output from the
svn list http://....myrepository -R --depth=infinity
is
branch/folder1/
branch/folder1/file.file
And you try to search something as
svn list http://....myrepository -R --depth=infinity --search r"*/"
You will not get output of only folder1 as the / is added after the list has been outputed to the terminal.
It would be interesting to know the use case though, where this would be needed.
unfortunately your suggestion does not work with the svn version I have
$ svn --version
svn, version 1.9.12
.....
svn list http://...myRepo -R --depth=infinity --search r"*/"
Subcommand 'list' doesn't accept option '--search ARG'

Git - Ignore directories based on their contents

Using .gitignore, is there a way to ignore a directory if it contains a certain file (or directory)?
This would be something like look-ahead assertions, though my use case is a little different: I want to ignore Mercurial repos in my project, to keep from accidentally committing them as part of the project. That is, I want to ignore all directories containing .hg, not just .hg itself.
I can work around this using the answer from this question, adding each directory name to .gitignore, but I'd like to make it more general if I can.
There is no way to do it beside adding all of them to your .gitignore file.
What you can do it to write a scipt which append all the desired paths to your .gitignore.
The content of .gitignore is alist of paths so git can be configured based upon content.
Each line in a gitignore file specifies a pattern

How to add file with specific extension into fossil repository?

As title, I have several types of file stored in a folder (with sub-folders) that I use Fossil to keep a repository (e.g. foo.R; foo.xls; foo.csv), I only want my R files to be added into the repository. I only know using fossil add . to add all the files, and then use fossil delete *.csv to remove the files I don't need.
Is there a more efficient way?
In addition to Reimer Behrends’ answer: on the Windows command line, you can use the recursive for loop:
for /r . %F in (*.r) do #fossil add %F
to add all your .r files to the repository, including those in subfolders. (If your files are all in the same folder, fossil add *.r will do).
Note that if you want to use this in a batch or .cmd file, you'll have to double the percentage characters (%%):
for /r . %%F in (*.r) do fossil add %%F
There is no direct way to whitelist certain extensions, but there is a way to blacklist ones you don't need. This can be done via the fossil settings command, which can also be abbreviated as fossil set. For example, to exclude .xls and .csv files, you can do:
fossil set ignore-glob '*.xls,*.csv'
The ignore-glob setting is a variable that will accept a comma- or newline-separated list of glob patterns. These will be ignored by fossil add, fossil addremove, fossil clean and fossil extra. You can use fossil set ignore-glob to query the current value of this variable.
The alternative (which allows for whitelisting) is to explicitly specify the files that you are adding. For example, if you're on Unix, you can do something like:
fossil add $(find . -name '*.R')
to only add the files that you need. For some shells, fossil add **/*.R may also work, and if you don't have any subdirectories, fossil add *.R should work anywhere.

How can I force ag to find matches in node_modules?

I'm using ag to search a git repo. It doesn't find matches under my node_modules subdirectory. Why not, and how can I control this behavior?
It turns out that ag honors the contents of the .gitignore file by default. So if node_modules is in .gitignore, ag won't search it. This is all sensible behavior, but difficult to debug if you aren't expecting it. Hopefully this post will help.
There's a good summary at the end of man ag:
IGNORING FILES
By default, ag will ignore files whose names match patterns in .gitig-
nore, .hgignore, or .agignore. These files can be anywhere in the
directories being searched. Ag also ignores files matched by the
svn:ignore property if svn --version is 1.6 or older. Finally, ag looks
in $HOME/.agignore for ignore patterns. Binary files are ignored by
default as well.
If you want to ignore .gitignore, .hgignore, and svn:ignore, but still
take .agignore into account, use -U.
Use the -t option to search all text files; -a to search all files; and
-u to search all, including hidden files.
For my purposes ag -t seems to work well.

Fossil add for external directory

I have read some of the questions and answers here, but it none match my situation exactly.
I want to keep all my fossil repos in a single place.
so I have
c:\Fossil_Repos\ with a repo for WebPages_Repo and another for Dev_repo etc etc etc
I would like to keep my original web pages and development pages in separated directories that are oustide of the Fossil_Repos directory, here is my structure
c:\Fossile_Repos\
c:\DevEnvironment\
c:\WebPageDevelopment\
This structure seems not to be unreasonable.
If from within my c:\Fossile_Repos\ I run the commands
fossil open Dev_Repo
fossil add c:\DevEnvironment
Then I see a listing of all the directories and files underneath c:\DevEnvironment, however I then go on to add
fossil commit -m "first deposit"
And get an error message on the first file saying the file doesn't exist. Note that the file path is correct (however it report the direcory as C:/DevEnvironment/firstFile.xml using the unix method of file separators)
Anyone got any thoughts on if I can do this or not?
thanks in advance
David
You can keep the repos wherever you like. However, you must issue the commands to fossil from inside the checkout.
So, in your example:
cd c:\DevEnvironment
fossil open c:\Fossile_Repos\repo_file_name
.. edit the files ...
fossil commit -m "first deposit"