TFS exclude a directory - .tfignore not working and it is a very large directory - tfs

I have seen other posts and read them on stackoverflow - How to ignore files/directories in TFS for avoiding them to go to central source repository?
However this does not seem to work.
I have a folder of the root called /FS which in that directory I have the following .tfignore
################################################################################
# This .tfignore file was automatically created by Microsoft(R) Visual Studio.
#
# Local items matching filespecs in this file will not be added to version
# control. This file can be checked in to share exclusions with others.
#
# Wildcard characters are * and ?. Patterns are matched recursively unless the
# pattern is prefixed by the \ character.
#
# You can prepend a path to a pattern to make it more specific. If you do,
# wildcard characters are not permitted in the path portion.
#
# The # character at the beginning of a line indicates a comment.
#
# The ! prefix negates a pattern. This can be used to re-include an item after
# it was excluded by a .tfignore file higher in the tree, or by the Team
# Project Collection's global exclusions list.
#
# The / character is interpreted as a \ character on Windows platforms.
#
# Examples:
#
# # Excludes all files ending in .txt in Alpha\Beta and all its subfolders.
# Alpha\Beta\*.txt
#
# # Excludes all files ending in .cpp in this folder only.
# \*.cpp
#
# # Excludes all files ending in .cpp in this folder and all subfolders.
# *.cpp
#
# # If "Contoso" is a folder, then Contoso and all its children are excluded.
# # If it is a file, then only the "Contoso" in this folder is excluded.
# \Contoso
#
# # If Help.exe is excluded by a higher .tfignore file or by the Team Project
# # Collection global exclusions list, then this pattern re-includes it in
# # this folder only.
# !\Help.exe
#
################################################################################
\BRAND
\CO
\COVER
\COVERBANNER
\DEPT
\DEPT-CATS
\LIB
\PRODUCTS
However, TFS keeps trying to add these directories. I even have at the root directory another .tfignore
/FS
I simply need /FS out of TFS. This is 15GB workth of images that does not belong in SOURCE control, we have multiple areas where these images are backed up and this is very resource intense creating branches.
Do I need to delete the /FS from TFS with CMD PROMPT? Any help would be great. I am simply frustrated and stuck.

I would assume that .tfignore works the same with local and server workspaces, so:
Yes, you have to delete \FS from source control, but doing so from the Team Explorer should suffice.
Add a .tfignore in \FSs parent directory.
This will ensure that your \FS folder does not sit in source control and get copied over when you make a new branch.

This is an old post, but I'm providing an answer anyway since I stumbled upon the same issue and finally found an answer:
Someone commented that .tfignore only works with local workspaces -> this is correct
The syntax for excluding entire subfolders within your current folder (where your .tfignore file resides) can be either of those:
/subfolder
\subfolder
If you want to exclude subfolders of subfolders or files in subfolders of it can be either of those or something similar (depending on what you want to filter out):
/subfolder/subsubfolder
\subfolder\subsubfolder
/subfolder/*.txt
\subfolder*.txt
It is noteworthy that tf.exe has some strange quirks, when anything isn't right nothing in .tfignore will have effect and you will not receive any visible error message (maybe hidden somewhere in some log, not sure). At first I thought I was having some issue with line endings, because when I added a new line with a new entry then nothing got excluded, only after adding a blank line in between. Later I noticed that it seems like tf.exe is doing some kind of validation that doesn't always succeed the first time for certain syntaxes. Hard to put my finger on under what scenarios exactly that happens, but it works the second time.
I suggest anyone doing this having the text editor open and save your changes in .tfignore, then check in Team Explorer if the detected files disappear (which they should if they're ignored). When this doesn't work within 1 to 3 seconds, try just saving the .tfignore file again without changing anything, then it'll probably work. I've seen this bevahior now 100 times.
After editing and saving .tfignore file:
After a blank re-save of the file:

Related

How to overwrite sphinx/locale/{language}/LC_MESSAGES/sphinx.po?

I'd like to overwrite admonition labels.
Admonitions are directives such as note, warning, and so on.
For Japanese, the labels are defined in
https://github.com/sphinx-doc/sphinx/blob/master/sphinx/locale/ja/LC_MESSAGES/sphinx.po.
Is there a simple way to overwrite them without changing the master repository?
Here is what works for me (tested with Sphinx 3.3.1):
Copy the Japanese sphinx.po from <sphinx_install_dir>/sphinx/locale/ja/LC_MESSAGES/
to <your_sphinx_proj>/locales/ja/LC_MESSAGES/.
Note the directory name locales (the default value of the locale_dirs configuration option).
Edit msgstr for the relevant entries (admonitions in this case) in the copy of sphinx.po.
It is not necessary to keep the entire copy. You can remove the unchanged entries if you want.
Run sphinx-build with language=ja (set it in conf.py or on the command line). A local project-specific sphinx.mo file is generated and used in the build.
This means that there will be two *.mo files for the same domain ("sphinx"). The local sphinx.mo is consulted first, and the original sphinx.mo that comes with Sphinx is used as the fallback.

Flume: How to track specified sub folders using spoolDir?

We're having a system uploads log files into a folder which named by date. It looks like:
/logs
/20181030
/20181031
/20181101
/20181102
/...
Suppose that I want to track the log files which produced during November by using spoolDir, How could I do this ?
#this won't work
a1.sources.r1.spoolDir = /logs/201811??
#this seems only works with files. Is it possible to filter folders here?
a1.sources.r1.includePattern = ^.*\.txt$
Acoording to the flume source code, folders that match the ignorePattern are skipped while recursing the folder tree(to register folder trackers). So you can ignore the folders which don't match your criteria. ^(?!201811..).*$ would exclude all the folders that are not folders of November 2018. Other folders will not be tracked.
But this pattern will also apply to file names. So any file with name that does not match ^201811..$ will also be ignored. You can add the ^.*\.txt$ pattern (the one you are using for the include pattern) to the regex to make flume accept your input files.
a1.sources.r1.ignorePattern = ^(?!(201810..)|(.*\\.txt)).*$
would do the trick for you.

Flume "Spooling Directory Source" recursive-look for the the files within subdirectories

I am looking for the Flume "Spooling Directory Source" recursive-look for the the files within subdirectories.
There are some references here https://issues.apache.org/jira/browse/FLUME-1899
however since then multiple versions have come out, is there any way we can have recursive directory lookup within subdirectories for the files in Spooling Source.
I think you can use the patch FLUME-1899-2.patch directly.
set the "recursiveDirectorySearch" as ture in your config file.
NOTE: the regex in ignorePattern of config file will also affect the recursiveDirectory folder name. so you might need to modify the code in org/apache/flume/client/avro/ReliableSpoolingFileEventReader.java if you want to ignore the folder name.

tfignore wildcard directory segment

Is it possible using .tfignore to add a wildcard to directories? I assumed it would have been a case of just adding an asterisk wildcard to the directory segment. For example:
\path\*\local.properties
However this does not work and I am unsure how I would achieve such behaviour without explicitly declaring every reference that I need excluding. .
Documentation
# begins a comment line
The * and ? wildcards are supported.
A filespec is recursive unless prefixed by the \ character.
! negates a filespec (files that match the pattern are not ignored)
Extract from the documentation.
The documentation should more correctly read:
The * and ? wildcards are supported in the leaf name only.
That is, you can use something like these to select multiple files or multiple subdirectories, respectively, in a common parent:
/path/to/my/file/foo*.txt
/path/to/my/directories/temp*
What may work in your case--to ignore the same file in multiple directories--is just this:
foo*.txt
That is, specify a path-less name or glob pattern to ignore matching files throughout your tree. Unfortunately you have only those two options, local or global; you cannot use a relative path like this--it will not match any files!
my/file/foo*.txt
The global option is a practical one because .tfignore only affects unversioned files. Once you add a file to source control, changes to that file will be properly recognized. Furthermore, if you need to add an instance of an ignored name to source control, you can always go into TFS source control explorer and manually add it.
It seems this is now supported
As you see I edited tfignore in the root folder of the project such that any new branch will ignore its .vs folder when being examined for source control changes
\*\.vs
Directory/folder name wildcarding works for me in VS2019 Professional. For example if I put this in .tfignore:
*uncheckedToTFS
The above will ignore any folder named ending with "uncheckedToTFS", regardless of where the folder is (it doesn't have to be top level folder, can be many levels deep).

Git ignore all files in directory expect for specified

My rails app uploads all users photos to a folder /uploads/photos/. I want to ignore everything in this folder in git except for one subfolder /uploads/photos/default/.
Is this possible using the .gitignore file?
You can use the prefix !
From the man page
An optional prefix ! which negates the
pattern; any matching file excluded by
a previous pattern will become
included again. If a negated pattern
matches, this will override lower
precedence patterns sources.
# ignore generated html files,
*.html
# except foo.html which is maintained by hand
!foo.html
Although I wouldn't normally store user-generated content in the same hierarchy as my code base/repository.

Resources