Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw exception when trying to init a root branch #390

Merged
merged 2 commits into from
Jun 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public override int GetRootChangesetForBranch(string tfsPathBranchToCreate, stri
Trace.WriteLine("error: TFS branches "+ tfsPathBranchToCreate +" not found!");
return -1;
}

if (tfsBranchToCreate.Properties.ParentBranch == null)
{
throw new GitTfsException("error : the branch you try to init '" + tfsPathBranchToCreate + "' is a root branch (e.g. has no parents).",
new List<string> { "Clone this branch from Tfs instead of trying to init it!\n Command: git tfs clone " + Url + " " + tfsPathBranchToCreate });
}

tfsPathParentBranch = tfsBranchToCreate.Properties.ParentBranch.Item;
Trace.WriteLine("Found parent branch : " + tfsPathParentBranch);

Expand Down
4 changes: 4 additions & 0 deletions doc/commands/branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ You should have done (to clone only the trunk) :

git tfs clone http://tfs:8080/tfs/DefaultCollection $/Repository/ProjectTrunk

Note : It is highly recommanded to clone the root branch ( the branch that has no parents, here $/Repository/ProjectTrunk ) to be able to init the other branches after.
If you clone the branch $/Repository/ProjectBranch, you will never able to init the root branch $/Repository/ProjectTrunk after.

Then use `branch` like this :

### Init a TFS branches using auto-naming of your git branch
git tfs branch --init $/Repository/ProjectBranch

Expand Down
13 changes: 12 additions & 1 deletion doc/commands/clone.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,21 @@ into a new directory `Project1`, do this:
git tfs clone http://tfs:8080/tfs/DefaultCollection $/Project1

### Clone only the trunk (or a branch)
Sometimes, it could be interesting to clone only a branch of a TFS repository (for exemple to extract only the trunk of your project and manage branches with `[branch](branch.md)`. Then, do this (the clone will be done in the `MyProject1Directory` directory):
Sometimes, it could be interesting to clone only a branch of a TFS repository (for exemple to extract only the trunk of your project and manage branches with `[branch](branch.md)`.

Suppose you have on TFS:

A <- B <- C <- D <- E $/Project1/Trunk
\
M <- N $/Project1/Branch

Then, do this (the clone will be done in the `MyProject1Directory` directory):

git tfs clone http://tfs:8080/tfs/DefaultCollection $/Project1/Trunk MyProject1Directory

Note : It is highly recommanded to clone the root branch ( the branch that has no parents, here $/Project1/Trunk ) to be able to init the other branches after.
If you clone the branch $/Project1/Branch, you will never able to init the root branch $/Project1/Trunk after.

### What repository path to clone?

If you don't know exactly what repository path to clone, see [list-remote-branches](list-remote-branches.md) command to get a list of the existing repositories.
Expand Down
5 changes: 5 additions & 0 deletions doc/commands/init-branch.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ To use this command, you should have cloned only the trunk folder in TFS (and no
(TFS 2008 only! And required!!) ex: $/Repository/ProjectParentBranch
-u, --username=VALUE TFS username
-p, --password=VALUE TFS password

## Examples

Suppose you have on TFS:
Expand All @@ -28,7 +29,11 @@ You should have done (to clone only the trunk) :

git tfs clone http://tfs:8080/tfs/DefaultCollection $/Repository/ProjectTrunk

Note : It is highly recommanded to clone the root branch ( the branch that has no parents, here $/Repository/ProjectTrunk ) to be able to init the other branches after.
If you clone the branch $/Repository/ProjectBranch, you will never able to init the root branch $/Repository/ProjectTrunk after.

Then use `init-branch` like this :

### Init a TFS branches using auto-naming of your git branch
git tfs init-branch $/Repository/ProjectBranch

Expand Down