For example, I have files structure:
app
- media
media
If I add line
media
to .hgignore, both folders (media, app/media) will be excluded. But I want to exclude only media folder from project root (./media). I need a solution, which will work in Linux and Windows.
It's just a regular expression (unless you've switched it to glob with syntax: glob in the file). Therefore, you can use ^ to match the start of the path (as it is inside the repository) and $ to match the end.
^media$
I have a similar need and I put in the following in the ignore file:
^target/.*
/target/.*
The first entry will ignore the target dir in the root directory.
The second entry will ignore any target dir in inner directories.
Works well for us (both win and linux)
I hope this helps.
Related
I need Bamboo to build the project automatically when a file in "api" subfolder changes. When a file in any other subfolder changes the bamboo build plan shouldn't run.
Folder structure:
project
- api
- ui
- core
In the Plan Configuration repositories tab, from the "Include / exclude files" dropdown I have selected the following option
Include only changes that matches the following pattern
and I have tried the following patterns:
.*/api/.*
api/
api/*
api\/*
api/**
/api/*
but the build plan isn't running. With "Include / exclude files" dropdown set to None the build plan runs (but does so when a file changes in any other subfolder also)
I can't split the project up to different repositories.
What pattern should I use or is there any other solution for this?
Pattern that ended up working was
api/.*
It's a regular expression from the root of the checkout supposedly, although I have not used this feature. Here are some of their examples:
https://confluence.atlassian.com/display/BAMBOO052/_planRepositoryIncludeExcludeFilesExamples?_ga=2.91083610.1778956526.1502832020-118211336.1443803386
What you might try is let it checkout the whole thing without the include filter set, and don't let it delete the working directory. Look on the filesystem and verify the path from the root of the working directory. Then test your regex against the whole path relative from that working directory.
I'm trying to get proper html output from gcovr when source file is located relative from my root directory.
For example (I will mention two cases where gcovr works, and where it has problems):
CASE:1 - gcovr works without problems
My root directory is structured as follow,after I run gcovr from root with --html --html-details
source/myfile.c
obj/myfile.o, myfile.gcda, myfile.gcno, myfile.c.gcov
gcovr_reports/report.html, report_myfile.html
So everything is ok, and I have the html general report(report.html) as well as the detailed report (report_myfile.html).
CASE:2 - gcovr is not working properly
My root directory is structured as follow,after I run gcovr from root with --html --html-details)
../../../Common/Source/myfile.c
obj/Common/Source/myfile.o, myfile.gcda,myfile.gcno,^#^#^#Common#Source#gcovmyfile.gcov
gcovr_reports/report.html, report.C
Now as you can see, gcovr generates the "report.C" file within the gcovr_report/ directory
Also the general html report (report.html) with the summary is created, but not the detailed one of my source file "myfile.c" .
When I look into the obj directory it creates the following file (as you can see below):
^#^#^#Project#Common#Source#myfile.c.gcov
When I take a look into
^#^#^#Project#Common#Source#myfile.c.gcov,
the path is resolved as follow:
Source:../../../Project/Common/Source/myfile.c
but it should be:
Source:../../../../../../../Project/Common/Source/myfile.c
The gcovr command is:
C:\Python34\Scripts\gcovr -v -b -r C:\Project\UnitTests\myModule\module1 -- object-directory C:\Project\UTests\myModule\module1\test-obj\Common\Source -- html --html-details -o govr_report\report.html
Any idea what I'm doing wrong?
Gcovr filters the coverage data to only show files within your project, as determined by the -r root or any --filters.
Project: C:\Project\UnitTests\myModule\module1
File: ..\..\..\Common\Source\myfile.c
The file is not within the project, so it is excluded. This is usually what you want, because the coverage of any libraries you use tends to be irrelevant.
When this is wrong, you can take over filtering and define your own --filters. You can define multiple filters, and any one must match. To disable filters entirely, use an empty filter --filter "".
Filters are regexes that are matched against the absolute source file path.
Unfortunately, filters are currently broken for Windows. It is not possible to write filters that match multiple directories, unless your working directory is a parent directory of all target directories. For example, you could go to C:\ and use the following filters:
--filter Project\\UnitTests\\myModule\\module1\\
--filter Common\\Source\\
This will change in a future version of gcovr, so please try to avoid filters that contain backslashes as path separators.
Update: Since gcovr version 4, all filters MUST use forward slashes for path separators, even on Windows. See Using Filters in the Gcovr User Guide for details.
__
Hello everybody,
My hgignore file contains following lines:
syntax:regexp
^data/dyn/.*
^data/config/.*
^data/temp/.*
^data/mediapool
^\.project
^\.buildpath
^\.settings/.*
^nbproject/.*
/\.git/
\.hg_archival.txt
syntax:glob
*.sublime-project
*.sublime-workspace
sftp-config.json
BUT, i want to "unignore" the folder data/dyn/xxx/yyy with it's files inside.
How can i solve my problem?
Many thanks!
Mercurial .hgignore files are a blacklist only. The only way to whitelist something is to blacklist the "outer" group and then hg add what you want not-ignore. Adding something with hg add always trumps ignoring it in .hgignore.
That works great for files, but not so great for directories since you can't add directories. You can add all the files in them, but any new files that land there will be ignored until you add them.
You can try using the "zero-length negative look-ahead" feature of regular expressions, but honestly it's easier to just add the files in that directory.
In Jeky'll's _config.yml file I have the following at the bottom: exclude: README.md, css/config.rb
It excludes the README fine, but not the config.rb file. What am I doing wrong?
This is a problematic feature of Jekyll for quite some time.
Just to be sure: what version of Jekyll are you using? The latest ones enforce correct YAML handling, so you should be using the array syntax (exclude: [README.md, config.rb]).
It's possible with the current implementation to use glob syntax and exclude a whole directory (or tree of directories or whatever), but I couldn't find an issue or documentation on how to exclude a specific file in the filesystem.
In any case, you can exclude config.rb. I assume you don't have another one in your site, and even if you have, you probably don't want it to be on _site. This is bad overall, but works. Your exclude rule would be exclude: [README.md, config.rb].
Can anyone tell me the .hgignore pattern to track one specific file in a directory and to ignore everything else?
I have a "media" directory which contains a "default.png", for obvious purposes, and the rest of the directory will hold user media. We want hg to ignore everything in the media directory excepting the default file.
Try:
syntax: regex
^media/.*
or (leave it in the default glob and do)
media/**
and then manually hg add media/default.png.
In mercurial (unlike in CVS) you can add files that match your ignore patterns and they work fine. So ignore broadly and hg add what you want tracked.
syntax: regex
^media/(?!default.png$)
almost the same as John Mee's but matches to the end of the line, instead of anything that starts with default.png.
if you wanted to allow any .c file but nothing else, you could use:
^media/(?!.+\.c$)
Summing it up as a BKM (Best Known Method)
Either hgignore everything, and then hg add back the few files you want to track.
Or use a pattern such as
syntax: regex
^path/(?!files-that-you-want-not-to-ignore$)
(I just wanted to see the full answer in one place.)
Never mind this seems to work...
syntax: regex
^media/(?!default.png)