If another developer adds a new directory to the CVS repository, I'd like my next update to bring this new directory into my working copy. Running cvs update doesn't do this. Running cvs update -d does, but it takes a helluva long time; it prints the pathname of every file in the repository and spends a little time thinking about each one. Running cvs update -d <dirname> in the new directory's parent does the job, but I have to know about the new directory first, and I have to do this for every new directory.
Is there an efficient way to get a complete update, including any newly-added directories, from a CVS server?
Use a shell script which generates a custom $CVSIGNORE list for this type of update, then runs cvsupdate -d to do this:
CVS has a list of files (or sh(1) file name patterns) that it should ignore while running update, import and release. This list is constructed in the following way.
The list is initialized to include certain file name patterns: names associated with CVS administration, or with other common source control systems; common names for patch files, object files, archive files, and editor backup files; and other names that are usually artifacts of assorted utilities. Currently, the default list of ignored file name patterns is:
RCS SCCS CVS CVS.adm
RCSLOG cvslog.*
tags TAGS
.make.state .nse_depinfo
*~ #* .#* ,* _$* *$
*.old *.bak *.BAK *.orig *.rej .del-*
*.a *.olb *.o *.obj *.so *.exe
*.Z *.elc *.ln
core
The per-repository list in ‘$CVSROOT/CVSROOT/cvsignore’ is appended to the list, if that file exists.
The per-user list in ‘.cvsignore’ in your home directory is appended to the list, if it exists.
Any entries in the environment variable $CVSIGNORE is appended to the list.
Any ‘-I’ options given to CVS is appended.
As CVS traverses through your directories, the contents of any ‘.cvsignore’ will be appended to the list. The patterns found in ‘.cvsignore’ are only valid for the directory that contains them, not for any sub-directories.
In any of the 5 places listed above, a single exclamation mark (‘!’) clears the ignore list. This can be used if you want to store any file which normally is ignored by CVS.
References
Ignoring files via cvsignore
Related
I have a folder that regularly gets updated. This folder is a part of a TFS workspace. I need to commit all those changes to the workspace once they occur (add what isn't there, delete what was removed and update what was changed).
Currently, I have a script that runs tf vc folderdiff command on the folder and its server counterpart, parses out the output to get three lists - files that need to be added, deleted and updated. It then manually adds, deletes and updates those files by invoking tf add/delete/checkout on batches of files (trying to add/delete/checkout in one go can cause an error if there are too many files in the list).
There has to be some better way. Is there some kind of tf command where I can tell it, look at this local folder, look at the server folder that is mapped to it and make the server folder look exactly the same? Bonus points if I can specify some kind of filter to exclude certain paths or file names/extensions.
Apparently there exists a tf reconcile command. You can learn more about the syntax here: https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/reconcile-command
Off the top of my head, the following command should do what I want:
tf reconcile [path to folder] /promote /adds /deletes /recursive /noprompt
There is also /exclude that can be used to filter unwanted files, so I get the bonus points too.
Of course I had to stumble upon it right after asking a question...
I have a requirement in my project where I need to ignore the .html file to track via git in the project however need to track any .html file in a given folder along with its sub folder.
I tried using below code to exclude to track all files from ignore_directory but it didn't worked.
*.html
!ignore_directory/*
What you have is the correct way to exclude a directory.
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor or
# operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
*.html
!ignore_directory/*
Either the path you have is incorrect or is not relative to the directory you want to exclude. It's also possible that the directory you want to exclude contains a gitignore file overriding your exclusion.
Read GitHub help on Ignoring files for a simple introduction to ignoring files and also tead the Git - gitignore documentation.
I'm using Github Desktop on Windows 10. I have a .gitignore file with which I'd like to ignore everything in the directory, including all subdirectories.
What's frustrating is that most files are excluded, but I'm still getting a few random files that I cannot seem to ignore.
I have a directory, say, My Dir/Sub-dir, I want to ignore. I also want to ignore all files of extension, say, *.swf. Thus, I write this .gitignore file:
My Dir/Sub-dir
*.swf
But, when I go back to Github Desktop, I still get two files similar to the following in the list:
My Dir/Sub-dir/anotherdir/randomfile.xml
My Dir/Sub-dir/animation.swf
What's going on? Is this a bug? Or am I missing something?
EDIT:
Other alternative .gitignores I've tried are:
My*Dir/Sub-dir
*.swf
My\ Dir/Sub-dir
*.swf
My Dir/Sub-dir/
*.swf
/My Dir/Sub-dir
*.swf
EDIT:
So, I've tried the git rm --cached <file> command on my files, and it worked - until one of the files changes again. Github Desktop then once again says they need to be updated.
p.s. It may be that they somehow got indexed in the master branch, as I'm currently in a different branch. Would this cause it? And, if so, how would I eliminate these files from all branches?
To ignore all trees under specific directories, append the trailing slash to the directory:
# Ignore directory at all levels, even if the directory is nested under other directories
My Dir/Sub-dir/
# Ignore the directory only if it exists at the root of your repository
/My Dir/Sub-dir/
# Ignore the sub-directory, no matter where it appears within your repository
Sub-dir/
# Ignore all swf files
*.swf
If you are continuing to experience difficulties, your problem may be that the files you wish to ignore are already indexed by git (via the git add command). If the files are not committed yet, you can remove them from the index with git reset -- 'My Dir/Sub-dir/'. If your files have been committed, you can remove them from the index with git rm --cached <file>.
I guess the whitespace could be a problem. Try
My\ Dir/Sub-dir
or
My*Dir/Sub-dir
This could be a good reference .gitignore entire directory with whitespace in name
I have some generated files from templates. Let's say I have in my repository:
foo.c.in
bar.h.in
baz.html.in
These files could be generated through a Make rule:
$(wildcard *.in): %: %.in
PYTHONPATH+=. mako-render $< > $#
I don't want to manually add each of these generated files to my .gitignore
foo.c
bar.h
baz.html
Is there a smarter way?
If those two sets of files are the only one in a given folder, you can:
ignore everything
exclude the *.in files
That is
*
!*.in
But if those files are not alone, and in multiple folders, then, as commented, your Makefile would need to generate the list of files to ignore, either in:
a dedicated .gitignore
a dedicated file specified by the configuration variable core.excludesFile
I have a certain folder(named SDK) containing many other folders as a VOB element in my dynamic view.
/vobs/tools/SDK
I also have a updated version of that folder elsewhere as view private (as flat files).
/homes/user/SDK
I need to add files which were introduced in the updated version to the checked in version which did not have them. I have a text file containing all the files which were newly introduced in the updated version.
/homes/user/files.txt
Contents of files.txt
./a/b/abc.cpp
./s/t/xyz.cpp
.
.
.
Which is the best way to have these files checked in at at appropriate location?
clearfsimport will not work because it takes the leaf of the source path and checks that at the target VOB location.
i.e.
clearfsimport -nset /homes/user/SDK/a/b/abc.cpp /vobs/tools/SDK
clearfsimport -nset /homes/user/SDK/s/t/xyz.cpp /vobs/tools/SDK
wouldn't create the /a/b/ and /s/t/ directories in /vobs/tools/.
I could use mkelem but that would require me to manually create the directory /a/ then /a/b/ and then copy the file abc.cpp and checkin back the newly created directories and the file itself.
Can someone suggest the most efficient way of doing it?
Yet clearfsimport should work (to import multiple files):
clearfsimport -preview -rec -nset /homes/user/SDK /vobs/tools/SDK
# or
clearfsimport -preview -rec -nset /homes/user/SDK/\* /vobs/tools/SDK
That should import all elements, but checkout and update only the ones modified, and create the one missing.
All that in /vobs/tools/SDK, not /vobs/tools.
Since there are too many files in /vobs/tools/SDK, copy the ones which have been modified in /vobs/tools/SDK_to_import, with their exact folder structure (like /homes/user/SDK_to_import/a/b/abc.cpp).
The clearfsimport, by default, will not remove the files of the destination folder which are not present in the source folder.
But it will update those files in the destination folder /vobs/tools/SDK.