├── .gitignore ├── .gitmodules ├── .nuget ├── NuGet.Config ├── NuGet.exe ├── fake-nuget ├── nuget.targets └── packages.config ├── .travis.yml ├── CI.proj ├── CONTRIBUTING.md ├── CommonAssemblyInfo.cs ├── Gemfile ├── Gemfile.lock ├── GitTfs.Vs11 ├── GitTfs.Vs11.csproj ├── ParentForm.cs ├── Properties │ └── AssemblyInfo.cs ├── TfsHelper.Vs11.cs ├── TfsPlugin.cs └── Wrappers.Vs11.cs ├── GitTfs.Vs2008 ├── GitTfs.Vs2008.csproj ├── Properties │ └── AssemblyInfo.cs ├── TfsHelper.Vs2008.cs ├── TfsPlugin.cs └── Wrappers.Vs2008.cs ├── GitTfs.Vs2010 ├── GitTfs.Vs2010.csproj ├── ParentForm.cs ├── Properties │ └── AssemblyInfo.cs ├── TfsHelper.Vs2010.cs ├── TfsPlugin.cs └── Wrappers.Vs2010.cs ├── GitTfs.VsCommon ├── TfsHelper.Common.cs ├── TfsHelper.PostVs2010.Common.cs ├── Wrappers.PostVs2010.cs └── Wrappers.cs ├── GitTfs.VsFake ├── GitTfs.VsFake.csproj ├── Properties │ └── AssemblyInfo.cs ├── Script.cs ├── TfsHelper.VsFake.cs └── TfsPlugin.cs ├── GitTfs.sln ├── GitTfs ├── App.config ├── Commands │ ├── Bootstrap.cs │ ├── Branch.cs │ ├── Checkin.cs │ ├── CheckinBase.cs │ ├── CheckinOptions.cs │ ├── CheckinTool.cs │ ├── Cleanup.cs │ ├── CleanupOptions.cs │ ├── CleanupWorkspaceLocal.cs │ ├── CleanupWorkspaces.cs │ ├── Clone.cs │ ├── Diagnostics.cs │ ├── Fetch.cs │ ├── Help.cs │ ├── Helpers.cs │ ├── Info.cs │ ├── Init.cs │ ├── InitBranch.cs │ ├── InitOptions.cs │ ├── Labels.cs │ ├── Pull.cs │ ├── QuickClone.cs │ ├── QuickFetch.cs │ ├── Rcheckin.cs │ ├── RemoteOptions.cs │ ├── Shelve.cs │ ├── ShelveList.cs │ ├── Unshelve.cs │ ├── Verify.cs │ └── Version.cs ├── Core │ ├── BranchVisitors │ │ └── BranchTreeContainsPathVisitor.cs │ ├── Changes │ │ └── Git │ │ │ ├── Add.cs │ │ │ ├── Delete.cs │ │ │ ├── Modify.cs │ │ │ └── RenameEdit.cs │ ├── CheckinPolicyEvaluator.cs │ ├── DelimitedReader.cs │ ├── DerivedGitTfsRemote.cs │ ├── Ext.cs │ ├── GitChangeInfo.cs │ ├── GitCommandException.cs │ ├── GitCommit.cs │ ├── GitHelpers.cs │ ├── GitIndexInfo.cs │ ├── GitObject.cs │ ├── GitRepository.cs │ ├── GitTfs.cs │ ├── GitTfsException.cs │ ├── GitTfsRemote.cs │ ├── GitTfsVersionProvider.cs │ ├── GitTreeEntry.cs │ ├── IBranchTreeVisitor.cs │ ├── IGitChangedFile.cs │ ├── IGitHelpers.cs │ ├── IGitRepository.cs │ ├── IGitTfsRemote.cs │ ├── IGitTfsVersionProvider.cs │ ├── ITfsChangeset.cs │ ├── ITfsWorkitem.cs │ ├── ITfsWorkspace.cs │ ├── ITreeEntry.cs │ ├── LogEntry.cs │ ├── Mode.cs │ ├── RemoteConfigConverter.cs │ ├── RemoteInfo.cs │ ├── RequiresValidGitRepositoryAttribute.cs │ ├── TfsChangeset.cs │ ├── TfsChangesetInfo.cs │ ├── TfsInterop │ │ ├── IBranch.cs │ │ ├── IChange.cs │ │ ├── IChangeset.cs │ │ ├── ICheckinEvaluationResult.cs │ │ ├── ICheckinNote.cs │ │ ├── IIdentity.cs │ │ ├── IItem.cs │ │ ├── IPendingChange.cs │ │ ├── IShelveset.cs │ │ ├── ITfsHelper.cs │ │ ├── IVersionControlServer.cs │ │ ├── IWorkItemCheckedInfo.cs │ │ ├── IWorkItemCheckinInfo.cs │ │ ├── IWorkspace.cs │ │ ├── NullIdentity.cs │ │ ├── README.txt │ │ ├── TfsApiBridge.cs │ │ ├── TfsChangeType.cs │ │ ├── TfsCheckinEvaluationOptions.cs │ │ ├── TfsExt.cs │ │ ├── TfsItemType.cs │ │ ├── TfsPlugin.cs │ │ ├── TfsRecursionType.cs │ │ ├── TfsShelvingOptions.cs │ │ ├── TfsWorkItemCheckinAction.cs │ │ └── WrapperFor.cs │ ├── TfsLabel.cs │ ├── TfsTreeEntry.cs │ ├── TfsWorkitem.cs │ ├── TfsWorkspace.cs │ └── TfsWriter.cs ├── GitTfs.cs ├── GitTfs.csproj ├── GitTfsCommand.cs ├── GitTfsConstants.cs ├── GitTfsExitCodes.cs ├── Globals.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── Util │ ├── AuthorsFile.cs │ ├── CommitSpecificCheckinOptionsFactory.cs │ ├── ConfiguresStructureMap.cs │ ├── ExceptionFormattingExtensions.cs │ ├── GitTfsCommandFactory.cs │ ├── GitTfsCommandRunner.cs │ ├── InspectExtensions.cs │ ├── PluggableWithAliases.cs │ ├── StructureMapSingletonAttribute.cs │ ├── TemporaryFile.cs │ ├── TemporaryFileStream.cs │ └── WhenDynamicDoesntWork.cs ├── GitTfsBenchmarks ├── Benchmark.cs ├── Benchmarks │ └── HashAndInsertObject.cs ├── GitTfsBenchmarks.csproj └── Properties │ └── AssemblyInfo.cs ├── GitTfsTest.Vs2010 ├── GitTfsTest.Vs2010.csproj ├── Properties │ └── AssemblyInfo.cs ├── TfsApiBridgeTest.cs └── packages.config ├── GitTfsTest ├── Commands │ ├── ExtTest.cs │ ├── HelpTest.cs │ ├── InitBranchTest.cs │ ├── InitOptionsTest.cs │ ├── InitTest.cs │ └── ShelveTest.cs ├── Core │ ├── BranchVisitors │ │ └── BranchContainsPathVisitorTest.cs │ ├── DelimitedReaderTests.cs │ ├── ExtTests.cs │ ├── GitChangeInfoTests.cs │ ├── GitTfsRemoteTests.cs │ ├── ModeTests.cs │ ├── RemoteConfigConverterDumpTests.cs │ ├── RemoteConfigConverterLoadTests.cs │ ├── StubbedCheckinEvaluationResult.cs │ ├── TfsApiBridgeTest.cs │ ├── TfsInterop │ │ └── BranchExtensionsTest.cs │ └── TfsWorkspaceTests.cs ├── FactExceptOnUnix.cs ├── GitTfsRegexTests.cs ├── GitTfsTest.csproj ├── Integration │ ├── BootstrapTests.cs │ ├── CloneTests.cs │ ├── FetchTests.cs │ └── IntegrationHelper.cs ├── Properties │ └── AssemblyInfo.cs ├── TestHelpers │ └── ExtensionMethods.cs ├── Util │ ├── AuthorsFileUnitTest.cs │ ├── CommitSpecificCheckinOptionsFactoryTests.cs │ └── GitTfsCommandRunnerTests.cs └── packages.config ├── LICENSE ├── NOTICE ├── README.md ├── Rakefile ├── TODO ├── VERSION ├── Version.cs ├── autorake.rb ├── docs └── config.md ├── lib ├── Microsoft │ └── TeamFoundation │ │ └── 2010 │ │ └── Microsoft.TeamFoundation.VersionControl.ControlAdapter.dll ├── NDesk.Options │ └── lib │ │ ├── monodoc │ │ └── sources │ │ │ ├── ndesk-options-docs.source │ │ │ ├── ndesk-options-docs.tree │ │ │ └── ndesk-options-docs.zip │ │ ├── ndesk-options │ │ ├── NDesk.Options.dll │ │ └── Options.cs │ │ └── pkgconfig │ │ └── ndesk-options.pc └── StructureMap │ ├── LICENSE.TXT │ ├── Rhino.Mocks.dll │ ├── StructureMap.AutoMocking.dll │ ├── StructureMap.AutoMocking.xml │ ├── StructureMap.chm │ ├── StructureMap.dll │ ├── StructureMap.xml │ └── StructureMapDoctor.exe ├── mono-git-tfs ├── sample.html ├── sample.txt └── test-git-tfs.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Local-only VS/Re#/etc files 2 | *.suo 3 | *.user 4 | *.gpState 5 | _ReSharper.* 6 | .*.swp 7 | 8 | # 9 | 10 | # Build outputs 11 | bin 12 | obj 13 | pkg 14 | 15 | # 3rd-party stuff copied during build 16 | packages/ 17 | GitTfs/git2.* 18 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/libgit2sharp"] 2 | path = lib/libgit2sharp 3 | url = https://github.com/libgit2/libgit2sharp.git 4 | -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spraints/git-tfs/8f031880fa0883d47a8627ea5f232941af0d68c3/.nuget/NuGet.exe -------------------------------------------------------------------------------- /.nuget/fake-nuget: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | command=$1 4 | manifest=$2 5 | dest=$6 6 | 7 | ERR_COMMAND=1 8 | ERR_DOWNLOAD=2 9 | ERR_EXTRACT=3 10 | 11 | if [ "$command" != "install" ] 12 | then 13 | echo "Only install is supported. (command was $command)" 14 | exit $ERR_COMMAND 15 | fi 16 | 17 | # http://stackoverflow.com/questions/893585/how-to-parse-xml-in-bash 18 | read_dom() { 19 | local IFS=\> 20 | read -d \< ENTITY CONTENT 21 | } 22 | 23 | parse_dom() { 24 | echo $ENTITY 25 | TAG_NAME=${ENTITY%% *} 26 | ATTRIBUTES=${ENTITY#* } 27 | if [ "$TAG_NAME" == "package" ] 28 | then 29 | eval local $ATTRIBUTES 30 | pkgdest="$dest/$id.$version" 31 | pkg="$id.$version.nupkg" 32 | downloaded="$pkgdest/$pkg" 33 | if [ ! -d "$pkgdest" ] 34 | then 35 | mkdir -p "$pkgdest" 36 | fi 37 | if [ ! -f "$downloaded" ] 38 | then 39 | curl -L -o "$downloaded" "https://nuget.org/api/v2/package/$id/$version" || exit $ERR_DOWNLOAD 40 | fi 41 | unzip -o -d $pkgdest $downloaded || exit $ERR_EXTRACT 42 | fi 43 | } 44 | 45 | install_packages() { 46 | while read_dom 47 | do 48 | parse_dom 49 | done 50 | } 51 | 52 | cat $manifest | install_packages 53 | -------------------------------------------------------------------------------- /.nuget/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | notifications: 4 | irc: 5 | channels: 6 | - "irc.freenode.org#git-tfs" 7 | template: 8 | - "travis build %{build_number} (%{branch} - %{commit} - %{author}): %{message} #{build_url}" 9 | on_success: change 10 | on_failure: always 11 | 12 | install: 13 | - sudo apt-get install cmake mono-devel mono-gmcs 14 | 15 | script: 16 | - git submodule update --init 17 | - cd lib/libgit2sharp 18 | - git submodule update --init 19 | - mkdir cmake-build 20 | - cd cmake-build 21 | - cmake -DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_CLAR=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=./libgit2-bin ../libgit2 22 | - export LD_LIBRARY_PATH=$PWD/libgit2-bin/lib 23 | - cmake --build . --target install 24 | - cp -Rpv libgit2-bin/lib ../Lib/NativeBinaries/ 25 | - cd .. 26 | - cd ../.. 27 | - xbuild CI.proj 28 | -------------------------------------------------------------------------------- /CI.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ./ 6 | .nuget/packages.config 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Getting Involved 2 | 3 | 0. In your git-tfs clone, run `git config core.autocrlf true` so that all the line endings are unix line endings when you commit. 4 | 5 | 1. **Read the source.** It's hopefully not that intimidating. 6 | 7 | 2. **Check for issues.** There are a few issues that are low-hanging fruit. Feel free to pick them. 8 | 9 | 3. **Ask questions.** Feel free to drop me a line, or ask a question over at the [google group](http://groups.google.com/group/git-tfs-dev/), or join `#git-tfs` on FreeNode. 10 | 11 | ## Pull Requests 12 | 13 | Here are some tips on creating a pull request: 14 | 15 | 1. Write awesome code. :sparkles: 16 | 17 | 2. Make sure the existing unit tests don't break. We try to keep the unit tests 18 | [easy to run](https://github.com/git-tfs/git-tfs/wiki/Running-the-Unit-Tests). 19 | 20 | 3. We like new unit tests. If you can unit test your code, do so. 21 | One of the pain points of the current git-tfs codebase is that parts of it are very difficult to unit test. 22 | It's slowly getting less painful to unit test. One thing to try is to write an integration test 23 | that runs git-tfs with the VsFake driver, similar to how the clone tests are written. 24 | 25 | 4. If you modify code in any of the client adapters (GitTfs.Vs*), please try it out with as many versions of the TFS client libraries as you can. 26 | When you submit the pull request, include a note about which versions you have tried to compile with, and which ones you have tested with. 27 | -------------------------------------------------------------------------------- /CommonAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | [assembly: AssemblyCompany("SEP")] 4 | [assembly: AssemblyProduct("GitTfs")] 5 | [assembly: AssemblyCopyright("Copyright © 2009-2010")] 6 | [assembly: AssemblyVersion(GitTfsProperties.Version)] 7 | [assembly: AssemblyFileVersion(GitTfsProperties.Version)] 8 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | gem 'albacore' 3 | gem 'jeweler' 4 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | albacore (0.2.2) 5 | rake (>= 0.8.7) 6 | rubyzip (>= 0.9.4) 7 | gemcutter (0.6.1) 8 | git (1.2.5) 9 | jeweler (1.4.0) 10 | gemcutter (>= 0.1.0) 11 | git (>= 1.2.5) 12 | rubyforge (>= 2.0.0) 13 | json_pure (1.4.6) 14 | rake (0.8.7) 15 | rubyforge (2.0.4) 16 | json_pure (>= 1.1.7) 17 | rubyzip (0.9.4) 18 | 19 | PLATFORMS 20 | x86-mingw32 21 | 22 | DEPENDENCIES 23 | albacore 24 | jeweler 25 | -------------------------------------------------------------------------------- /GitTfs.Vs11/ParentForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace Sep.Git.Tfs.Vs11 8 | { 9 | public class ParentForm : Form 10 | { 11 | public ParentForm() 12 | { 13 | WindowState = FormWindowState.Minimized; 14 | ShowInTaskbar = false; 15 | FormBorderStyle = FormBorderStyle.None; 16 | StartPosition = FormStartPosition.CenterParent; 17 | } 18 | 19 | protected override void OnLoad(EventArgs e) 20 | { 21 | Visible = false; 22 | base.OnLoad(e); 23 | WindowState = FormWindowState.Normal; 24 | CenterToParent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /GitTfs.Vs11/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("GitTfs.Vs11")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | 11 | // Setting ComVisible to false makes the types in this assembly not visible 12 | // to COM components. If you need to access a type in this assembly from 13 | // COM, set the ComVisible attribute to true on that type. 14 | [assembly: ComVisible(false)] 15 | 16 | // The following GUID is for the ID of the typelib if this project is exposed to COM 17 | [assembly: Guid("d2c68247-a04a-464a-899d-a906c6828174")] 18 | -------------------------------------------------------------------------------- /GitTfs.Vs11/TfsPlugin.cs: -------------------------------------------------------------------------------- 1 | namespace Sep.Git.Tfs.Vs11 2 | { 3 | class TfsPlugin : Sep.Git.Tfs.Core.TfsInterop.TfsPlugin 4 | { 5 | public override void Initialize(StructureMap.Graph.IAssemblyScanner scan) 6 | { 7 | base.Initialize(scan); 8 | scan.AssemblyContainingType(typeof(Microsoft.TeamFoundation.Client.TfsTeamProjectCollection)); 9 | } 10 | 11 | public override void Initialize(StructureMap.ConfigurationExpression config) 12 | { 13 | } 14 | 15 | public override bool IsViable() 16 | { 17 | return null != typeof(Microsoft.TeamFoundation.Client.TfsTeamProjectCollection).Assembly; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /GitTfs.Vs11/Wrappers.Vs11.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.TeamFoundation.VersionControl.Client; 3 | using Sep.Git.Tfs.Core.TfsInterop; 4 | 5 | namespace Sep.Git.Tfs.VsCommon 6 | { 7 | public partial class WrapperForWorkspace 8 | { 9 | public int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable workItemChanges, 10 | TfsPolicyOverrideInfo policyOverrideInfo, bool overrideGatedCheckIn) 11 | { 12 | var checkinParameters = new WorkspaceCheckInParameters(_bridge.Unwrap(changes), comment) 13 | { 14 | CheckinNotes = _bridge.Unwrap(checkinNote), 15 | AssociatedWorkItems = _bridge.Unwrap(workItemChanges), 16 | PolicyOverride = ToTfs(policyOverrideInfo), 17 | OverrideGatedCheckIn = overrideGatedCheckIn 18 | }; 19 | 20 | return _workspace.CheckIn(checkinParameters); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /GitTfs.Vs2008/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("GitTfs.Vs2008")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | 11 | // Setting ComVisible to false makes the types in this assembly not visible 12 | // to COM components. If you need to access a type in this assembly from 13 | // COM, set the ComVisible attribute to true on that type. 14 | [assembly: ComVisible(false)] 15 | 16 | // The following GUID is for the ID of the typelib if this project is exposed to COM 17 | [assembly: Guid("08b00a8b-ef09-4850-9ea7-667ae091cd33")] 18 | -------------------------------------------------------------------------------- /GitTfs.Vs2008/TfsHelper.Vs2008.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spraints/git-tfs/8f031880fa0883d47a8627ea5f232941af0d68c3/GitTfs.Vs2008/TfsHelper.Vs2008.cs -------------------------------------------------------------------------------- /GitTfs.Vs2008/TfsPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Sep.Git.Tfs.Vs2008 4 | { 5 | class TfsPlugin : Sep.Git.Tfs.Core.TfsInterop.TfsPlugin 6 | { 7 | public override void Initialize(StructureMap.Graph.IAssemblyScanner scan) 8 | { 9 | base.Initialize(scan); 10 | scan.AssemblyContainingType(typeof (Microsoft.TeamFoundation.Client.TeamFoundationServer)); 11 | } 12 | 13 | public override void Initialize(StructureMap.ConfigurationExpression config) 14 | { 15 | } 16 | 17 | public override bool IsViable() 18 | { 19 | return null != typeof (Microsoft.TeamFoundation.Client.TeamFoundationServer).Assembly; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /GitTfs.Vs2008/Wrappers.Vs2008.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.TeamFoundation.VersionControl.Client; 3 | using Sep.Git.Tfs.Core.TfsInterop; 4 | 5 | namespace Sep.Git.Tfs.VsCommon 6 | { 7 | public partial class WrapperForWorkspace 8 | { 9 | public int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable workItemChanges, 10 | TfsPolicyOverrideInfo policyOverrideInfo, bool overrideGatedCheckIn) 11 | { 12 | return _workspace.CheckIn( 13 | _bridge.Unwrap(changes), 14 | comment, 15 | _bridge.Unwrap(checkinNote), 16 | _bridge.Unwrap(workItemChanges), 17 | ToTfs(policyOverrideInfo)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /GitTfs.Vs2010/ParentForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace Sep.Git.Tfs.Vs2010 8 | { 9 | public class ParentForm : Form 10 | { 11 | public ParentForm() 12 | { 13 | WindowState = FormWindowState.Minimized; 14 | ShowInTaskbar = false; 15 | FormBorderStyle = FormBorderStyle.None; 16 | StartPosition = FormStartPosition.CenterParent; 17 | } 18 | 19 | protected override void OnLoad(EventArgs e) 20 | { 21 | Visible = false; 22 | base.OnLoad(e); 23 | WindowState = FormWindowState.Normal; 24 | CenterToParent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /GitTfs.Vs2010/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("GitTfs.Vs2010")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | 11 | // Setting ComVisible to false makes the types in this assembly not visible 12 | // to COM components. If you need to access a type in this assembly from 13 | // COM, set the ComVisible attribute to true on that type. 14 | [assembly: ComVisible(false)] 15 | 16 | // The following GUID is for the ID of the typelib if this project is exposed to COM 17 | [assembly: Guid("f876a2ae-258b-4c59-8303-8399d453e748")] 18 | -------------------------------------------------------------------------------- /GitTfs.Vs2010/TfsPlugin.cs: -------------------------------------------------------------------------------- 1 | namespace Sep.Git.Tfs.Vs2010 2 | { 3 | class TfsPlugin : Sep.Git.Tfs.Core.TfsInterop.TfsPlugin 4 | { 5 | public override void Initialize(StructureMap.Graph.IAssemblyScanner scan) 6 | { 7 | base.Initialize(scan); 8 | scan.AssemblyContainingType(typeof (Microsoft.TeamFoundation.Client.TfsTeamProjectCollection)); 9 | } 10 | 11 | public override void Initialize(StructureMap.ConfigurationExpression config) 12 | { 13 | } 14 | 15 | public override bool IsViable() 16 | { 17 | return null != typeof(Microsoft.TeamFoundation.Client.TfsTeamProjectCollection).Assembly; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /GitTfs.Vs2010/Wrappers.Vs2010.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.TeamFoundation.VersionControl.Client; 3 | using Sep.Git.Tfs.Core.TfsInterop; 4 | 5 | namespace Sep.Git.Tfs.VsCommon 6 | { 7 | public partial class WrapperForWorkspace 8 | { 9 | public int Checkin(IPendingChange[] changes, string comment, ICheckinNote checkinNote, IEnumerable workItemChanges, 10 | TfsPolicyOverrideInfo policyOverrideInfo, bool overrideGatedCheckIn) 11 | { 12 | var checkinParameters = new WorkspaceCheckInParameters(_bridge.Unwrap(changes), comment) 13 | { 14 | CheckinNotes = _bridge.Unwrap(checkinNote), 15 | AssociatedWorkItems = _bridge.Unwrap(workItemChanges), 16 | PolicyOverride = ToTfs(policyOverrideInfo), 17 | OverrideGatedCheckIn = overrideGatedCheckIn 18 | }; 19 | 20 | return _workspace.CheckIn(checkinParameters); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /GitTfs.VsCommon/TfsHelper.PostVs2010.Common.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Linq; 5 | using Microsoft.TeamFoundation.VersionControl.Client; 6 | using Sep.Git.Tfs.Core; 7 | using Sep.Git.Tfs.Core.BranchVisitors; 8 | using Sep.Git.Tfs.Core.TfsInterop; 9 | using StructureMap; 10 | 11 | namespace Sep.Git.Tfs.VsCommon 12 | { 13 | public abstract class TfsHelperVs2010Base : TfsHelperBase 14 | { 15 | TfsApiBridge _bridge; 16 | 17 | public TfsHelperVs2010Base(TextWriter stdout, TfsApiBridge bridge, IContainer container) 18 | : base(stdout, bridge, container) 19 | { 20 | _bridge = bridge; 21 | } 22 | 23 | public override bool CanGetBranchInformation { get { return true; } } 24 | 25 | public override IEnumerable GetAllTfsRootBranchesOrderedByCreation() 26 | { 27 | return VersionControl.QueryRootBranchObjects(RecursionType.Full) 28 | .Where(b => b.Properties.ParentBranch == null) 29 | .Select(b => b.Properties.RootItem.Item); 30 | } 31 | 32 | public override IEnumerable GetBranches() 33 | { 34 | var branches = VersionControl.QueryRootBranchObjects(RecursionType.Full) 35 | .Where(b => b.Properties.RootItem.IsDeleted == false); 36 | return _bridge.Wrap(branches); 37 | } 38 | 39 | public override int GetRootChangesetForBranch(string tfsPathBranchToCreate, string tfsPathParentBranch = null) 40 | { 41 | if (!string.IsNullOrWhiteSpace(tfsPathParentBranch)) 42 | Trace.WriteLine("Parameter about parent branch will be ignored because this version of TFS is able to find the parent!"); 43 | 44 | Trace.WriteLine("Looking for all branches..."); 45 | var allTfsBranches = VersionControl.QueryRootBranchObjects(RecursionType.Full); 46 | var tfsBranchToCreate = allTfsBranches.FirstOrDefault(b => b.Properties.RootItem.Item.ToLower() == tfsPathBranchToCreate.ToLower()); 47 | if (tfsBranchToCreate == null) 48 | return -1; 49 | tfsPathParentBranch = tfsBranchToCreate.Properties.ParentBranch.Item; 50 | Trace.WriteLine("Found parent branch : " + tfsPathParentBranch); 51 | 52 | int firstChangesetIdOfParentBranch = ((ChangesetVersionSpec)tfsBranchToCreate.Properties.ParentBranch.Version).ChangesetId; 53 | 54 | var firstChangesetInBranchToCreate = VersionControl.QueryHistory(tfsPathBranchToCreate, VersionSpec.Latest, 0, RecursionType.Full, 55 | null, null, null, int.MaxValue, true, false, false).Cast().LastOrDefault(); 56 | 57 | if (firstChangesetInBranchToCreate == null) 58 | { 59 | throw new GitTfsException("An unexpected error occured when trying to find the root changeset.\nFailed to find first changeset for " + tfsPathBranchToCreate); 60 | } 61 | 62 | var mergedItemsToFirstChangesetInBranchToCreate = 63 | VersionControl.TrackMerges(new int[] {firstChangesetInBranchToCreate.ChangesetId}, 64 | new ItemIdentifier(tfsPathBranchToCreate), 65 | new ItemIdentifier[] {new ItemIdentifier(tfsPathParentBranch),}, null); 66 | 67 | var lastChangesetsMergeFromParentBranch = mergedItemsToFirstChangesetInBranchToCreate.LastOrDefault(); 68 | 69 | if (lastChangesetsMergeFromParentBranch == null) 70 | { 71 | throw new GitTfsException("An unexpected error occured when trying to find the root changeset.\nFailed to find root changeset for " + tfsPathBranchToCreate + " branch in " + tfsPathParentBranch + " branch"); 72 | } 73 | 74 | var rootChangesetInParentBranch = lastChangesetsMergeFromParentBranch.SourceChangeset; 75 | 76 | return rootChangesetInParentBranch.ChangesetId; 77 | } 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /GitTfs.VsCommon/Wrappers.PostVs2010.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.TeamFoundation.VersionControl.Client; 5 | using Sep.Git.Tfs.Core.TfsInterop; 6 | 7 | namespace Sep.Git.Tfs.VsCommon 8 | { 9 | public class WrapperForBranchObject : WrapperFor, IBranchObject 10 | { 11 | BranchObject _branch; 12 | 13 | public WrapperForBranchObject(BranchObject branch) : base(branch) 14 | { 15 | _branch = branch; 16 | } 17 | 18 | public string Path 19 | { 20 | get { return _branch.Properties.RootItem.Item; } 21 | } 22 | 23 | public bool IsRoot 24 | { 25 | get { return _branch.Properties.ParentBranch == null; } 26 | } 27 | 28 | public string ParentPath 29 | { 30 | get { return _branch.Properties.ParentBranch.Item; } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /GitTfs.VsFake/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("GitTfs.VsFake")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | 11 | // Setting ComVisible to false makes the types in this assembly not visible 12 | // to COM components. If you need to access a type in this assembly from 13 | // COM, set the ComVisible attribute to true on that type. 14 | [assembly: ComVisible(false)] 15 | 16 | // The following GUID is for the ID of the typelib if this project is exposed to COM 17 | [assembly: Guid("03CBF74E-49C8-11E1-A1A2-EDE84824019B")] 18 | -------------------------------------------------------------------------------- /GitTfs.VsFake/Script.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.Serialization.Formatters.Binary; 6 | using System.Text; 7 | using Sep.Git.Tfs.Core; 8 | using Sep.Git.Tfs.Core.TfsInterop; 9 | 10 | namespace Sep.Git.Tfs.VsFake 11 | { 12 | public class Script 13 | { 14 | public const string EnvVar = "GIT_TFS_VSFAKE_SCRIPT"; 15 | 16 | public static Script Load(string path) 17 | { 18 | return new Script().Tap(script => Load(path, script)); 19 | } 20 | 21 | private static void Load(string path, Script script) 22 | { 23 | var formatter = new BinaryFormatter(); 24 | using (var stream = File.OpenRead(path)) 25 | script.Changesets.AddRange((List)formatter.Deserialize(stream)); 26 | } 27 | 28 | public void Save(string path) 29 | { 30 | var formatter = new BinaryFormatter(); 31 | using (var stream = File.Create(path)) 32 | formatter.Serialize(stream, Changesets); 33 | } 34 | 35 | List _changesets = new List(); 36 | public List Changesets { get { return _changesets; } } 37 | } 38 | 39 | [Serializable] 40 | public class ScriptedChangeset 41 | { 42 | public int Id { get; set; } 43 | public string Comment { get; set; } 44 | public DateTime CheckinDate { get; set; } 45 | public List Changes { get { return _changes; } } 46 | 47 | List _changes = new List(); 48 | } 49 | 50 | [Serializable] 51 | public class ScriptedChange 52 | { 53 | public TfsChangeType ChangeType { get; set; } 54 | public TfsItemType ItemType { get; set; } 55 | public string RepositoryPath { get; set; } 56 | public string Content { get; set; } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /GitTfs.VsFake/TfsPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Sep.Git.Tfs.Core; 4 | namespace Sep.Git.Tfs.VsFake 5 | { 6 | class TfsPlugin : Sep.Git.Tfs.Core.TfsInterop.TfsPlugin 7 | { 8 | /* 9 | public override void Initialize(StructureMap.Graph.IAssemblyScanner scan) 10 | { 11 | base.Initialize(scan); 12 | } 13 | */ 14 | 15 | public override void Initialize(StructureMap.ConfigurationExpression config) 16 | { 17 | config.For