Archive Mercurial Changeset Files - windows

I'm using Mercurial 1.7.2. on Windows and I want to extract all files within a specified change set (in my case tip). This is so I can upload only the files that I have changed to my web server.
If I want to take an un-versioned copy of the entire repo then I use hg arhive however I can't find a way to get just the files in a changeset.
And all the examples I can find use Unix tools.

With hg status --change <revno> --no-status you get a list of the files that's changed.
You should be able to feed that list into robocopy or xcopy or something else.

If you're using TortoiseHg you can do this from the Repository Explorer - in fact I do exactly what you're trying to do for a Wordpress install.
thg log will bring up the log of the repository in TortoiseHg. You can then right-click on a changeset and select (from memory, sorry) Archive. There are a few options, but you should see an option on the resulting dialog something like "Archive only changed files". Make sure that is checked, and away you go.
The command that's executed is shown to you, but to automate it on the command-line you need to get the list of files changed (see Macke's reply). With a little batch-magic you can feed that into the Archive command.
Have a look at this StackOverflow question for details of how to do it on the command-line, providing you have a SED interpreter installed, which you can easily find for Windows.

Related

TortoiseGit showing up-to-date versioned files as non-versioned

I have a large VS2017 solution that is stored on GitHub. In my local working copy of the repository, there are several files that are marked with the ? icon overlay which indicates that they are non-versioned files. However, these files are in the repository and are up to date. If I commit changes to other files, these files do not show up in the No Versioned list or if I create a clone of the repository from GitHub, these files have the proper icon overlay.
Any ideas why these files are shown as Not Versioned in one local repository and not another?
Please make sure that the case of the filename on the filesystem match the casing in the repository.
Background
Even if Windows ignores the case in paths, Git does not (completely) - even if you enable core.ignorecase. git status indeed does ignore the case, however, if you try to get the log on a file with a different casing, the log will be empty.
Because of this in TortoiseGit 2.4.0 the icon overlays were made case sensitive. So if the overlay icon shows that the file is versioned, the log won't be empty and if the file is shown as unversioned you get an indication that something is curious.
How to fix
Rename the files in the filesystem (some applications might tend to delete and re-create the files with different casing) OR use the TortoiseGit rename function to fix the casing in the repository.
Since TortoiseGit 2.5.0 you can configure TortoiseGit to ignore the case when calculating the overlay icons again by enabling the advanced option OverlaysCaseSensitive (cf. issue #2980).

How can I see which files have changes with Webstorm/GIT/OSX?

I have just started using Webstorm and OSX for my development with GIT. When I was using Windows I could use tortoise git and I would see little icons in Visual Studio and on the file system showing me the status of files such as /changed/same/ignored.
What I really want instead of the command line is to be able to see little status symbols on my files in 'finder'
WebStorm has VCS integration, it shows what files were changes, added or deleted in the Project view highlighting their names with different colors.
You could also see the changelists, use visual diff tool and more. I suggest watching this video on VCS integration in WebStorm and PhpStorm.
You could consider a shell like Prezto, illustrated in "ZSH/PREZTO GIT DIRTY PROMPT INFO".
Using this prompt setup, you can add information as to the current status of your repo:
Things like how long since the last commit, the current branch, whether I've added or modified files.
I also like to have two symbols, a green tick and a red lightning bolt visible as a general "you should commit your work" flag.

Checkin Without Merge in Visual Sourcesafe

I've got a file managed by Visual Sourcesafe 2005 which I have edited. I'd like to check in the file exactly as-is on my box, but VSS always merges it with the file in the repository, breaking my code.
I don't know what I expected to happen...
Is there any way to check the file in without merge shy of deleting the existing file from the repo and adding my copy back in?
I've looked for command line options to no avail.
You could just do "Undo check out" for all files, keeping their local versions on your machine; then again check out this files without getting latest versions from Visual SourceSafe; then check in all of them. In this case history is preserved. You just overwrite latest versions of files without any merge. Seems for me it's what you wanted.
I had the same problem and sorted it out in that way.
I'm putting this answer here, but still really hoping that a better one comes up.
I figured that I can go into the VSS GUI and rename the file to ".old", then add my local file into the repo. It's extremely hacky, but allows me to keep the file history.
Such issue might happen when the file was checked out by multple people and there was a newer version checked in by others after your checkout. (See Four scenarios that merge may be performed #2 of the article for more details.)
I don't see a option in SourceSafe CheckIn command to control that either. If you don't want merge happen, you may exclusively check out the file before editing.

How to move files from svn folder to production server

I have a website written in PHP under source control (SVN). I would like to move at once all my files from the website directory to production server.
The problem is that in this folder there are folders of SVN (.svn). The second problem is that i do not want to put on the server only files under source control, but also other in this folder (images, css, and so on).
Could you please tell me how to do this? It would be nice if it would be repeatable - that so I would have only one command to execute.
And if there would be any possibility to optimize uploading (not uploading not changed files) to make whole process of going production faster would be nice too.
EDIT:
My development environment is Eclipse PDT and favorite FTP filezilla.
You can use the export function of subversion, this will allow you to export all files under version control, but also all files NOT under control. Both methods will skip the .svn folders.
You didn't mention your client, but Tortoise has the 'export unversioned files too' option.
See here for commandline syntax
You can use an ftp client if it's support filters (exclude .svn folders, i.e FlashFXP).
Currently I'm using Nusphere PhpEd IDE's built in feature called "Smart upload", so it only updates changed files (with modified time changed).
I use rsync which is a fast command line tool which only sends the changed parts of files. You can set it up to exclude .svn directories as outlined here:
If you wish to continue doing this with fileZilla you can go to View->Filename Filters and select to ignore SVN and CVS directories. You can also only upload changed files with FileZilla however I find rsync far faster. As rsync is command line based you could easily hook it up with Eclipse as an external tool to enable 1 click transferring
You can use springloops, they cover SVN commit and checkouts but most importantly deployment to FTP server with a click of a mouse...
I stumbled recently on the same issue running Ubuntu 9.
In FileZilla you can choose ignore filters which contain even presets to prevent copying .svn folders and windows .thumb files! You can find this in the View menu under Filename filters... Works like a charm!
Thumbs up for the FileZilla folks!

Storing file permissions in Subversion repository

How do you store file permissions in a repository? A few files need to be read-only to stop a third party program from trashing it but after checking out of the repository they are set to read-write.
I looked on google and found a blog post from 2005 that states that Subversion doesn't store file-permissions. There are patches and hook-scripts listed (only one url still exists). Three years later does Subversion still not store file permissions and are hooks the only way to go about this? (I've never done hooks and rather use something that is native to Subversion.)
SVN does have the capability of storing metadata (properties) along with a file. The properties are basically just key/value pairs, however there are some special keys like the 'svn:executable', if this property exists for a file, Subversion will set the filesystem's executable bit for that file when checking the file out. While I know this is not exactly what you are looking for it might just be enough (was for me).
There are other properties for line ending (svn:eol-style) and mime type(svn:mime-type).
There's no native way to store file permissions in SVN.
Both asvn and the patch from that blog post seem to be up (and hosted on the official SVN repository), and that's a good thing, but I don't think they will have such metadata handling in the core version any time soon.
SVN has had the ability to handle symbolic links and executables specially for a long while, but neither work properly on Win32. I wouldn't hold my breath for another such non-portable feature (though it wouldn't be too hard to implement on top of the already existing metadata system.)
I would consider writing a shell script to manually adjust file permissions, then putting it in the repository.
One possible solution would be to write a script that you check in with the rest of your code and which is run as the first step of your build process.
This script runs through your copy of the codebase and sets read permissions on certain files.
Ideally the script would read the list of files from a simple input file.
This would make it easy to maintain and easy for other developers to understand which files get marked as read-only.
Since this wasn't fully said in previous responses yet. I hate to resurrect zombied threads though.
Since adding permission support for SVN would have to accommodate multiple OS's and permission types, NFS, POSIX, ARWED, and RACF
This would make SVN bloated, possibly clash with conflicting permission types like NFS and POSIX, or open up possible exploits/security vulnerabilities.
There are a couple of workarounds.
pre-commit, post-commit, start-commit are the more commonly used, and are a part of the Subversion system.
But will allow you to control the permissions with what ever programming language you like.
The system I implemented is what I call a packager, that validates the committed files of the working copy, then parses a metadata file, which lists out the default permissions desired for files/folders, and any changes to them you also desire.
Owner, Group, Folders, Files
default: <user> www-user 750 640
/path/to/file: <user> non-www 770 770
/path/to/file2: <user> <user> 700 700
You can also expand upon this and allow things such as automated moving, renaming them, tagging revision by types, like alpha, beta, release candidate, release
As far as supporting clients to checkout your repository files with permissions attached to them. You are better off looking into creating an installer of your package and offering that as a resource.
Imagine people setting their repositories with an executable in it set with permissions of root:www-user 4777
This is the updated link for SVN patch which handles unix style file permissions correctly. I have tested out on fedora12 and seems to work as expected:
I just saved it /usr/bin/asvn and use asvn instead of svn command if i need permissions handled correctly.
Many answers have stated that svn does not store file permissions. This may be true, but I was able to solve a dll file without execute permissions problem simply by these steps:
chmod 755 badpermission.dll
mv badpermission.dll ../
svn update
svn rm badpermission.dll
svn commit badpermission.dll -m "Remove dll to fix permissions"
mv ../badpermission.dll .
svn add badpermission.dll
svn commit badpermission.dll -m "Add the dll back to fix permissions"
rm badpermission.dll
svn update
badpermission.dll comes back with execute permissions
#morechilli:
The asvn wrapper from my earlier post and the blog in the OP's post seems to do what you're suggesting. Though it stores the permissions in the corresponding files' repository properties as opposed to a single external file.
I would recommend to generate permissions map using mtree utility (FreeBSD has it by default), store the map in the repository, and, as was mentioned above, run a script that would restore proper file permissions from the map as the first step of the build process.
Locking would not solve this problem. Locking stops others from editing the file. This is a third party application which gets run as part of the build process that tries to write to a file - changing it - which breaks the build process. Therefore we need to stop the program from changing the file which is simply marking the file read-only. We would like that information to be held in the repository and carried across checkins, branches, etc.
Graham, svn doesn't store permissions. Your only option is to wrap your call to svn in a script. The script should call svn with its arguments, then set the permissions afterward. Depending on your environment, you might need to call your script svn and tweak your PATH to ensure it gets called.
I quite like morechilli's idea to have the list of files and permissions checked into the repository itself.
We created a batch file to do this for us. Would prefer actual support in subversion though...
Consider using svn lock to disallow others from writing to the file.

Resources