1
TFS - Reference
2
TFS - Branching & Merging
two branches
Branch:-
Requirement:
·
slnLibrary has multiple Applications.
Like ProjLibrary \KidsBooks, ProjLibrary \Crime etc.
There is a code change in KidsBooks applications alone. Now we want
to create a branch only KidsBooks application. Once team done the
changes, we need to merge with ProjLibrary.
·
Consider
o
the new application modification
subproject name is YYYY_KidsBooks
o
the Main project is in TFS :
$ProjLibrary\main\>it contains all applications
1.
Create Folder for branch in $\Dev\<YYYY_KidsBooks>.
2.
Select $ProjLibrary\main\KidsBooks >
Right Click > Branch and Merge > Branch
1.
Source : by default it comes as
$ProjLibrary\main\KidsBooks
2.
Target : select
$\Dev\<YYYY_KidsBooks> and type "\KidsBooks"
3.
Select next - next
4.
Now New branch is created in target
which is branched from source.
Merging:-
1.
Once the code modifications done and
want to merge with main source for deployment.
2.
select $\Dev\<YYYY_KidsBooks>
\KidsBooks"
1.
Right Click > Branch and Merge >
Merge
2.
Source : by default it comes as select
$\Dev\<YYYY_KidsBooks> and type "\KidsBooks"
3.
Target : by default it comes as
s$ProjLibrary\main\KidsBooks
4.
Select next - next
5.
If any code conflict it will displayed -
need to solve either by use TFS automerge or manual merge.
6.
Now New branch code is merged with the
main project branch
Check-Out permission is required for
the branching and merging operation.
Merging allows to combines two different branches into one.
Merging can be done via TFS Source Control or from the command line using “tf
merge” command. Merge detects files that were added or modified inside Source
Branch and will add these changes or file into Target branch. If same files on
the Target Branch were modified, then Conflict Resolution screen will pop-up
with the opportunity to resolve the conflict.
3
List all latest releases
SELECT
RD.Id RelDefID, R.ID ReleaseID, R.Dataspaceid,RD.Name,
R.Description,
max(R.CreatedOn) LastDeployedDt
FROM
Tfs_DefaultCollection.Release.tbl_Release R,
Tfs_DefaultCollection.Release.tbl_ReleaseDefinition RD
WHERE
R.DefinitionId=rd.Id
and rd.id = r.DefinitionId
and R.DataspaceId = RD.DataspaceId
--and R.DataspaceId = 88
group by R.ID, RD.Id, RD.Name, R.Description,
R.Dataspaceid
4
List of All Releases from TFS SQL DB
select
* from Tfs_DefaultCollection.Release.tbl_Release
PartitionId
DataspaceId
Id
Name
Description
Status
DefinitionId
TargetEnvironmentId
DefinitionJson
DefinitionSnapshotRevision
Variables
VariableGroups
CreatedOn
CreatedBy
ModifiedOn
ModifiedBy
IsDeferred
DeferredDateTime
KeepForever
IsDeleted
Reason
ReleaseNameFormat
BuildId
5
List All latest Releases with
Environment
ReleaseDefName, DeploymentDescription,
DeployedOn, Environment
(
SELECT
RD.Id
RelDefID, R.ID ReleaseID, R.Dataspaceid,RD.Name, R.Description,
max(R.CreatedOn) LastDeployedDt
FROM
Tfs_DefaultCollection.Release.tbl_Release
R,
Tfs_DefaultCollection.Release.tbl_ReleaseDefinition RD
WHERE
R.DefinitionId=rd.Id
and rd.id =
r.DefinitionId
and R.DataspaceId
= RD.DataspaceId
--and
R.DataspaceId = 88
group by R.ID, RD.Id, RD.Name, R.Description,
R.Dataspaceid
) RandRD,
Release.tbl_DefinitionEnvironment DE
Where
RandRD.Dataspaceid
= DE.Dataspaceid
and
RandRD.ReleaseID = DE.CurrentReleaseId
order by
RandRD.LastDeployedDt desc
6
List All Release Definitions
select * from
Tfs_DefaultCollection.Release.tbl_ReleaseDefinition
PartitionId
DataspaceId
DefinitionType
Id
Revision
Name
Source
Variables
VariableGroups
ReleaseNameFormat
CreatedBy
CreatedOn
ModifiedBy
ModifiedOn
IsDeleted
FolderId
LastReleaseId
GuidId
7
List Branch and Build
Definition – Qry
SELECT
Def_Bld_Rep.Dataspaceid, BranchName, DefinitionName BuildDefinition
from
Tfs_DefaultCollection.Build.tbl_RepositoryBranch Def_Bld_Rep,
Tfs_DefaultCollection.Build.tbl_Definition
Def_Bld_Def
where
Def_Bld_Rep.BranchId = Def_Bld_Def.DefaultBranchId
order by
DataspaceId
8
How to find Build Definition
and Involved Steps
Run the query:-
select DataspaceId, DefinitionName, Steps from
Tfs_DefaultCollection.Build.tbl_Definition
Result: will have steps in one single field .
- Copy paste into notepad++
- Find and Replace as given below - it will
provide in readable format each step in one line.
9
User Report for Auditing:-
select
Distinct ti.AccountName UserID, ti.ProviderDisplayName
UserName, gs.DisplayName Project
from
dbo.tbl_Identity ti, tbl_GroupMembership tgm, tbl_Group Gs,
tbl_GroupScopeVisibility GSV
where ti.id = tgm.MemberId
and tgm.ContainerId = Gs.id
and ti.id = GSV.identityid
and ti.TypeId < 8
and gsv.Active = 1
and ti.Domain = 'domainname'
order by ti.ProviderDisplayName
10
Users, Member in Group Details
use
Tfs_Configuration
go
select distinct
ti.AccountName IdentityAccountName
,ti.typeid,ti.ProviderDisplayName
IdentityProviderDisplayName
, gs.DisplayName GroupDisplayName
from
dbo.tbl_Identity ti, tbl_GroupMembership tgm, tbl_Group Gs
where ti.id =
tgm.MemberId
and
tgm.ContainerId = Gs.id
order by
ti.typeid
11
Build definition and folder
use
Tfs_Configuration
GO
SELECT
BranchName, DefinitionName BuildDefinition
from
Tfs_DefaultCollection.Build.tbl_RepositoryBranch Def_Bld_Rep,
Tfs_DefaultCollection.Build.tbl_Definition
Def_Bld_Def
where
Def_Bld_Rep.BranchId = Def_Bld_Def.DefaultBranchId