I would like to query from the command line the list of changesets and their description which haven't been downloaded yet to my workspace.
I know I can use
tf.exe vc history /recursive <path to workspace>
to get the complete history, but how can I limit this to only those that haven't been downloaded yet?
To view the history information that hasn't been downloaded, you want to build a query that shows all items beginning in the version that you have (eg, "your workspace version") and ending at the latest version ("tip").
You can use the /version option to history, and specify a version to begin showing history and a version to stop showing.
For "versionspecs", you can use W which denotes your workspace version, and T which denotes tip (or the latest version).
tf vc history <path> /recursive /version:W~T
Related
Is there a command (or series of commands) to sync a TFVC workspace with the server, ensuring that what's on disk exactly matches what's checked in to the server.
tf vc scorch almost does what's needed, in that it syncs the client workspace with the server's version of that workspace, but if a new item's been created on the client and added to source control, though not yet checked in, that item remains after scorch is run. NB: I'm using the TF Client version of scorch rather than the power tools version, as I'm working with VS2017 (scorch is supported from VS2013 SP1), should that make any difference.
Related, I'm aware that power tools includes a treeclean command; however that only impacts items not under source control; not those added to version control but not checked in. https://adamprescott.net/2011/09/12/clean-tfs-workspaces-with-scorch-treeclean/.
The only way I can think of to achieve this is to delete (tf vc workspace /delete /collection:"https://$MyInstance.visualstudio.com/DefaultCollection" $MyWorkspace) & recreate (tf workspace /new $MyWorkspace /collection:"https://$MyInstance.visualstudio.com/DefaultCollection") the workspace, before running a recursive get to repopulate the new folder. However, that feels like the long-way-round for something which I'd assume would be simple...
We're using TFVC rather than Git because we're working with Dynamics AX, which does not natively support Git.
The reason I want to delete such objects is because this script will run on a build server, where I want to ensure we build exactly what's checked in to source control. Whilst in theory no one should be creating new objects on the build server, I don't like to rely on that assumption / want to make this script as robust as possible.
I'd missed the undo command: TF.exe vc undo * /recursive /noprompt.
Running this command before running get and then scorch ensures that my workspace exactly matches the latest server version.
Here's the complete code used to sync the current workspace with the server. NB: This command assumes that tf.exe's directory is included in the path environment variable (or you can replace tf with "...\path\to\tf.exe"), that the current/working directory is mapped in source control, and that your tf credentials are cached (otherwise include the /login argument with username and password). I've not included /all, '/overwrite', or '/force' on the get command, since scorch will cover this anyway; the main purpose of the get here is to ensure our workspace is "pointing at" the latest definition.
tf vc undo * /recursive /noprompt
tf vc get * /recursive /noprompt
tf vc scorch * /recursive /noprompt /diff
NB: The vc above is superfluous / just ensures that were there a possibility for ambiguity the system would know to use tfvc's version of the command instead of the git version.
I'm trying a simple TFS 2015 checkin automation. I have a local workspace mapped to a local folder. In that folder, I added some files and deleted one. What I want is to checkin those changes
I run this command
tf.exe checkin <folder> /recursive
The result (unexpected) is "no pending changes"
If I run the following command
tx.exe status <folder>
I get the list of changes expected.
If I look in Visual Studio source code explorer, I cannot see my changes but if I try to add items in the TFS folder, I can see new files.
Can you help me to understand how I can automate this checkin scenario?
EDIT : based on this SO thread, it seems it is not possible to achieve this with local workspace. Can someone confirm?
You need to run "tf add" command to add these files into Pending Changes before run "tf checkin" command:
tf add * /recursive
How can I rollback the operation of removing a directory and its contents in CCRC?
I have removed the directory and the changes are checked in on my view.
I can't run cleartool, the error I get is "You do not have a license to run ClearCase".
I have tried in eclipse CCRC plugin "Replace with another clearcase version", and specify the version I want, but nothing changes.
How can I get the directory and files back?
cleartool won't be available with CCRC. It is included only with a full ClearCase installation.
The way to restore a deleted element though should be the same : checkout the parent directory and merge its previous version (which still reference the sub-directory) with the checked out one: you will get back what was deleted (actually only de-referenced)
See also the CCRC merge directory view.
I just spent a fair amount of time selecting the files and directories I wanted under version control. I'm running subclipse under eclipse. I right clicked, Team, Add to Version Control. Now I want ONLY those files committed without right clicking the whole directory which contains a huge number of media files that I don't want handled by version control. If I go Team/Commit under that directory it hangs for a very long time... I thought by "Add to Version Control" there was an option to commit those files only. I just don't know how to do it.
I hope I explained the question properly..
UPDATE:
Since people are talking more about ways to ignore files rather than committing what you're marked as "Add"ed to Version Control, let me put this a different way. What does "Add to version control" do exactly? It seems to be a feature without use.
Subclipse includes both unversioned files and files you specifically marked for addition when you open the commit dialog. It does not perfectly mirror the behavior of the command-line client. You have two options: uncheck each file you do not want to commit in the Subclipse commit dialog or use the command-line svn tool to commit. The command-line tool will only commit files you have marked for addition and will ignore the other files. Here's a simple example:
$ touch file
$ svn status
? file
$ svn add file
A file
$ svn status
A file
$ touch file2
$ svn status
? file2
A file
$ svn commit -m "Added empty file"
Adding file
Transmitting file data .
Committed revision 2.
? denotes a file that it unknown to svn and will not be put under version control automatically by svn commit. A denotes a new file that is scheduled for addition. Subclipse is trying to mirror this behavior by allowing you to "add a file to version control", which is the equivalent of the command-line svn add. but also includes unversioned files not scheduled for addition in its commit dialog (which I personally find somewhat annoying). If you run svn status on the command-line, those files which you "added to version control" in Subclipse will be marked with an A while those you did not will be marked with a ?. You won't have to run any svn add commands since you did that already in Subclipse.
You can add a pattern in Preferences/Team/Ignored resources (it's not the same as svn:ignore). You can also delete it, if it is no longer helpful.
use svn:ignore for the resources you don't need under version control (Team > Add to svn:ignore)
Please note: This is a question about the Eclipse plugin Subversive, and not about Subversion itself. Please do not change the title to be about 'Subversion'.
So I deleted a file that I really shouldn't have.
I've found various approaches to restoring the file outside of Eclipse/Subversive, but I was wondering if there was a best/easiest-to-use/history-restoring way to restore the file using the Subversive tool.
Select the folder in the project that contained the deleted files.
Right click, select Team > Merge...
On the URL tab, set the URL to the server URL for the same folder.
In Revisions, select Revisions and enter a range that includes the deletion, e.g. 1000-1001, or use the Browse button to select them.
In Revisions, enable Reversed merge
Click Preview and check that it shows an Added entry for the files you plan to restore.
Click OK - Eclipse switches to SVN Merge in the Synchronize view.
In the Synchronize view, right click the files you want and select Accept
In the Synchronize view, use the Synchronize SVN icon to switch from SVN Merge to SVN, where you can see the restored file as an outgoing change.
If you have already submitted the remove then it's now time to roll back to the earlier version. In Subversion you do that with "svn merge", where you merge "backwards" from the current to the previous version.
Say you did this:
$ svn rm file.txt
$ svn ci -m "don't need that file"
Committed revision 1325.
Now you want to undo this and restore the old revision 1324, i.e. the state just before the remove (the dot is for 'current directory'):
$ svn merge -r1325:1324 .
If you are unsure you can do a dry-run first, where svn will print the output of the command, but not actually do anything:
$ svn --dry-run merge -r1325:1324 .
The result should indicate that the file is being added (again):
A file.txt
you could switch to revision where this file was exist. Edit/copy this file and switch back to the head revison and commit it here.
Also you could merge changes beetween two revisons - head and last revision file was exist in repository and apply changes to your working copy.
Just "Show History" on the folder, file was existing in. Then click through the history and find the lost file.
I guess you're hoping to not resort to the command line but in case it's useful as a last resort, see this question for how to do it from the command line: What's a simple way to undelete a file in subversion?
Easier: try to commit, Eclipse will show you the dialog with the changed files, click on the one you want to delete with the right button and pick "Revert".
I had a similar issue, I deleted a set of files related to a feature that after a couple of months I want to recover.
The most straightforward solution in my case was to check out in a separate directory the whole project as it was before the file were deleted.
To do this from the Eclipse Repository View go to your project, right click "Check Out As...", in the modal window write the destination folder, select a suitable date of the past in which the deleted file existed (weird, my plugin does not give the possibility to choose a given revision..) and check out.
Now you can easily search, find and copy-paste the files you want to recover.