Make watchman check periodically for changes in a directory - watchman

I want to make watchman check for changes in a directory every 1 s or so. How can I do that. I can't find it in the docs.

Watchman's purpose is to avoid needing to do such polls. You can just make a Watchman subscription to watch a directory for changes: https://facebook.github.io/watchman/docs/cmd/subscribe.html

Related

Deleting files and folders from a helix server while keeping them on the pc

I am new to perforce, i submittet my previous project to it as asked and added the p4ignore later. but now i dont want the files from the p4ignore like the .vscode folder on the server however when i try to mark for delete it also deletes them from my machine. how can i remove them on my server but keep them on the local machines
You probably want to use the p4 obliterate command; this is used to permanently remove files from the server (including all their history), which will leave your local files in an untracked state. Note that this requires admin level permission since file history is normally considered immutable.
If you can't get an admin to help with this, you can use the p4 delete -k command to open the files for delete while keeping the local files. This is a little tricky because it still results in a deleted revision, and if you're not careful you might end up getting surprised at some point by having a sync operation delete your local files (e.g. a force sync may delete your local files to force them into agreement with the head depot revision even though they aren't on the client have list).
To avoid that potential problem, after you delete the files, exclude them from your client view. That will not only prevent them from being added (similar to .p4ignore) but will also firmly exclude them from any operation that touches client files, including sync. (I usually recommend using the client view to exclude files in the first place instead of p4ignore -- it has the advantage of being tracked on the server, and it also prevents you from syncing down "ignored" files submitted by other workspaces whose settings don't match yours.)
tl;dr: use obliterate for mistakenly added files if you can, otherwise use a combination of delete -k and client view tuning to make sure the depot and client files are hidden from each other.

How to automatically sync files in github desktop?

My partner and I are working on a website and the file folder is being shared between us via github. We need a way of automatically syncing the changes that either of us make to the files on either of our computers so we can both edit the site live.
How can I set it up so that changes made to the repository are automatically synced with files on our computer? Without one of us having to go hit the sync button every time?
You should be able to write a cron job to accomplish the auto sync. But remember git will refuse to sync in case of conflict. You will have to manually pull the changes and resolve conflict.

Untrack files without removing from remote repository

In our company, we just started using Mercurial and we are facing the following problem:
We have some files in the remote repository that are changed by each developer to add some local configuration but these files must never be changed in the remote repository.
Is there a way to tell Mercurial to stop tracking those files locally without making any change to the file on the remote repository?
We tried with hg forget <file> but as I understand, this will remove the file from the remote repository.
We also tried adding those files to .hgignore file, but somehow the files are not really being ignored, I guess Mercurial does this because the files are already being tracked.
So far, we are just ignoring the files when we perform a commit and we use shelve to maintain and restore our local changes after an Update, but it's starting to be a really tedious task.
Thanks in advance for any help.
EDIT: Although it didn't completely fix what we wanted to, accepted answer is the best approach. Our problem is probably a result of a bad design.
If the file you want unchanged is, for example, config.cfg, check in a config_template.cfg, forget config.cfg if it is already tracked, and add config.cfg to the ignore list. Then, a build rule can create config.cfg from the template if it does not already exist.
A user will then have a starting config.cfg that they can customize without checking it in.
You could use the configuration [defaults] section to add some "--exclude" options to usual commands (see my answer to Mercurial hg ignore does not work properly ) for more details.
But.. be careful that it is dangerous to silently ignore modifications to files and also that this [defaults] section has been marked as deprecated (it is still present in 2.9.2).
IMHO it's a wrong approach to have a file in the repository which every person needs changed anyway - it's an indication that you do not want to have it tracked at all.
Change the file to config.sample, and have your programme create a default config upon first start (thus when there's no existing config file) and have every developer use the config file as s/he needs.
And I see Mark Tolnen's answer only now :)

Automatically copying new files to another folder (CentOS 6.3)?

Is there a command I can enter via SSH (CentOS 6.3) that will monitor a certain directory, and if any new files/folders are created in in, copy those files to another folder at all?
I have looked at various sync programes, and rather than mirror the folder I need to keep a copy of any new files/folders even if they are deleted from the original directory.
I am hoping the cp command can be used somehow, but I couldn't work out how to do it myself.
Thanks for any help, and please let me know if you need further information to help or there is a better way to achieve my needs.
Rsync would do it, it doesn't have to delete files from the destination if they are deleted from the source.
Do you need it to run periodically or monitor constantly for changes? If the latter you might want to look into something using inotify or FAM.

How to force a directory to stay in exact sync with subversion server

I have a directory structure containing a bunch of config files for an application. The structure is maintained in Subversion, and then a few systems have that directory struture checked out. Developers make changes to the struture in the repository, and a script on the servers just runs an "svn update" periodically.
However, sometimes we have people who will inadvertently remove a .svn directory under one of the directories, or stick a file in that doesn't belong. I do what I can to cut off the hands of the procedural unfaithful, but I'd still prefer for my update script to be able to gracefully (well, automatically) handle these changes.
So, what I need is a way to delete files which are not in subversion, and a way to go ahead and stomp on a local directory which is in the way of something in the repository. So, warnings like
Fetching external item into '/path/to/a/dir'
svn: warning: '/path/to/a/dir' is not a working copy
and
Fetching external item into '/path/to/another/dir'
svn: warning: Failed to add directory '/path/to/another/dir': an unversioned directory of the same name already exists
should be automatically resolved.
I'm concerned that I'll have to either parse the svn status output in a script, or use the svn C API and write my own "cleanup" program to make this work (and yes, it has to work this way; rsync / tar+scp, and whatever else aren't options for a variety of reasons). But if anyone has a solution (or partial solution) which takes care of the issue, I'd appreciate hearing about it. :)
How about
rm -rf $project
svn checkout svn+ssh://server/usr/local/svn/repos/$project
I wrote a perl script to first run svn cleanup to handle any locks, and then parse the --xml output of svn status, removing anything which has a bad status (except for externals, which are a little more complicated)
Then I found this:
http://svn.apache.org/repos/asf/subversion/trunk/contrib/client-side/svn-clean
Even though this doesn't do everything I want, I'll probably discard the bulk of my code and just enhance this a little. My XML parsing is not as pretty as it could be, and I'm sure this is somewhat faster than launching a system command (which matters on a very large repository and a command which is run every five minutes).
I ultimately found that script in the answer to this question - Automatically remove Subversion unversioned files - hidden among all the suggestions to use Tortoise SVN.