public int Checkin(string head, string parent, TfsChangesetInfo parentChangeset, CheckinOptions options, string sourceTfsPath = null) { var changeset = 0; WithWorkspace(parentChangeset, workspace => changeset = Checkin(head, parent, workspace, options, sourceTfsPath)); return(changeset); }
public int CheckinTool(string head, TfsChangesetInfo parentChangeset) { var changeset = 0; WithWorkspace(parentChangeset, workspace => changeset = CheckinTool(head, parentChangeset, workspace)); return(changeset); }
private string GetRemoteId(TfsChangesetInfo changeset) { if (IsAvailable(GitTfsConstants.DefaultRepositoryId)) { Trace.TraceInformation("info: '" + changeset.Remote.TfsRepositoryPath + "' will be bootstraped as your main remote..."); return(GitTfsConstants.DefaultRepositoryId); } //Remove '$/'! var expectedRemoteId = changeset.Remote.TfsRepositoryPath.Substring(2).Trim('/'); var indexOfSlash = expectedRemoteId.IndexOf('/'); if (indexOfSlash != 0) { expectedRemoteId = expectedRemoteId.Substring(indexOfSlash + 1); } var remoteId = expectedRemoteId.ToGitRefName(); var suffix = 0; while (!IsAvailable(remoteId)) { remoteId = expectedRemoteId + "-" + (suffix++); } return(remoteId); }
public IGitTfsRemote CreateRemote(TfsChangesetInfo changeset) { IGitTfsRemote remote; if (changeset.Remote.IsDerived) { var remoteId = GetRemoteId(changeset); remote = _globals.Repository.CreateTfsRemote(new RemoteInfo { Id = remoteId, Url = changeset.Remote.TfsUrl, Repository = changeset.Remote.TfsRepositoryPath, RemoteOptions = _remoteOptions, }); remote.UpdateTfsHead(changeset.GitCommit, changeset.ChangesetId); Trace.TraceInformation("-> new remote '" + remote.Id + "'"); } else { remote = changeset.Remote; if (changeset.Remote.MaxChangesetId < changeset.ChangesetId) { int oldChangeset = changeset.Remote.MaxChangesetId; _globals.Repository.MoveTfsRefForwardIfNeeded(changeset.Remote); Trace.TraceInformation("-> existing remote {0} (updated from changeset {1})", changeset.Remote.Id, oldChangeset); } else { Trace.TraceInformation("-> existing remote {0} (up to date)", changeset.Remote.Id); } } return(remote); }
public TfsChangeset(ITfsHelper tfs, IChangeset changeset, TfsChangesetInfo tfsChangesetInfo, AuthorsFile authors) { _tfs = tfs; _changeset = changeset; _authors = authors; Summary = tfsChangesetInfo; BaseChangesetId = _changeset.Changes.Max(c => c.Item.ChangesetId) - 1; }
public TfsWorkspace(IWorkspace workspace, string localDirectory, TfsChangesetInfo contextVersion, IGitTfsRemote remote, CheckinOptions checkinOptions, ITfsHelper tfsHelper, CheckinPolicyEvaluator policyEvaluator) { _workspace = workspace; _policyEvaluator = policyEvaluator; _contextVersion = contextVersion; _checkinOptions = checkinOptions; _tfsHelper = tfsHelper; _localDirectory = remote.Repository.IsBare ? Path.GetFullPath(localDirectory) : localDirectory; Remote = remote; }
private void WithWorkspace(TfsChangesetInfo parentChangeset, Action <ITfsWorkspace> action) { //are there any subtrees? var subtrees = _globals.Repository.GetSubtrees(this); if (subtrees.Any()) { Tfs.WithWorkspace(WorkingDirectory, this, subtrees.Select(x => new Tuple <string, string>(x.TfsRepositoryPath, x.Prefix)), parentChangeset, action); } else { Tfs.WithWorkspace(WorkingDirectory, this, parentChangeset, action); } }
public IPendingSet[] QueryPendingSets(TfsChangesetInfo parentChangeset, string[] items, TfsRecursionType recursionType, string queryWorkspace, string queryUser) { IPendingSet[] ret = null; WithWorkspace(parentChangeset, workspace => { var workspaceItems = items .Select(x => workspace.GetLocalPath(x)) .ToArray(); ret = Tfs.QueryPendingSets(workspaceItems, recursionType, queryWorkspace, queryUser); }); return(ret); }
public int Checkin(string head, string parent, TfsChangesetInfo parentChangeset, CheckinOptions options, string sourceTfsPath = null) { throw DerivedRemoteException; }
public int CheckinTool(string head, TfsChangesetInfo parentChangeset) { throw DerivedRemoteException; }
public void Shelve(string shelvesetName, string treeish, TfsChangesetInfo parentChangeset, CheckinOptions options, bool evaluateCheckinPolicies) { throw DerivedRemoteException; }
private int CheckinTool(string head, TfsChangesetInfo parentChangeset, ITfsWorkspace workspace) { PendChangesToWorkspace(head, parentChangeset.GitCommit, workspace); return(workspace.CheckinTool(() => Repository.GetCommitMessage(head, parentChangeset.GitCommit))); }
private void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, CheckinOptions options, bool evaluateCheckinPolicies, ITfsWorkspace workspace) { PendChangesToWorkspace(head, parentChangeset.GitCommit, workspace); workspace.Shelve(shelvesetName, evaluateCheckinPolicies, options, () => Repository.GetCommitMessage(head, parentChangeset.GitCommit)); }
public void Shelve(string shelvesetName, string head, TfsChangesetInfo parentChangeset, CheckinOptions options, bool evaluateCheckinPolicies) { WithWorkspace(parentChangeset, workspace => Shelve(shelvesetName, head, parentChangeset, options, evaluateCheckinPolicies, workspace)); }
public IPendingSet[] QueryPendingSets(TfsChangesetInfo parentChangeset, string[] items, TfsRecursionType recursionType, string queryWorkspace, string queryUser) { throw DerivedRemoteException; }