StarTeam - checkout file of a specific revision using stcmd - starteam

Is it possible to checkout file of a specific revision using stcmd?
I want to checkout all (or some) history of a specific file.

Is it possible to checkout file of a specific revision using stcmd?
You can checkout a specific revision using the label as follows
"C:\Program Files\Borland\StarTeam Cross-Platform Client 2005 R2\stcmd" co -p "user:pwd#host:port/MyProject/view_r1/" -is -eol on -o -rp "D:\LocalDir" -cfgl "LABELNAME"
The history of a particular file in that label is gotten by
stcmd hist -p "user:pwd#host:port/MyProject/view_r1/" -cfgl "labelName" -is -rp "D:\LocalDir" FILENAME

stcmd.exe co has a -vn flag that allows you to specify a version number. This is the version number, not the DotNotation, so 1.15 would be version 16. This command:
stcmd.exe co -vn 1 -fp . -p "user:password#server:port/ProjectName/ViewName/FolderPath" file.ext
would get you the 1.0 of file.ext in the current directory. If you want to get the full history, you can parse the output of stcmd hist and figure out the current revision number, or you can just run the above stcmd co command with increasing version numbers from 1 until the result says "file.ext: skipped" instead of "file.ext: checked out" (the current version of stcmd does not error if the version number is too large to be valid). Remember to either delete the local file between calls or add the -o flag to overwrite it. I'd recommend deleting it - there have been issues with stcmd co and overwriting.
Note this will only get you the versions of the file on the current branch back to the 1.0 - you won't get any versions of the file from other branches. So if the current version is 1.5.2.1, you would be able to get 1.5.2.1, 1.5.2.0, 1.5, 1.4, 1.3, 1.2, 1.1, 1.0, but not 1.5.1.0.

Related

How to get the last SVN revision number from a given date?

I need to obtain the first revision number after given date?
For example, I need to know which is the first SVN revision number for the project Apache Hadoop after 2011-11-29.
I tried the command
svn log -r {2011-11-29} http://svn.apache.org/repos/asf/hadoop/common/trunk/
but in this case, there are no commit on 2011-11-29.
How can I get the first commit of 2011-11-29 or if not exist, after this date?
And finally, how can I only get the revision date from the SVN log?
Revisions in date period
Try
svn log -r {2011-11-01}:{2011-11-30} ## revision between dates
or
svn log -r {2011-11-01}:Head ## revisions from 2011-11-01 to head
or
svn log -r {2011-11-01}:Head -l5 ## Top 5 revisions from 2011-11-01 to head
http://svnbook.red-bean.com/en/1.8/svn.ref.svn.html#svn.ref.svn.sw.revision
Get revision date from log
Try
svn.exe log --xml
And parse <logentry><date> tags with bash

Find the last commit to have changed a file

Question
Using the svn command line, I would like to find the last commit that touched a file. Here it is in pseudo-code:
svn log -v --search my-file.txt --first-match
What I have tried:
svn log -v --search my-file.txt -l 1
Unfortunately, this only searches the most recent commit. It doesn't return the first match.
svn log my-file.txt -v -l 1
Subversion complains that:
svn: E155010: The node 'C:\Users\my.user\Documents\SubversionSvn\MyDir\my-file.txt' was not found.
svn log svn://my.server.com/svn/path/to/my-file.txt
Svn complains that:
svn: E160013: File not found: revision 427, path '/svn/path/to/my-file.txt'
Just get the log of the file and limit it to the first (most recent) entry:
svn log my-file.txt -v -l 1
If the file was in your repository but was deleted, you'll need to pass a peg revision so SVN knows what file you're asking about:
svn log my-file.txt#3511 -v -l 1
Here, the peg revision is 3511 which is the last revision where the file existed before it was deleted from the repository. However you've already answered your question once you've found this number.
If the file was never in the repository (it isn't now, based on your errors), then this isn't a question that SVN can answer for you.
I use GUI , go to file on your comp, right click on file , TortoiseSVN > Diff with previous version
Link for command line

How can I download the most recent version of a GitHub project to use in a bash script?

I'm working on a script that sets up a CMS (Statamic) so that devs can jump right into writing code and not have to manually move stuff around, gather commonly used code from GitHub, and so on.
I need a way to grab the most recent version of a project from GitHub, unzip it, and be able to move stuff around without knowing the lastest sha.
Code
# Download most recent version from GitHub
curl -L -o DOWNLOADED_FILE_NAME.zip https://api.github.com/repos/USER/REPO/zipball/BRANCH
unzip DOWNLOADED_FILE_NAME.zip
# Find out the name of the unzipped dir and assign it to a variable.
UNZIPPED_DIR=$(compgen -A builtin -f USER-REPO)
rm DOWNLOADED_FILE_NAME.zip
Explanation
-L tells curl to follow the redirect.
-o specifies the name of the downloaded file.
Read this for info on downloading GitHub files from the command line.
For info on compgen, check out this answer to another question.

SVN export files changed since date or revision (Windows svn.exe)

I have a repository of sql scripts, some of which change for each of our monthly releases (different scripts change each month).
I am trying to automate the compilation of deployment packages and want to be able to export all the scripts which have changed since the last release, which has a known date and known revision.
SVN Branches are per release, SVN Tags are per build.
I have googled and know that svn diff --summarize -r {2012-05-01} svn://server/path/to/ > files.txt gives me a list of all the changes but how do I then use that list to export only those files using Windows CMD - all the examples I have found are for Linux and use Linux commands.
Is there any other direct way of doing this in SVN? (using SVN Export?)
Use revision number as start revision, not date: it's more bullet-proof
Use revision range, even if end revision is HEAD: it's more bullet-proof
You can have Bash even on Windows, and use Bash-scripts
You can install Ruby and use Ruby script (or compile Ruby to exe)
At last
You can install TortoiseSVN and prepare tree in GUI by hand
or
Write own parser of diff output (PoserShell will do it)
>svn diff --summarize -r 26:34 http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk/
A http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk/Dr%C3%A6p%C3%A6r.ma%C3%BEar.sv%C3%A6nskan.man.eller.smalensk%C3%A6n.txt
M http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk/Hello.en.txt
M http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk/Hello.fr.txt
M http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk/Hello.de.txt
M http://mayorat.ursinecorner.ru:8088/svn/Hello/trunk
(copy all files, which have A|M in fist char of line, or pre-grep all strings, which have trailing slash after path-base /filter last string in my example/)

Can we select what version to be checked out from CVS

I have updated cvs a few times and want to get one of the older versions, is it possible to get different versions of the same file? Or should it be only the latest checked in version?
Switch to a certain revision number: cvs update -r 1.42 myfile
Switch to a certain tag: cvs update -r mytag
Switch to a certain date: cvs update -D 'last friday 12:00 PST'
If you haven't already checked out some version, you can pass -r or -D directly to cvs checkout.
These all switch your working copy to the revision or date you specified (this is called a “sticky tag”). To go back to the head revision, issue cvs update -A.
You can also retrieve a specific revision into a different file with the -p option: cvs update -p -r 1.42 myfile >myfile-1.42. This doesn't touch your working copy of myfile.
Yes - in the lingo of CVS it sounds like you have committed several versions (to the repository) and now you want to get one of the previous revs back... so you will be updating your sandbox. If it's a particularly interesting rev, you might want to TAG it so you can find it again without having to use the rev number.
In either case you might run a cvs command like so:
cvs update -r 1.14 foo.java
cvs update -r spiffy_tag foo.java
But know that if you run either of those, you will have a "sticky tag" in your local copy and cannot commit back from there. (Run "cvs status foo.java" to see the sticky)... so if you want to work on that rev and tune it up, you might want to create a branch first... then if you run:
cvs update -r my-branch foo.java
you will be able to commit changes back to the repo.

Resources