コード例 #1
0
        public void ExportFiles(SourceControlContext context, string targetDirectory)
        {
            var tfsContext = (TfsSourceControlContext)context;

            this.LogDebug("Exporting files from \"{0}\" to \"{1}\"...", tfsContext.WorkspaceDiskPath, targetDirectory);
            this.CopyNonTfsFiles(tfsContext.WorkspaceDiskPath, targetDirectory);
        }
コード例 #2
0
        public override void EnsureLocalWorkspace(SourceControlContext context)
        {
            var repoPath = context.Repository.GetDiskPath(this.Agent);

            if (!this.Agent.DirectoryExists(repoPath) || !this.Agent.DirectoryExists(this.Agent.CombinePath(repoPath, ".hg")))
            {
                this.Agent.CreateDirectory(repoPath);
                this.Clone(context);
            }
        }
コード例 #3
0
        public void ApplyLabel(string label, SourceControlContext context)
        {
            if (string.IsNullOrEmpty(label))
                throw new ArgumentNullException("label");

            if (context.Repository == null)
                throw new ArgumentException(context.ToLegacyPathString() + " does not represent a valid Git path.", "sourcePath");

            this.EnsureLocalRepository(context);
            this.UpdateLocalRepository(context, null);
            this.GitClient.ApplyTag(context.Repository, label);
        }
コード例 #4
0
 private void EnsureLocalWorkspaceInternal(SourceControlContext context)
 {
     this.LogDebug("Ensuring local workspace disk path: " + context.WorkspaceDiskPath);
     if (!Directory.Exists(context.WorkspaceDiskPath))
     {
         this.LogDebug("Creating workspace disk path...");
         Directory.CreateDirectory(context.WorkspaceDiskPath);
     }
     else
     {
         this.LogDebug("Workspace disk path exists.");
     }
 }
コード例 #5
0
ファイル: ChangesTodayWidget.cs プロジェクト: ArildF/Smeedee
        public ChangesTodayWidget()
        {
            sourceControlContext = new SourceControlContext();

            View = new ChangesTodayView()
            {
                DataContext = sourceControlContext.Changesets
            };

            var timer = new Timer((o) =>
            {
                LoadTodaysChangesets();
            }, null, 0, 30000);
        }
コード例 #6
0
        public override IEnumerable <string> EnumerateBranches(SourceControlContext context)
        {
            this.EnsureLocalWorkspace(context);
            this.UpdateLocalWorkspace(context);

            var result = this.ExecuteHgCommand(context.Repository, "heads", "--template \"{branch}\\r\\n\"");

            if (result.ExitCode != 0)
            {
                throw new InvalidOperationException(Util.CoalesceStr(string.Join(Environment.NewLine, result.Error), "Exit code was nonzero: " + result.ExitCode));
            }

            return(result.Output);
        }
コード例 #7
0
        public void OnInitialize()
        {
            Changesets = new ObservableCollection<ChangesetViewModel>();

            sourceControlContext = new SourceControlContext();
            lastSixChangesetsQuery = sourceControlContext.GetAllQuery().
                OrderByDescending(e => e.Time).Take(6);


            timer = new Timer((o) =>
            {
                LoadChangesets(lastSixChangesetsQuery);
            }, null, 0, 15000);
        }
コード例 #8
0
        public override void UpdateLocalWorkspace(SourceControlContext context)
        {
            if (string.IsNullOrEmpty(context.Repository.RemoteUrl))
            {
                return;
            }

            // pull changes if remote repository is used
            if (!string.IsNullOrEmpty(context.Repository.RemoteUrl))
            {
                this.ExecuteHgCommand(context.Repository, "pull", context.Repository.RemoteUrl);
            }

            // update the working repository, and do not check out the files
            this.ExecuteHgCommand(context.Repository, "update", "-C", context.Branch);
        }
コード例 #9
0
        public override object GetCurrentRevision(SourceControlContext context)
        {
            if (context.Repository == null)
            {
                throw new ArgumentException("Path must specify a Mercurial repository.");
            }

            this.UpdateLocalWorkspace(context);
            var res = this.ExecuteHgCommand(context.Repository, "log -r \"branch('default') and reverse(not(desc('Added tag ') and file(.hgtags)))\" -l1 --template \"{node}\"");

            if (!res.Output.Any())
            {
                return(string.Empty);
            }

            return(res.Output[0]);
        }
コード例 #10
0
        private void UpdateLocalWorkspaceInternal(SourceControlContext context)
        {
            using (var tfs = this.GetTeamProjectCollection())
            {
                var versionControlServer = tfs.GetService <VersionControlServer>();

                var workspace = this.GetMappedWorkspace(versionControlServer, (TfsSourceControlContext)context);
                if (context.Label != null)
                {
                    string sourcePath = ((TfsSourceControlContext)context).SourcePath;
                    var    getRequest = new GetRequest(new ItemSpec(sourcePath, RecursionType.Full), VersionSpec.ParseSingleSpec("L" + context.Label, versionControlServer.AuthorizedUser));
                    workspace.Get(getRequest, GetOptions.Overwrite);
                }
                else
                {
                    workspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
                }
            }
        }
コード例 #11
0
        public override void GetLabeled(string label, SourceControlContext context, string targetPath)
        {
            if (string.IsNullOrEmpty(label))
            {
                throw new ArgumentNullException("label");
            }
            if (string.IsNullOrEmpty(targetPath))
            {
                throw new ArgumentNullException("targetPath");
            }

            if (context.Repository == null)
            {
                throw new ArgumentException(context.ToLegacyPathString() + " does not represent a valid Mercurial path.", "context");
            }

            this.UpdateLocalWorkspace(context);

            this.ExecuteHgCommand(context.Repository, "update", "-r \"" + label + "\"");
            this.ExportFiles(context, targetPath);
        }
コード例 #12
0
 public override void ExportFiles(SourceControlContext context, string targetDirectory)
 {
     this.ExecuteHgCommand(context.Repository, "archive", "\"" + targetDirectory + "\" -S -X \".hg*\"");
 }
コード例 #13
0
        public object GetCurrentRevision(SourceControlContext context)
        {
            if (context.Repository == null)
                throw new ArgumentException(context.ToLegacyPathString() + " does not represent a valid Git path.", "sourcePath");

            this.EnsureLocalRepository(context);
            this.GitClient.UpdateLocalRepo(context.Repository, context.Branch, null);
            return this.GitClient.GetLastCommit(context.Repository, context.Branch);
        }
コード例 #14
0
 public void ExportFiles(SourceControlContext context, string targetDirectory)
 {
     var tfsContext = (TfsSourceControlContext)context;
     this.LogDebug("Exporting files from \"{0}\" to \"{1}\"...", tfsContext.WorkspaceDiskPath, targetDirectory);
     this.CopyNonTfsFiles(tfsContext.WorkspaceDiskPath, targetDirectory);
 }
コード例 #15
0
 private void DeleteWorkspaceInternal(SourceControlContext context)
 {
     DirectoryEx.Clear(context.WorkspaceDiskPath);
 }
コード例 #16
0
 private string GetWorkspaceDiskPathInternal(SourceControlContext context)
 {
     return(context.WorkspaceDiskPath);
 }
コード例 #17
0
 public override void GetLabeled(string label, SourceControlContext context, string targetPath)
 {
     this.WrappedProvider.GetLabeled(label, context, targetPath);
 }
コード例 #18
0
 public override void UpdateLocalWorkspace(SourceControlContext context)
 {
     this.WrappedProvider.UpdateLocalRepository(context, null);
 }
コード例 #19
0
 public void DeleteWorkspace(SourceControlContext context)
 {
     this.Agent.ClearFolder(context.WorkspaceDiskPath);
 }
コード例 #20
0
 public void EnsureLocalRepository(SourceControlContext context)
 {
     var fileOps = (IFileOperationsExecuter)this.Agent;
     var repoPath = context.Repository.GetDiskPath(fileOps);
     if (!fileOps.DirectoryExists(repoPath) || !fileOps.DirectoryExists(fileOps.CombinePath(repoPath, ".git")))
     {
         fileOps.CreateDirectory(repoPath);
         this.GitClient.CloneRepo(context.Repository);
     }
 }
コード例 #21
0
 public void DeleteWorkspace(SourceControlContext context)
 {
     DirectoryEx.Clear(context.WorkspaceDiskPath);
 }
コード例 #22
0
 public void Clone(SourceControlContext context)
 {
     this.GitClient.CloneRepo(context.Repository);
 }
コード例 #23
0
 public void UpdateLocalRepository(SourceControlContext context, string tag)
 {
     this.GitClient.UpdateLocalRepo(context.Repository, context.Branch, tag);
 }
コード例 #24
0
        public void GetLatest(SourceControlContext context, string targetPath)
        {
            if (targetPath == null)
                throw new ArgumentNullException("targetPath");
            if (context.Repository == null)
                throw new ArgumentException(context.ToLegacyPathString() + " does not represent a valid Git path.", "sourcePath");

            this.EnsureLocalRepository(context);
            this.UpdateLocalRepository(context, null);
            this.ExportFiles(context, targetPath);
        }
コード例 #25
0
 public DirectoryEntryInfo GetDirectoryEntryInfo(SourceControlContext context)
 {
     return this.GetDirectoryEntryInfo((GitPath)context);
 }
コード例 #26
0
 public IEnumerable<string> EnumerateLabels(SourceControlContext context)
 {
     throw new NotImplementedException();
 }
コード例 #27
0
 public IEnumerable<string> EnumerateBranches(SourceControlContext context)
 {
     return this.GitClient.EnumBranches(context.Repository);
 }
コード例 #28
0
 public override object GetCurrentRevision(SourceControlContext context)
 {
     return this.WrappedProvider.GetCurrentRevision(context);
 }
コード例 #29
0
ファイル: SourceControlTests.cs プロジェクト: ArildF/Smeedee
 public SourceControlTests()
 {
     SourceControlContextMock = new SourceControlContext();
 }
コード例 #30
0
 public override void GetLatest(SourceControlContext context, string targetPath)
 {
     this.WrappedProvider.GetLatest(context, targetPath);
 }
コード例 #31
0
 public override void GetLatest(SourceControlContext context, string targetPath)
 {
     this.EnsureLocalWorkspace(context);
     this.UpdateLocalWorkspace(context);
     this.ExportFiles(context, targetPath);
 }
コード例 #32
0
 public override void ApplyLabel(string label, SourceControlContext context)
 {
     this.WrappedProvider.ApplyLabel(label, context);
 }
コード例 #33
0
 string ILocalWorkspaceProvider.GetWorkspaceDiskPath(SourceControlContext context) => this.GetWorkspaceDiskPathInternal(context);
コード例 #34
0
 public string GetWorkspaceDiskPath(SourceControlContext context)
 {
     return context.WorkspaceDiskPath;
 }
コード例 #35
0
 void ILocalWorkspaceProvider.ExportFiles(SourceControlContext context, string targetDirectory) => this.ExportFilesInternal(context, targetDirectory);
コード例 #36
0
        public void UpdateLocalWorkspace(SourceControlContext context)
        {
            using (var tfs = this.GetTeamProjectCollection())
            {
                var versionControlServer = tfs.GetService<VersionControlServer>();

                var workspace = this.GetMappedWorkspace(versionControlServer, (TfsSourceControlContext)context);
                if (context.Label != null)
                {
                    string sourcePath = ((TfsSourceControlContext)context).SourcePath;
                    var getRequest = new GetRequest(new ItemSpec(sourcePath, RecursionType.Full), VersionSpec.ParseSingleSpec("L" + context.Label, versionControlServer.AuthorizedUser));
                    workspace.Get(getRequest, GetOptions.Overwrite);
                }
                else
                {
                    workspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
                }
            }
        }
コード例 #37
0
 public void ExportFiles(SourceControlContext context, string targetDirectory)
 {
     this.CopyFolder(context.WorkspaceDiskPath, targetDirectory, false);
 }
コード例 #38
0
 void ILocalWorkspaceProvider.UpdateLocalWorkspace(SourceControlContext context) => this.UpdateLocalWorkspaceInternal(context);
コード例 #39
0
 public override IEnumerable <string> EnumerateLabels(SourceControlContext context)
 {
     throw new NotImplementedException();
 }
コード例 #40
0
 void ILocalWorkspaceProvider.DeleteWorkspace(SourceControlContext context) => this.DeleteWorkspaceInternal(context);
コード例 #41
0
 public void DeleteWorkspace(SourceControlContext context)
 {
     DirectoryEx.Clear(context.WorkspaceDiskPath);
 }
コード例 #42
0
 public void EnsureLocalWorkspace(SourceControlContext context)
 {
     this.LogDebug("Ensuring local workspace disk path: " + context.WorkspaceDiskPath);
     if (!Directory.Exists(context.WorkspaceDiskPath))
     {
         this.LogDebug("Creating workspace disk path...");
         Directory.CreateDirectory(context.WorkspaceDiskPath);
     }
     else
     {
         this.LogDebug("Workspace disk path exists.");
     }
 }
コード例 #43
0
 public override IEnumerable<string> EnumerateLabels(SourceControlContext context)
 {
     return this.WrappedProvider.EnumerateLabels(context);
 }
コード例 #44
0
 public override void ExportFiles(SourceControlContext context, string targetDirectory)
 {
     throw new NotImplementedException();
 }
コード例 #45
0
 public string GetWorkspaceDiskPath(SourceControlContext context)
 {
     return(context.WorkspaceDiskPath);
 }
コード例 #46
0
 public override void ExportFiles(SourceControlContext context, string targetDirectory)
 {
     this.WrappedProvider.ExportFiles(context, targetDirectory);
 }
コード例 #47
0
 public override void DeleteWorkspace(SourceControlContext context)
 {
     this.WrappedProvider.DeleteWorkspace(context);
 }
コード例 #48
0
 public override void DeleteWorkspace(SourceControlContext context)
 {
     this.Agent.ClearDirectory(context.WorkspaceDiskPath);
 }
コード例 #49
0
 public override void EnsureLocalWorkspace(SourceControlContext context)
 {
     this.WrappedProvider.EnsureLocalRepository(context);
 }
コード例 #50
0
 private void Clone(SourceControlContext context)
 {
     this.ExecuteHgCommand(context.Repository, "clone", "\"" + context.Repository.RemoteUrl + "\"", ".");
 }
コード例 #51
0
        public void UpdateLocalWorkspace(SourceControlContext context)
        {
            using (var tfs = this.GetTeamProjectCollection())
            {
                var versionControlServer = tfs.GetService<VersionControlServer>();

                var workspace = this.GetMappedWorkspace(versionControlServer, (TfsSourceControlContext)context);
                if (context.Label != null)
                    workspace.Get(VersionSpec.ParseSingleSpec("L" + context.Label, versionControlServer.AuthorizedUser), GetOptions.Overwrite);
                else
                    workspace.Get(VersionSpec.Latest, GetOptions.Overwrite);
            }
        }