Exemplo n.º 1
0
 static IList<TrackItem> CalcTrackItems(TrackBranch branch, IEnumerable<TrackItem> trackItems, DXVcsWrapper vcsWrapper)
 {
     List<TrackItem> list = new List<TrackItem>();
     foreach (var trackItem in trackItems) {
         list.AddRange(vcsWrapper.GenerateTrackItems(branch, trackItem));
     }
     return list;
 }
Exemplo n.º 2
0
        public void GenerateTestConfig()
        {
            List<TrackItem> items = new List<TrackItem>();
            items.Add(new TrackItem() { Path = @"$/Sandbox/litvinov/XPF/DevExpress.Xpf.Core", ProjectPath = "DevExpress.Xpf.Core" });
            TrackBranch branch = new TrackBranch("2015.2", "$/Sandbox/litvinov/XPF/track2015.2.config", "$/Sandbox/litvinov/XPF", items);

            SharpSerializerXmlSettings settings = new SharpSerializerXmlSettings();
            settings.IncludeAssemblyVersionInTypeName = false;
            settings.IncludePublicKeyTokenInTypeName = false;
            SharpSerializer serializer = new SharpSerializer(settings);
            serializer.Serialize(new List<TrackBranch>() { branch }, @"c:\1\trackconfig_testxpf.config");
        }
Exemplo n.º 3
0
 public IList<HistoryItem> GenerateHistory(TrackBranch branch, DateTime from)
 {
     try {
         var repo = DXVcsConnectionHelper.Connect(server, user, password);
         var history = Enumerable.Empty<HistoryItem>();
         foreach (var trackItem in branch.TrackItems) {
             string trackPath = branch.GetTrackRoot(trackItem);
             var historyForItem = repo.GetProjectHistory(trackPath, true, from).Select(x =>
                 new HistoryItem() {
                     ActionDate = x.ActionDate,
                     Comment = x.Comment,
                     Label = x.Label,
                     Message = x.Message,
                     Name = x.Name,
                     User = x.User,
                     Track = trackItem,
                 });
             history = history.Concat(historyForItem);
         }
         return history.ToList();
     }
     catch (Exception ex) {
         Log.Error("History generation failed.", ex);
         throw;
     }
 }
Exemplo n.º 4
0
        static void ProcessHistoryInternal(DXVcsWrapper vcsWrapper, GitWrapper gitWrapper, RegisteredUsers users, User defaultUser, string localGitDir, TrackBranch branch, IList<CommitItem> commits, SyncHistoryWrapper syncHistory) {
            ProjectExtractor extractor = new ProjectExtractor(commits, (item) => {
                var localCommits = vcsWrapper.GetCommits(item.TimeStamp, item.Items).Where(x => !IsLabel(x)).ToList();
                bool hasModifications = false;
                GitCommit last = null;
                string token = syncHistory.CreateNewToken();
                foreach (var localCommit in localCommits) {
                    string localProjectPath = Path.Combine(localGitDir, localCommit.Track.ProjectPath);
                    DirectoryHelper.DeleteDirectory(localProjectPath);
                    string trackPath = branch.GetTrackRoot(localCommit.Track);
                    vcsWrapper.GetProject(vcsServer, trackPath, localProjectPath, item.TimeStamp);

                    Log.Message($"git stage {localCommit.Track.ProjectPath}");
                    gitWrapper.Stage(localCommit.Track.ProjectPath);
                    string author = CalcAuthor(localCommit, defaultUser);
                    var comment = CalcComment(localCommit, author, token);
                    User user = users.GetUser(author);
                    try {
                        gitWrapper.Commit(comment.ToString(), user, localCommit.TimeStamp, false);
                        last = gitWrapper.FindCommit(x => true);
                        hasModifications = true;
                    }
                    catch (Exception) {
                        Log.Message($"Empty commit detected for {localCommit.Author} {localCommit.TimeStamp}.");
                    }
                }
                if (hasModifications) {
                    gitWrapper.PushEverything();
                    syncHistory.Add(last.Sha, item.TimeStamp.Ticks, token);
                }
                else {
                    var head = syncHistory.GetHead();
                    syncHistory.Add(head.GitCommitSha, item.TimeStamp.Ticks, token);
                    string author = CalcAuthor(item, defaultUser);
                    Log.Message($"Push empty commits rejected for {author} {item.TimeStamp}.");
                }
                syncHistory.Save();
            });
            int i = 0;
            while (extractor.PerformExtraction())
                Log.Message($"{++i} from {commits.Count} push to branch {branch.Name} completed.");
        }
Exemplo n.º 5
0
        static ProcessHistoryResult ProcessHistory(DXVcsWrapper vcsWrapper, GitWrapper gitWrapper, RegisteredUsers users, User defaultUser, string gitRepoPath, string localGitDir, TrackBranch branch, int commitsCount, SyncHistoryWrapper syncHistory, bool mergeCommits) {
            IList<CommitItem> commits = GenerateCommits(vcsWrapper, branch, syncHistory, mergeCommits);

            if (commits.Count > commitsCount) {
                Log.Message($"Commits generated. First {commitsCount} of {commits.Count} commits taken.");
                commits = commits.Take(commitsCount).ToList();
            }
            else {
                Log.Message($"Commits generated. {commits.Count} commits taken.");
            }
            if (commits.Count > 0)
                ProcessHistoryInternal(vcsWrapper, gitWrapper, users, defaultUser, localGitDir, branch, commits, syncHistory);
            Log.Message($"Importing history from vcs completed.");

            return commits.Count > commitsCount ? ProcessHistoryResult.NotEnough : ProcessHistoryResult.Success;
        }
Exemplo n.º 6
0
 static string CalcLocalPath(string localGitDir, TrackBranch branch, string path) {
     return Path.Combine(localGitDir, path);
 }
Exemplo n.º 7
0
        static MergeRequestResult ProcessOpenedMergeRequest(DXVcsWrapper vcsWrapper, GitWrapper gitWrapper, GitLabWrapper gitLabWrapper, RegisteredUsers users, User defaultUser, string localGitDir, TrackBranch branch, MergeRequest mergeRequest, SyncHistoryWrapper syncHistory) {
            string autoSyncToken = syncHistory.CreateNewToken();
            var lastHistoryItem = syncHistory.GetHead();

            Log.Message($"Start merging mergerequest {mergeRequest.Title}");

            Log.ResetErrorsAccumulator();
            var changes = gitLabWrapper.GetMergeRequestChanges(mergeRequest).ToList();
            if (changes.Count >= MaxChangesCount) {
                Log.Error($"Merge request contains more than {MaxChangesCount} changes and cannot be processed. Split it into smaller merge requests");
                AssignBackConflictedMergeRequest(gitLabWrapper, users, mergeRequest, CalcCommentForFailedCheckoutMergeRequest(null));
                return MergeRequestResult.Failed;
            }
            var genericChange = changes
                .Where(x => branch.TrackItems.FirstOrDefault(track => CheckItemForChangeSet(x, track)) != null)
                .Select(x => ProcessMergeRequestChanges(mergeRequest, x, localGitDir, branch, autoSyncToken)).ToList();
            bool ignoreValidation = gitLabWrapper.ShouldIgnoreSharedFiles(mergeRequest);

            if (!ValidateMergeRequestChanges(gitLabWrapper, mergeRequest, ignoreValidation) || !vcsWrapper.ProcessCheckout(genericChange, ignoreValidation, branch)) {
                Log.Error("Merging merge request failed because failed validation.");
                AssignBackConflictedMergeRequest(gitLabWrapper, users, mergeRequest, CalcCommentForFailedCheckoutMergeRequest(genericChange));
                vcsWrapper.ProcessUndoCheckout(genericChange);
                return MergeRequestResult.CheckoutFailed;
            }
            CommentWrapper comment = CalcComment(mergeRequest, branch, autoSyncToken);
            mergeRequest = gitLabWrapper.ProcessMergeRequest(mergeRequest, comment.ToString());
            if (mergeRequest.State == "merged") {
                Log.Message("Merge request merged successfully.");

                gitWrapper.Pull();
                gitWrapper.LFSPull();

                var gitCommit = gitWrapper.FindCommit(x => CommentWrapper.Parse(x.Message).Token == autoSyncToken);
                long timeStamp = lastHistoryItem.VcsCommitTimeStamp;

                if (gitCommit != null && vcsWrapper.ProcessCheckIn(genericChange, comment.ToString())) {
                    var checkinHistory = vcsWrapper.GenerateHistory(branch, new DateTime(timeStamp)).Where(x => x.ActionDate.Ticks > timeStamp);
                    var lastCommit = checkinHistory.OrderBy(x => x.ActionDate).LastOrDefault();
                    long newTimeStamp = lastCommit?.ActionDate.Ticks ?? timeStamp;
                    var mergeRequestResult = MergeRequestResult.Success;
                    if (!ValidateMergeRequest(vcsWrapper, branch, lastHistoryItem, defaultUser))
                        mergeRequestResult = MergeRequestResult.Mixed;
                    if (!ValidateChangeSet(genericChange))
                        mergeRequestResult = MergeRequestResult.Mixed;
                    syncHistory.Add(gitCommit.Sha, newTimeStamp, autoSyncToken, mergeRequestResult == MergeRequestResult.Success ? SyncHistoryStatus.Success : SyncHistoryStatus.Mixed);
                    syncHistory.Save();
                    Log.Message("Merge request checkin successfully.");
                    return mergeRequestResult;
                }
                Log.Error("Merge request checkin failed.");
                if (gitCommit == null)
                    Log.Error($"Can`t find git commit with token {autoSyncToken}");
                var failedHistory = vcsWrapper.GenerateHistory(branch, new DateTime(timeStamp));
                var lastFailedCommit = failedHistory.OrderBy(x => x.ActionDate).LastOrDefault();
                syncHistory.Add(gitCommit.Sha, lastFailedCommit?.ActionDate.Ticks ?? timeStamp, autoSyncToken, SyncHistoryStatus.Failed);
                syncHistory.Save();
                return MergeRequestResult.Failed;
            }
            Log.Message($"Merge request merging failed due conflicts. Resolve conflicts manually.");
            vcsWrapper.ProcessUndoCheckout(genericChange);
            AssignBackConflictedMergeRequest(gitLabWrapper, users, mergeRequest, CalcCommentForFailedCheckoutMergeRequest(genericChange));

            return MergeRequestResult.Conflicts;
        }
Exemplo n.º 8
0
 static bool ValidateMergeRequest(DXVcsWrapper vcsWrapper, TrackBranch branch, SyncHistoryItem previous, User defaultUser) {
     var history = vcsWrapper.GenerateHistory(branch, new DateTime(previous.VcsCommitTimeStamp)).Where(x => x.ActionDate.Ticks > previous.VcsCommitTimeStamp);
     if (history.Any(x => x.User != defaultUser.UserName))
         return false;
     return true;
 }
Exemplo n.º 9
0
 TestFileResult ProcessBeforeCheckout(SyncItem item, bool ignoreSharedFiles, TrackBranch branch)
 {
     TestFileResult result;
     switch (item.SyncAction) {
         case SyncAction.New:
             result = BeforeCheckOutCreateFile(item.VcsPath, item.LocalPath, ignoreSharedFiles, branch);
             break;
         case SyncAction.Modify:
             result = BeforeCheckOutModifyFile(item.VcsPath, item.LocalPath, ignoreSharedFiles, item.SingleSharedFile, branch);
             break;
         case SyncAction.Delete:
             result = BeforeCheckOutDeleteFile(item.VcsPath, item.LocalPath, ignoreSharedFiles, branch);
             break;
         case SyncAction.Move:
             SyncAction newAction = SyncAction.Move;
             result = BeforeCheckOutMoveFile(item.VcsPath, item.NewVcsPath, item.LocalPath, item.NewLocalPath, ignoreSharedFiles, branch, ref newAction);
             item.SyncAction = newAction;
             break;
         default:
             throw new ArgumentException("SyncAction");
     }
     return result;
 }
Exemplo n.º 10
0
        TestFileResult BeforeCheckOutMoveFile(string vcsPath, string newVcsPath, string localPath, string newLocalPath, bool ignoreSharedFiles, TrackBranch branch, ref SyncAction newAction)
        {
            bool isOldPathTracking = branch.IsTrackingVcsPath(vcsPath);
            bool isNewPathTracking = branch.IsTrackingVcsPath(newVcsPath);

            if (isOldPathTracking && !PerformHasFileTestBeforeCheckout(vcsPath)) {
                Log.Error($"Check move capability. Source file {vcsPath} is not found in vcs.");
                return TestFileResult.Fail;
            }
            if (isNewPathTracking && PerformHasFileTestBeforeCheckout(newVcsPath)) {
                Log.Error($"Check move capability. Target file {newVcsPath} is found in vcs.");
                return TestFileResult.Fail;
            }

            if(!isNewPathTracking && !isOldPathTracking)
                return TestFileResult.Ignore;
            if(isNewPathTracking && !isOldPathTracking) {
                newAction = SyncAction.New;
                return BeforeCheckOutCreateFile(newVcsPath, localPath, ignoreSharedFiles, branch);
            }
            else if(!isNewPathTracking && isOldPathTracking) {
                newAction = SyncAction.Delete;
                return BeforeCheckOutDeleteFile(vcsPath, localPath, ignoreSharedFiles, branch);
            }

            var oldPathResult = PerformSimpleTestBeforeCheckout(vcsPath, ignoreSharedFiles, false, false);
            if (oldPathResult != TestFileResult.Ok)
                return oldPathResult;
            return PerformSimpleTestBeforeCheckout(newVcsPath, ignoreSharedFiles, false, false);
        }
Exemplo n.º 11
0
 TestFileResult BeforeCheckOutModifyFile(string vcsPath, string localPath, bool ignoreSharedFiles, bool singleSharedFile, TrackBranch branch)
 {
     if(!branch.IsTrackingVcsPath(vcsPath))
         return TestFileResult.Ignore;
     if (!PerformHasFileTestBeforeCheckout(vcsPath)) {
         Log.Error($"Check modify capability. File {vcsPath} is not found in vcs.");
         return TestFileResult.Fail;
     }
     return PerformSimpleTestBeforeCheckout(vcsPath, ignoreSharedFiles, singleSharedFile, true);
 }
Exemplo n.º 12
0
 TestFileResult BeforeCheckOutDeleteFile(string vcsPath, string localPath, bool ignoreSharedFiles, TrackBranch branch)
 {
     if(!branch.IsTrackingVcsPath(vcsPath))
         return TestFileResult.Ignore;
     return PerformSimpleTestBeforeCheckout(vcsPath, ignoreSharedFiles, false, false);
 }
Exemplo n.º 13
0
        public bool ProcessCheckout(IEnumerable<SyncItem> items, bool ignoreSharedFiles, TrackBranch branch)
        {
            var list = items.ToList();
            var sharedFiles = list.Where(item => IsSharedFile(item.VcsPath)).ToList();
            sharedFiles.ForEach(x => CheckIsSingleSharedFile(list, x));

            list.ForEach(x => {
                TestFileResult result = ProcessBeforeCheckout(x, ignoreSharedFiles, branch);
                x.State = CalcBeforeCheckoutState(result);
            });

            if (list.Any(x => x.State == ProcessState.Failed))
                return false;

            list.ForEach(x => {
                TestFileResult result = ProcessCheckoutItem(x, x.Comment.ToString());
                x.State = CalcCheckoutStateAfterCheckout(result);
            });
            return list.All(x => x.State == ProcessState.Modified || x.State == ProcessState.Ignored);
        }
Exemplo n.º 14
0
        public IList<TrackItem> GenerateTrackItems(TrackBranch trackBranch, TrackItem trackItem)
        {
            if (!trackItem.GoDeeper)
                return new List<TrackItem>() {trackItem};
            try {
                var repo = DXVcsConnectionHelper.Connect(server, user, password);
                string trackRoot = trackBranch.GetTrackRoot(trackItem);
                var projectData = repo.GetProjectData(trackRoot);
                if (projectData.IsNull || projectData.SubProjectsCount == 0)
                    return new List<TrackItem>() {trackItem};
                var innerProjects = repo.GetProjects(trackRoot);
                if (innerProjects == null || innerProjects.Length == 0)
                    return new List<TrackItem>() { trackItem };

                List<TrackItem> result = new List<TrackItem>(innerProjects.Length);
                foreach (var info in innerProjects) {
                    var newTrackItem = new TrackItem();
                    newTrackItem.Branch = trackBranch.Name;
                    newTrackItem.GoDeeper = false;
                    newTrackItem.Path = trackItem.Path + @"/" + info.Name;
                    newTrackItem.ProjectPath = Path.Combine(trackItem.ProjectPath, info.Name).Replace(@"\", @"/");
                    newTrackItem.AdditionalOffset = trackItem.AdditionalOffset;
                    result.Add(newTrackItem);
                }
                return result;
            }
            catch(Exception ex)  {
                Log.Error("Generating trackitems from config failed", ex);
                throw ex;
            }
        }
Exemplo n.º 15
0
 static CommentWrapper CalcComment(MergeRequest mergeRequest, TrackBranch branch, string autoSyncToken) {
     CommentWrapper comment = new CommentWrapper();
     comment.Author = mergeRequest.Author.Username;
     comment.Branch = branch.Name;
     comment.Token = autoSyncToken;
     comment.Comment = CalcCommentForMergeRequest(mergeRequest);
     return comment;
 }
Exemplo n.º 16
0
        static CheckMergeChangesResult CheckChangesForMerging(GitLabWrapper gitLabWrapper, string gitRepoPath, string branchName, SyncHistoryItem head, DXVcsWrapper vcsWrapper, TrackBranch branch, SyncHistoryWrapper syncHistory, User defaultUser) {
            var project = gitLabWrapper.FindProject(gitRepoPath);
            if (project == null) {
                Log.Error($"Can`t find git project {gitRepoPath}");
                return CheckMergeChangesResult.Error;
            }

            var gitlabBranch = gitLabWrapper.GetBranches(project).Single(x => x.Name == branchName);
            if (gitlabBranch.Commit.Id.Equals(new Sha1(head.GitCommitSha))) {
                var commits = GenerateCommits(vcsWrapper, branch, syncHistory, false);
                if (commits.Count == 0) {
                    var mergeRequests = GetMergeRequests(gitLabWrapper, branchName, defaultUser.UserName, project);
                    if (!mergeRequests.Any()) {
                        Log.Message("Zero registered merge requests.");
                        return CheckMergeChangesResult.NoChanges;
                    }
                }
            }
            return CheckMergeChangesResult.HasChanges;
        }
Exemplo n.º 17
0
        void GenerateAspConfig(string branchName)
        {
            List<TrackItem> items = new List<TrackItem>();
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/ASPxThemeBuilder", ProjectPath = "ASPxThemeBuilder" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/ASPxThemeDeployer", ProjectPath = "ASPxThemeDeployer" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web", ProjectPath = "DevExpress.Web" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.ASPxHtmlEditor", ProjectPath = "DevExpress.Web.ASPxHtmlEditor" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.ASPxRichEdit", ProjectPath = "DevExpress.Web.ASPxRichEdit" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.ASPxRichEdit.Tests", ProjectPath = "DevExpress.Web.ASPxRichEdit.Tests" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.ASPxScheduler", ProjectPath = "DevExpress.Web.ASPxScheduler" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.ASPxSpellChecker", ProjectPath = "DevExpress.Web.ASPxSpellChecker" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.ASPxSpreadsheet", ProjectPath = "DevExpress.Web.ASPxSpreadsheet" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.ASPxThemes", ProjectPath = "DevExpress.Web.ASPxThemes" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.ASPxTreeList", ProjectPath = "DevExpress.Web.ASPxTreeList" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.Design", ProjectPath = "DevExpress.Web.Design" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.Mvc", ProjectPath = "DevExpress.Web.Mvc" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/ASP/DevExpress.Web.Projects", ProjectPath = "DevExpress.Web.Projects" });

            TrackBranch branch = new TrackBranch($"{branchName}", $@"$/{branchName}/Diagram/xpf_common_sync.config", $@"$/{branchName}", items);

            SharpSerializerXmlSettings settings = new SharpSerializerXmlSettings();
            settings.IncludeAssemblyVersionInTypeName = false;
            settings.IncludePublicKeyTokenInTypeName = false;
            SharpSerializer serializer = new SharpSerializer(settings);
            serializer.Serialize(new List<TrackBranch>() { branch }, $@"z:\trackconfig_asp_{branchName}.config");
        }
Exemplo n.º 18
0
 static MergeRequestResult ProcessMergeRequest(DXVcsWrapper vcsWrapper, GitWrapper gitWrapper, GitLabWrapper gitLabWrapper, RegisteredUsers users, User defaultUser, string localGitDir, TrackBranch branch, MergeRequest mergeRequest, SyncHistoryWrapper syncHistory) {
     switch (mergeRequest.State) {
         case "reopened":
         case "opened":
             return ProcessOpenedMergeRequest(vcsWrapper, gitWrapper, gitLabWrapper, users, defaultUser, localGitDir, branch, mergeRequest, syncHistory);
     }
     return MergeRequestResult.InvalidState;
 }
Exemplo n.º 19
0
        void GenerateDataAccessConfig(string branchName)
        {
            List<TrackItem> items = new List<TrackItem>();
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Win/DevExpress.DataAccess", ProjectPath = "DevExpress.DataAccess", AdditionalOffset = "Win" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/BigQueryTests", ProjectPath = "BigQueryTests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/DataAccessTests", ProjectPath = "DataAccessTests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/EntityFramework7Tests", ProjectPath = "EntityFramework7Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/MsSqlCEEF7Tests", ProjectPath = "MsSqlCEEF7Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/MsSqlEF5Tests", ProjectPath = "MsSqlEF5Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/MsSqlEF6Tests", ProjectPath = "MsSqlEF6Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/MsSqlEF7Tests", ProjectPath = "MsSqlEF7Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/MySqlEF6Tests", ProjectPath = "MySqlEF6Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/PostgreSqlEF7Tests", ProjectPath = "PostgreSqlEF7Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/PostgreSqlEF7Tests", ProjectPath = "PostgreSqlEF7Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/SqliteEF7Tests", ProjectPath = "SqliteEF7Tests", AdditionalOffset = "Tests.DataAccess" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Tests.DataAccess/WizardTests", ProjectPath = "WizardTests", AdditionalOffset = "Tests.DataAccess" });
            TrackBranch branch = new TrackBranch($"{branchName}", $@"$/{branchName}/DataAccess/sync.config", $@"$/{branchName}", items);

            SharpSerializerXmlSettings settings = new SharpSerializerXmlSettings();
            settings.IncludeAssemblyVersionInTypeName = false;
            settings.IncludePublicKeyTokenInTypeName = false;
            SharpSerializer serializer = new SharpSerializer(settings);
            serializer.Serialize(new List<TrackBranch>() { branch }, $@"z:\trackconfig_dataaccess_{branchName}.config");
        }
Exemplo n.º 20
0
 static SyncItem ProcessMergeRequestChanges(MergeRequest mergeRequest, MergeRequestFileData fileData, string localGitDir, TrackBranch branch, string token) {
     string vcsRoot = branch.RepoRoot;
     var syncItem = new SyncItem();
     if (fileData.IsNew) {
         syncItem.SyncAction = SyncAction.New;
         syncItem.LocalPath = CalcLocalPath(localGitDir, branch, fileData.OldPath);
         syncItem.VcsPath = CalcVcsPath(branch, fileData.OldPath);
     }
     else if (fileData.IsDeleted) {
         syncItem.SyncAction = SyncAction.Delete;
         syncItem.LocalPath = CalcLocalPath(localGitDir, branch, fileData.OldPath);
         syncItem.VcsPath = CalcVcsPath(branch, fileData.OldPath);
     }
     else if (fileData.IsRenamed) {
         syncItem.SyncAction = SyncAction.Move;
         syncItem.LocalPath = CalcLocalPath(localGitDir, branch, fileData.OldPath);
         syncItem.NewLocalPath = CalcLocalPath(localGitDir, branch, fileData.NewPath);
         syncItem.VcsPath = CalcVcsPath(branch, fileData.OldPath);
         syncItem.NewVcsPath = CalcVcsPath(branch, fileData.NewPath);
     }
     else {
         syncItem.SyncAction = SyncAction.Modify;
         syncItem.LocalPath = CalcLocalPath(localGitDir, branch, fileData.OldPath);
         syncItem.VcsPath = CalcVcsPath(branch, fileData.OldPath);
     }
     syncItem.Comment = CalcComment(mergeRequest, branch, token);
     return syncItem;
 }
Exemplo n.º 21
0
        void GenerateUWPDemoConfig(string branchName)
        {
            List<TrackItem> items = new List<TrackItem>();
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Demos.UWP/DemoLauncher", ProjectPath = "DemoLauncher" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Demos.UWP/DevExpress.PackageRegistrator", ProjectPath = "DevExpress.PackageRegistrator" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Demos.UWP/DXCRM", ProjectPath = "DXCRM" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Demos.UWP/FeatureDemo", ProjectPath = "FeatureDemo" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Demos.UWP/FinanceTracker", ProjectPath = "FinanceTracker" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Demos.UWP/HybridDemo", ProjectPath = "HybridDemo" });
            TrackBranch branch = new TrackBranch($"{branchName}", $@"$/{branchName}/Demos.UWP.GIT/sync.config", $@"$/{branchName}", items);

            SharpSerializerXmlSettings settings = new SharpSerializerXmlSettings();
            settings.IncludeAssemblyVersionInTypeName = false;
            settings.IncludePublicKeyTokenInTypeName = false;
            SharpSerializer serializer = new SharpSerializer(settings);
            serializer.Serialize(new List<TrackBranch>() { branch }, $@"z:\trackconfig_uwp_demos_{branchName}.config");
        }
Exemplo n.º 22
0
 static string CalcVcsPath(TrackBranch branch, string path) {
     var root = path.Split(new[] { @"\", @"/" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
     var trackItem = branch.TrackItems.First(x => root == x.ProjectPath);
     var resultPath = path.Remove(0, trackItem.ProjectPath.Length).TrimStart(@"\/".ToCharArray());
     string trackPath = branch.GetTrackRoot(trackItem);
     return Path.Combine(trackPath, resultPath).Replace("\\", "/");
 }
Exemplo n.º 23
0
        void GenerateWinRTConfig(string branchName)
        {
            List<TrackItem> items = new List<TrackItem>();
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.Core", ProjectPath = "DevExpress.Core" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.Drawing", ProjectPath = "DevExpress.Drawing" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.Pdf.Core", ProjectPath = "DevExpress.Pdf.Core" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.TestFramework", ProjectPath = "DevExpress.TestFramework" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.TestRunner", ProjectPath = "DevExpress.TestRunner" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.TestsKey", ProjectPath = "DevExpress.TestsKey" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.TestUtils", ProjectPath = "DevExpress.TestUtils" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.UI.Xaml", ProjectPath = "DevExpress.UI.Xaml" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.UI.Xaml.Charts", ProjectPath = "DevExpress.UI.Xaml.Charts" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.UI.Xaml.Controls", ProjectPath = "DevExpress.UI.Xaml.Controls" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.UI.Xaml.Editors", ProjectPath = "DevExpress.UI.Xaml.Editors" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.UI.Xaml.Gauges", ProjectPath = "DevExpress.UI.Xaml.Gauges" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.UI.Xaml.Grid", ProjectPath = "DevExpress.UI.Xaml.Grid" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.UI.Xaml.Layout", ProjectPath = "DevExpress.UI.Xaml.Layout" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.UI.Xaml.Map", ProjectPath = "DevExpress.UI.Xaml.Map" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.WinRT.Projects.Installers", ProjectPath = "DevExpress.WinRT.Projects.Installers" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/DevExpress.WinRT.Projects.Wizards", ProjectPath = "DevExpress.WinRT.Projects.Wizards" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/Shared", ProjectPath = "Shared" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/WinRT/Tools", ProjectPath = "Tools" });
            TrackBranch branch = new TrackBranch($"{branchName}", $@"$/{branchName}/UWP.GIT/sync.config", $@"$/{branchName}", items);

            SharpSerializerXmlSettings settings = new SharpSerializerXmlSettings();
            settings.IncludeAssemblyVersionInTypeName = false;
            settings.IncludePublicKeyTokenInTypeName = false;
            SharpSerializer serializer = new SharpSerializer(settings);
            serializer.Serialize(new List<TrackBranch>() { branch }, $@"z:\trackconfig_uwp_{branchName}.config");
        }
Exemplo n.º 24
0
        static IList<CommitItem> GenerateCommits(DXVcsWrapper vcsWrapper, TrackBranch branch, SyncHistoryWrapper syncHistory, bool mergeCommits) {
            DateTime lastCommit = CalcLastCommitDate(syncHistory);
            Log.Message($"Last commit has been performed at {lastCommit.ToLocalTime()}.");

            var history = vcsWrapper.GenerateHistory(branch, lastCommit).OrderBy(x => x.ActionDate).ToList();
            Log.Message($"History generated. {history.Count} history items obtained.");

            IList<CommitItem> commits = vcsWrapper.GenerateCommits(history).Where(x => x.TimeStamp > lastCommit && !IsLabel(x)).ToList();
            if (mergeCommits)
                commits = vcsWrapper.MergeCommits(commits);
            return commits;
        }
Exemplo n.º 25
0
        void GenerateXpfCommonConfig(string branchName)
        {
            List<TrackItem> items = new List<TrackItem>();
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Mvvm", ProjectPath = "DevExpress.Mvvm" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.Core", ProjectPath = "DevExpress.Xpf.Core" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.Controls", ProjectPath = "DevExpress.Xpf.Controls" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.Grid", ProjectPath = "DevExpress.Xpf.Grid" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.NavBar", ProjectPath = "DevExpress.Xpf.NavBar" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.PropertyGrid", ProjectPath = "DevExpress.Xpf.PropertyGrid" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.Ribbon", ProjectPath = "DevExpress.Xpf.Ribbon" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.Layout", ProjectPath = "DevExpress.Xpf.Layout" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.LayoutControl", ProjectPath = "DevExpress.Xpf.LayoutControl" });
            TrackBranch branch = new TrackBranch($"{branchName}", $@"$/{branchName}/Common/xpf_common_sync.config", $@"$/{branchName}/XPF", items);

            SharpSerializerXmlSettings settings = new SharpSerializerXmlSettings();
            settings.IncludeAssemblyVersionInTypeName = false;
            settings.IncludePublicKeyTokenInTypeName = false;
            SharpSerializer serializer = new SharpSerializer(settings);
            serializer.Serialize(new List<TrackBranch>() { branch }, $@"z:\trackconfig_common_{branchName}.config");
        }
Exemplo n.º 26
0
        void GenerateXpfDiagramConfig(string branchName)
        {
            List<TrackItem> items = new List<TrackItem>();
            items.Add(new TrackItem() { Path = $@"$/{branchName}/Win/DevExpress.XtraDiagram", ProjectPath = "DevExpress.XtraDiagram", AdditionalOffset = "Win" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.Diagram", ProjectPath = "DevExpress.Xpf.Diagram", AdditionalOffset = "XPF" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.ReportDesigner", ProjectPath = "DevExpress.Xpf.ReportDesigner", AdditionalOffset = "XPF" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.PdfViewer", ProjectPath = "DevExpress.Xpf.PdfViewer", AdditionalOffset = "XPF" });
            items.Add(new TrackItem() { Path = $@"$/{branchName}/XPF/DevExpress.Xpf.Printing", ProjectPath = "DevExpress.Xpf.Printing", AdditionalOffset = "XPF" });
            TrackBranch branch = new TrackBranch($"{branchName}", $@"$/{branchName}/Diagram/xpf_common_sync.config", $@"$/{branchName}", items);

            SharpSerializerXmlSettings settings = new SharpSerializerXmlSettings();
            settings.IncludeAssemblyVersionInTypeName = false;
            settings.IncludePublicKeyTokenInTypeName = false;
            SharpSerializer serializer = new SharpSerializer(settings);
            serializer.Serialize(new List<TrackBranch>() { branch }, $@"z:\trackconfig_diagram_{branchName}.config");
        }
Exemplo n.º 27
0
 public HistoryItem FindCommit(TrackBranch branch, Func<HistoryItem, bool> func)
 {
     try {
         var history = GenerateHistory(branch, DateTime.Now.AddDays(-1));
         return history.Reverse().FirstOrDefault(func);
     }
     catch (Exception ex) {
         Log.Error($"Finc commit failed", ex);
         throw;
     }
 }