Stop using property InitialChangeset for branch information.
The global property `InitialChangeset` is used to store the first changeset the user want to clone from. But this was also in some situations used to store the first changeset of a branch. This cause a problem as this property is global and will be applied to all branches. If `InitialChangeset` is set for a branch, the next cloned branch can not get the changesets before the changeset given this `InitialChangeset` if it is not updated for that branch to. It is problematic to use a property for different information.
This commit is contained in:
committed by
Philippe Miossec
parent
c9df412e7f
commit
1e043a0c7a
@@ -4,4 +4,6 @@
|
||||
* Add .net462 and windows10 long path support. See [doc to enable it](../blob/master/doc/Set-custom-workspace.md). (#1221 by @pmiossec)
|
||||
* Fix bug where checkin attempts to remove a non-empty directory. (#1249 by @m-akinc)
|
||||
* Line endings are now properly normalized when pushing changes to TFS if core.autocrlf is set to true (#1210 by @JeffCyr)
|
||||
* Fix merge commits connecting to wrong parent
|
||||
* Fix merge commits connecting to wrong parent (#1264 by DotNetSparky)
|
||||
* Now possible to clone a deleted branch (#1263 by magol)
|
||||
* Fix a issue that commits in a branch are lost if they are older then the first commit in a branch that are merging from this branch. (#1263 by magol)
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace GitTfs.Commands
|
||||
// If this branch's branch point is past the first commit, indicate this so Fetch can start from that point
|
||||
if (rootBranch.TargetBranchChangesetId > -1)
|
||||
{
|
||||
branchTfsRemote.SetInitialChangeset(rootBranch.TargetBranchChangesetId);
|
||||
branchTfsRemote.SetFirstChangeset(rootBranch.TargetBranchChangesetId);
|
||||
}
|
||||
|
||||
if (rootBranch.IsRenamedBranch || !NoFetch)
|
||||
|
||||
@@ -190,12 +190,12 @@ namespace GitTfs.Core
|
||||
public bool ExportMetadatas { get; set; }
|
||||
public Dictionary<string, IExportWorkItem> ExportWorkitemsMapping { get; set; }
|
||||
|
||||
public int? GetInitialChangeset()
|
||||
public int? GetFirstChangeset()
|
||||
{
|
||||
throw DerivedRemoteException;
|
||||
}
|
||||
|
||||
public void SetInitialChangeset(int? changesetId)
|
||||
public void SetFirstChangeset(int? changesetId)
|
||||
{
|
||||
throw DerivedRemoteException;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace GitTfs.Core
|
||||
private readonly Globals _globals;
|
||||
private readonly RemoteOptions _remoteOptions;
|
||||
private readonly ConfigProperties _properties;
|
||||
private int? firstChangesetId;
|
||||
private int? maxChangesetId;
|
||||
private string maxCommitHash;
|
||||
private bool isTfsAuthenticated;
|
||||
@@ -73,14 +74,15 @@ namespace GitTfs.Core
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public int? GetInitialChangeset()
|
||||
public int? GetFirstChangeset()
|
||||
{
|
||||
return _properties.InitialChangeset;
|
||||
return firstChangesetId;
|
||||
}
|
||||
|
||||
public void SetInitialChangeset(int? changesetId)
|
||||
public void SetFirstChangeset(int? changesetId)
|
||||
{
|
||||
_properties.InitialChangeset = changesetId;
|
||||
Trace.WriteLine($"Set first changeset in branch to C{changesetId}");
|
||||
firstChangesetId = changesetId;
|
||||
}
|
||||
|
||||
public bool IsSubtree { get; private set; }
|
||||
@@ -745,8 +747,11 @@ namespace GitTfs.Core
|
||||
// only the folder creation and deletion operations due to the lowerBound being
|
||||
// detected as the root-side of the commit +1 (C1+1=C2) instead of referencing
|
||||
// the branch-side of the branching operation [C4].
|
||||
if (_properties.InitialChangeset.HasValue)
|
||||
lowerBoundChangesetId = Math.Max(MaxChangesetId + 1, _properties.InitialChangeset.Value);
|
||||
if (_properties.InitialChangeset.HasValue || firstChangesetId.HasValue)
|
||||
{
|
||||
var firstChangesetInBranch = Math.Max(_properties.InitialChangeset ?? int.MinValue, firstChangesetId ?? int.MinValue);
|
||||
lowerBoundChangesetId = Math.Max(MaxChangesetId + 1, firstChangesetInBranch);
|
||||
}
|
||||
else
|
||||
lowerBoundChangesetId = MaxChangesetId + 1;
|
||||
Trace.WriteLine(RemoteRef + ": Getting changesets from " + lowerBoundChangesetId +
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace GitTfs.Core
|
||||
string Prefix { get; }
|
||||
bool ExportMetadatas { get; set; }
|
||||
Dictionary<string, IExportWorkItem> ExportWorkitemsMapping { get; set; }
|
||||
int? GetInitialChangeset();
|
||||
void SetInitialChangeset(int? changesetId);
|
||||
int? GetFirstChangeset();
|
||||
void SetFirstChangeset(int? changesetId);
|
||||
bool ShouldSkip(string path);
|
||||
IGitTfsRemote InitBranch(RemoteOptions remoteOptions, string tfsRepositoryPath, int rootChangesetId = -1, bool fetchParentBranch = false, string gitBranchNameExpected = null, IRenameResult renameResult = null);
|
||||
string GetPathInGitRepo(string tfsPath);
|
||||
|
||||
Reference in New Issue
Block a user