Example #1
0
 public void AddDocument(string[] fragments, int currentIndex, Document pending)
 {
     if (currentIndex == fragments.Length - 1)
     {
         foreach (Document doc in Documents)
         {
             if (doc == pending)
             {
                 return;
             }
         }
         Documents.Add(pending);
     }
     else
     {
         if (Branches.ContainsKey(fragments[currentIndex + 1]) == false)
         {
             Branches[fragments[currentIndex + 1]] = new ClueTreeNode(fragments[currentIndex + 1], this);
         }
         Branches[fragments[currentIndex + 1]].AddDocument(fragments, currentIndex + 1, pending);
     }
 }
        private void ReloadBranches()
        {
            var selectedBranch = SelectedBranch?.Name;

            Branches.Clear();
            var branches = new ShellCommand().ExecuteGit("branch", GitRoot).Select(p => p.Trim());

            foreach (var branch in branches)
            {
                Branches.Add(new Branch {
                    Name = branch
                });
            }
            if (selectedBranch != null)
            {
                SelectedBranch = Branches.SingleOrDefault(p => p.Name == selectedBranch);
            }
            else
            {
                SelectedBranch = Branches.FirstOrDefault(p => p.Name == "master") ?? Branches.FirstOrDefault();
            }
        }
        private void SetupDataForArithmeticPrecision()
        {
            Lines lines = new Lines();

            lines.Add(1, 1);
            for (int i = 2; i <= 6; i++)
            {
                lines.Add(i, 0);
            }
            Branches branches = new Branches();

            branches.Add(new BranchInfo {
                Line = 1, Hits = 1, Offset = 1, Path = 0, Ordinal = 1
            });
            for (int i = 2; i <= 6; i++)
            {
                branches.Add(new BranchInfo {
                    Line = 1, Hits = 0, Offset = 1, Path = 1, Ordinal = (uint)i
                });
            }

            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Tests.CoverageSummaryTests::TestCalculateSummary()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Tests.CoverageSummaryTests", methods);

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            _moduleArithmeticPrecision = new Modules();
            _moduleArithmeticPrecision.Add("module", documents);
        }
Example #4
0
        private async void HandleCommitCreated(object sender, CommitInfo info)
        {
            var updatedStream = await Client.StreamGet(Stream.id);

            Branches = updatedStream.branches.items;

            if (IsSenderCard)
            {
                return;
            }

            var binfo = Branches.FirstOrDefault(b => b.name == info.branchName);
            var cinfo = binfo.commits.items.FirstOrDefault(c => c.id == info.id);

            if (Branch.name == info.branchName)
            {
                Branch = binfo;
            }

            ServerUpdateSummary = $"{cinfo.authorName} sent new data on branch {info.branchName}: {info.message}";
            ServerUpdates       = true;
        }
Example #5
0
        private void OkClick(object sender, EventArgs e)
        {
            try
            {
                var selectedBranches = Branches.GetSelectedBranches().ToArray();

                if (_currentBranch != null && selectedBranches.Any(branch => branch.Name == _currentBranch))
                {
                    MessageBox.Show(this, string.Format(_cannotDeleteCurrentBranchMessage.Text, _currentBranch), _deleteBranchCaption.Text);
                    return;
                }

                // always treat branches as unmerged if there is no current branch (HEAD is detached)
                var hasUnmergedBranches = _currentBranch == null || selectedBranches.Any(branch => !mergedBranches.Contains(branch.Name));

                // we could show yes/no dialog and set forcing checkbox automatically, but more safe way is asking user to do it himself
                if (hasUnmergedBranches && !ForceDelete.Checked)
                {
                    MessageBox.Show(this, _deleteUnmergedBranchForcingSuggestion.Text, _deleteBranchCaption.Text);
                    return;
                }

                // ask for confirmation to delete unmerged branch that may cause loosing commits
                // (actually we could check if there are another branches pointing to that commit)
                if (hasUnmergedBranches &&
                    MessageBox.Show(this, _deleteBranchQuestion.Text, _deleteBranchCaption.Text, MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                var cmd = new GitDeleteBranchCmd(selectedBranches, ForceDelete.Checked);
                UICommands.StartCommandLineProcessDialog(cmd, this);
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            Close();
        }
Example #6
0
        /// <summary>Initializes <see cref="FormMergeBranch"/>.</summary>
        /// <param name="defaultBranch">Branch to merge into the current branch.</param>
        public FormMergeBranch(GitUICommands commands, string defaultBranch)
            : base(commands)
        {
            InitializeComponent();
            InitializeComplete();

            currentBranchLabel.Font = new Font(currentBranchLabel.Font, FontStyle.Bold);
            noCommit.Checked        = AppSettings.DontCommitMerge;

            helpImageDisplayUserControl1.IsOnHoverShowImage2NoticeText = _formMergeBranchHoverShowImageLabelText.Text;
            helpImageDisplayUserControl1.Visible = !AppSettings.DontShowHelpImages;
            _defaultBranch = defaultBranch;

            noFastForward.Checked  = Module.EffectiveSettings.NoFastForwardMerge;
            addLogMessages.Checked = Module.EffectiveSettings.Detailed.AddMergeLogMessages.ValueOrDefault;
            nbMessages.Value       = Module.EffectiveSettings.Detailed.MergeLogMessagesCount.ValueOrDefault;

            advanced.Checked = AppSettings.AlwaysShowAdvOpt;
            advanced_CheckedChanged(null, null);

            Branches.Select();
        }
Example #7
0
    public IEnumerator Load_branch()
    {
        Branch  branch  = new Branch();
        Request request = new Request(player);
        string  Branch  = servername + "api/v1/branch?data=" + JsonUtility.ToJson(request);

        Debug.Log(Branch);
        WWW LoadWWWMap = new WWW(Branch);

        yield return(LoadWWWMap);

        Debug.Log(LoadWWWMap.text);
        branches = JsonUtility.FromJson <Branches>(LoadWWWMap.text);
        SelectShop.ClearOptions();
        listShop.Clear();
        foreach (Branch n in branches.branches)
        {
            listShop.Add(n.title);
        }
        SelectShop.AddOptions(listShop);
        SelectShop.value = branches.branches
                           .IndexOf(branches.branches.Find(x => x.nid == player.branch.ToString()));
        int i = 0;
        //foreach (Dropdown.OptionData n in MainScript.self.fon_setting.transform.Find("Dropdown").GetComponent<Dropdown>().options)
        //{
        //    Debug.Log(fon_setting.transform.Find("Dropdown").GetComponent<Dropdown>().value);
        //    if (player.branch > 0)
        //    {
        //        //if (n.text == branches.branches.Find(x => x.nid == player.branch.ToString()).title)
        //        if (fon_setting.transform.Find("Dropdown").GetComponent<Dropdown>().itemText.text == branches.branches.Find(x => x.nid == player.branch.ToString()).title)
        //        {
        //            MainScript.self.fon_setting.transform.Find("Dropdown").GetComponent<Dropdown>().value = i;
        //            break;
        //        }
        //        i++;
        //    }
        //}
    }
Example #8
0
        public IActionResult AddBranches([FromBody] Branches BrancheData)
        {
            try
            {
                if (BrancheData == null)
                {
                    return(BadRequest("حذث خطأ في ارسال البيانات الرجاء إعادة الادخال"));
                }
                if (string.IsNullOrWhiteSpace(BrancheData.ArabicName))
                {
                    return(BadRequest("الرجاء إدخال اسم الفرع بالعربي"));
                }

                if (string.IsNullOrWhiteSpace(BrancheData.EnglishName))
                {
                    return(BadRequest("الرجاء إدخال اسم الفرع بالانجليزي"));
                }

                var userId = this.help.GetCurrentUser(HttpContext);

                if (userId <= 0)
                {
                    return(StatusCode(401, "الرجاء الـتأكد من أنك قمت بتسجيل الدخول"));
                }

                BrancheData.CreatedBy = userId;
                BrancheData.CreatedOn = DateTime.Now;
                BrancheData.Status    = 1;
                db.Branches.Add(BrancheData);
                db.SaveChanges();

                return(Ok("لـقد تم تسجيل الـفرع بنـجاح"));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }
Example #9
0
        /// <summary>
        /// Unconditionally branches to the given label.
        /// </summary>
        public Emit <DelegateType> Branch(Label label)
        {
            if (label == null)
            {
                throw new ArgumentNullException("label");
            }

            if (((IOwned)label).Owner != this)
            {
                if (((IOwned)label).Owner is DisassembledOperations <DelegateType> )
                {
                    return(Branch(label.Name));
                }

                FailOwnership(label);
            }

            UnusedLabels.Remove(label);

            UpdateOpCodeDelegate update;

            UpdateState(OpCodes.Br, label, Wrap(StackTransition.None(), "Branch"), out update);

            var valid = CurrentVerifiers.UnconditionalBranch(label);

            if (!valid.Success)
            {
                throw new SigilVerificationException("Branch", valid, IL.Instructions(AllLocals));
            }

            Branches.Add(SigilTuple.Create(OpCodes.Br, label, IL.Index));

            BranchPatches[IL.Index] = SigilTuple.Create(label, update, OpCodes.Br);

            MustMark = true;

            return(this);
        }
Example #10
0
        public ActionResult Create([Bind(Include = "Name,ParentBranch,Address")] Branches branch)
        {
            //if (file != null)
            //{
            //    string pic = System.IO.Path.GetFileName(file.FileName);
            //    string path = System.IO.Path.Combine(
            //                           Server.MapPath("../Pictures"), pic);
            //    // file is uploaded
            //    file.SaveAs(path);

            //    // save the image path path to the database or you can send image
            //    // directly to database
            //    using (MemoryStream ms = new MemoryStream())
            //    {
            //        file.InputStream.CopyTo(ms);
            //        byte[] array = ms.GetBuffer();
            //    }

            //}
            if (ModelState.IsValid)
            {
                try
                {
                    db.Branches.Add(branch);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    //ViewBag.errorMessage = "Name Already Exits in database";
                    //CreateDropDownList();
                    return(View(branch));
                }
                return(RedirectToAction("Index"));
            }


            return(View(branch));
        }
Example #11
0
        public CoverageSummaryTests()
        {
            Lines lines = new Lines();

            lines.Add(1, new LineInfo {
                Hits = 1
            });
            lines.Add(2, new LineInfo {
                Hits = 0
            });
            Branches branches = new Branches();

            branches.Add(1, new List <BranchInfo>());
            branches[1].Add(new BranchInfo {
                Hits = 1, Offset = 1, Path = 0, Ordinal = 1
            });
            branches[1].Add(new BranchInfo {
                Hits = 1, Offset = 1, Path = 1, Ordinal = 2
            });

            Methods methods      = new Methods();
            var     methodString = "System.Void Coverlet.Core.Tests.CoverageSummaryTests::TestCalculateSummary()";

            methods.Add(methodString, new Method());
            methods[methodString].Lines    = lines;
            methods[methodString].Branches = branches;

            Classes classes = new Classes();

            classes.Add("Coverlet.Core.Tests.CoverageSummaryTests", methods);

            Documents documents = new Documents();

            documents.Add("doc.cs", classes);

            _modules = new Modules();
            _modules.Add("module", documents);
        }
 /// <summary>
 /// Gets this options as an Xml element.
 /// </summary>
 /// <returns>The XElement.</returns>
 public XElement ToXml()
 {
     return(new XElement(SGVSchema.RepositoryInfo,
                         IgnoreDirtyWorkingFolder
                                 ? new XElement(SGVSchema.Debug, new XAttribute(SGVSchema.IgnoreDirtyWorkingFolder, "true"))
                                 : null,
                         StartingVersionForCSemVer != null ? new XElement(SGVSchema.StartingVersionForCSemVer, StartingVersionForCSemVer) : null,
                         SingleMajor.HasValue
                                 ? new XElement(SGVSchema.SingleMajor, SingleMajor.Value.ToString())
                                 : null,
                         OnlyPatch
                                 ? new XElement(SGVSchema.OnlyPatch, "true")
                                 : null,
                         IgnoreModifiedFiles.Count > 0
                                 ? new XElement(SGVSchema.IgnoreModifiedFiles,
                                                IgnoreModifiedFiles.Where(f => !string.IsNullOrWhiteSpace(f)).Select(f => new XElement(SGVSchema.Add, f)))
                                 : null,
                         Branches != null
                                 ? new XElement(SGVSchema.Branches,
                                                Branches.Where(b => b != null).Select(b => b.ToXml()))
                                 : null,
                         RemoteName != "origin" ? new XElement(SGVSchema.RemoteName, RemoteName) : null));
 }
Example #13
0
        private void FormMergeBranchLoad(object sender, EventArgs e)
        {
            var selectedHead = Module.GetSelectedBranch();

            currentBranchLabel.Text = selectedHead;

            Branches.BranchesToSelect = Module.GetRefs(true, true);

            if (_defaultBranch != null)
            {
                Branches.SetSelectedText(_defaultBranch);
            }
            else
            {
                string merge = Module.GetRemoteBranch(selectedHead);
                if (!String.IsNullOrEmpty(merge))
                {
                    Branches.SetSelectedText(merge);
                }
            }

            Branches.Select();
        }
Example #14
0
        protected void GET_BRANCHES()
        {
            DataTable dt = Branches.LoadLookup("select_branch_list");

            if (dt != null)
            {
                this.gdv_branches.DataSource            = dt;
                this.gdv_branches.Columns[0].Visible    = false;
                this.gdv_branches.Columns[1].Visible    = false;
                this.gdv_branches.Columns[2].HeaderText = "Branch Name";
                this.gdv_branches.Columns[3].HeaderText = "Branch Active?";
                this.gdv_branches.Columns[4].HeaderText = "Branch Code";
                this.gdv_branches.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_branches.DefaultCellStyle.SelectionForeColor       = Color.Black;
                this.gdv_branches.RowsDefaultCellStyle.BackColor            = Color.LightGray;
                this.gdv_branches.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
                this.gdv_branches.ColumnHeadersDefaultCellStyle.ForeColor   = Color.White;
                this.gdv_branches.ColumnHeadersDefaultCellStyle.BackColor   = Color.Black;
                this.gdv_branches.RowHeadersDefaultCellStyle.BackColor      = Color.Black;
                this.gdv_branches.DefaultCellStyle.SelectionBackColor       = Color.White;
                this.gdv_branches.DefaultCellStyle.SelectionForeColor       = Color.Black;
            }
        }
 private void UpdateXalyusUpdater_Load(object sender, EventArgs e)
 {
     ChangeTheme();
     Icon = new Branches().IconBranch();                   // Met l'icône en foncion de la branche
     gunaPictureBox1.Image = new Branches().ImageBranch(); // Met l'image en fonction de la branche
     Guna.UI.Lib.GraphicsHelper.ShadowForm(this);
     if (isAdmin)
     {
     }
     else
     {
         if (new Language().GetCode() == "fr-FR")
         {
             MessageBox.Show("Des mises à jour pour un des services de Xalyus Store sont disponibles" + Environment.NewLine + "L'application va redémarrer en tant qu'administrateur.", "Mise à jour d'un service", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else if (new Language().GetCode() == "EN")
         {
             MessageBox.Show("Updates are availables for a Xalyus' Service" + Environment.NewLine + "The app will restart in admin mode.", "Service Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         Application.Exit();
         ExecuteAsAdmin(Application.StartupPath + "/InternetTest.exe");
     }
 }
Example #16
0
        private void OkClick(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show(this, _deleteBranchQuestion.Text, _deleteBranchCaption.Text, MessageBoxButtons.YesNo) ==
                    DialogResult.Yes)
                {
                    GitDeleteBranchCmd cmd = new GitDeleteBranchCmd();
                    cmd.Force = ForceDelete.Checked;
                    foreach (GitHead head in Branches.GetSelectedBranches())
                    {
                        cmd.AddBranch(head.Name, head.IsRemote);
                    }

                    GitUICommands.Instance.StartCommandLineProcessDialog(cmd, this);
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.Message);
            }
            Close();
        }
Example #17
0
        private void LoadBranches(string branchType)
        {
            cbManageType.Enabled = false;
            btnFinish.Enabled    = false;

            cbBranches.DataSource = new List <string> {
                _loading.Text
            };
            if (!Branches.ContainsKey(branchType))
            {
                _task.LoadAsync(() => GetBranches(branchType), branches =>
                {
                    Branches.Add(branchType, branches);
                    DisplayBranchData();
                });
            }
            else
            {
                DisplayBranchData();
            }

            btnFinish.Enabled = Branches.Any();
        }
Example #18
0
        public override Expression Simplify()
        {
            Expression = Expression.Simplify();

            Branches = Branches
                       .Select(b =>
            {
                var conditions = b.Conditions
                                 .Select(condition => condition.Simplify())
                                 .ToList();

                return(new Branch(conditions, (BlockExpression)b.Block.Simplify()));
            })
                       .ToList()
                       .AsReadOnly();

            if (DefaultBlock != null)
            {
                DefaultBlock = (BlockExpression)DefaultBlock.Simplify();
            }

            return(this);
        }
Example #19
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,BranchName,BranchDescription,Address,IsDeleted,IsActive,Province")] BranchesFormViewModel branchesFormViewModel)
        {
            if (id != branchesFormViewModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                var branch = new Branches
                {
                    Address           = branchesFormViewModel.Address,
                    BranchName        = branchesFormViewModel.BranchName,
                    BranchDescription = branchesFormViewModel.BranchDescription,
                    ProvincesId       = branchesFormViewModel.Province,
                    IsActive          = branchesFormViewModel.IsActive,
                    IsDeleted         = branchesFormViewModel.IsDeleted
                };

                var    uriString  = string.Format("{0}{1}{2}", configuration["TritonExpressEndopint"], "Branches/", id);
                string jsonString = JsonSerializer.Serialize(branch);
                using (var client = new HttpClient())
                {
                    var httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
                    HttpResponseMessage response = await client.PutAsync(uriString, httpContent);

                    if (response.StatusCode != HttpStatusCode.OK)
                    {
                        ViewBag.Error = "Error : " + response.StatusCode;
                        return(View());
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }
            return(View(branchesFormViewModel));
        }
        private void OkClick(object sender, EventArgs e)
        {
            Module.EffectiveSettings.NoFastForwardMerge = noFastForward.Checked;
            AppSettings.DontCommitMerge = noCommit.Checked;
            ScriptManager.RunEventScripts(this, ScriptEvent.BeforeMerge);

            string mergeMessagePath = null;

            if (addMergeMessage.Checked)
            {
                // [!] Do not reset the last commit message stored in AppSettings.LastCommitMessage

                _commitMessageManager.WriteCommitMessageToFile(mergeMessage.Text, CommitMessageType.Merge,
                                                               usingCommitTemplate: false,
                                                               ensureCommitMessageSecondLineEmpty: false);
                mergeMessagePath = _commitMessageManager.MergeMessagePath;
            }

            var command = GitCommandHelpers.MergeBranchCmd(Branches.GetSelectedText(),
                                                           fastForward.Checked,
                                                           squash.Checked,
                                                           noCommit.Checked,
                                                           _NO_TRANSLATE_mergeStrategy.Text,
                                                           allowUnrelatedHistories.Checked,
                                                           mergeMessagePath,
                                                           addLogMessages.Checked ? (int)nbMessages.Value : (int?)null);
            bool success = FormProcess.ShowDialog(this, process: null, arguments: command, Module.WorkingDir, input: null, useDialogSettings: true);

            var wasConflict = MergeConflictHandler.HandleMergeConflicts(UICommands, this, !noCommit.Checked);

            if (success || wasConflict)
            {
                ScriptManager.RunEventScripts(this, ScriptEvent.AfterMerge);
                UICommands.RepoChangedNotifier.Notify();
                Close();
            }
        }
        private void FormRebaseLoad(object sender, EventArgs e)
        {
            var selectedHead = Module.GetSelectedBranch();

            Currentbranch.Text = selectedHead;

            Branches.DisplayMember = "Name";
            Branches.DataSource    = Module.GetRefs(true, true);

            if (_defaultBranch != null)
            {
                Branches.Text = _defaultBranch;
            }

            Branches.Select();

            cboTo.DisplayMember = "Name";
            cboTo.DataSource    = Module.GetRefs(false, true);

            if (_defaultToBranch != null)
            {
                cboTo.Text = _defaultToBranch;
            }
            else
            {
                cboTo.Text = selectedHead;
            }

            rebasePanel.Visible = !Module.InTheMiddleOfRebase();
            EnableButtons();

            // Honor the rebase.autosquash configuration.
            var autosquashSetting = Module.GetEffectiveSetting("rebase.autosquash");

            chkAutosquash.Checked = "true" == autosquashSetting.Trim().ToLower();
        }
Example #22
0
        /// <summary>
        /// Pops two arguments from the stack, branches to the given label if the second value is less than the first value (when treated as unsigned values).
        /// </summary>
        public Emit <DelegateType> UnsignedBranchIfLess(Label label)
        {
            if (label == null)
            {
                throw new ArgumentNullException("label");
            }

            if (((IOwned)label).Owner != this)
            {
                if (((IOwned)label).Owner is DisassembledOperations <DelegateType> )
                {
                    return(UnsignedBranchIfLess(label.Name));
                }

                FailOwnership(label);
            }

            UnusedLabels.Remove(label);

            UpdateOpCodeDelegate update;

            UpdateState(OpCodes.Blt_Un, label, BranchComparableTransitions("UnsignedBranchIfLess"), out update);

            var valid = CurrentVerifiers.ConditionalBranch(label);

            if (!valid.Success)
            {
                throw new SigilVerificationException("UnsignedBranchIfLess", valid, IL.Instructions(AllLocals));
            }

            Branches.Add(SigilTuple.Create(OpCodes.Blt_Un, label, IL.Index));

            BranchPatches[IL.Index] = SigilTuple.Create(label, update, OpCodes.Blt_Un);

            return(this);
        }
Example #23
0
        // GET: api/Branch/5
        public object Get(int id)
        {
            using (HREntities db = new HREntities())
            {
                var allBranches = new List <Branches>();
                allBranches = db.Branches.ToList();
                Branches branch = allBranches.Where(x => x.BranchID == id).FirstOrDefault();

                if (branch == null)
                {
                    return(NotFound());
                }

                var br = new BranchBO();
                br.branchId  = branch.BranchID;
                br.branch    = branch.BranchName;
                br.address   = branch.Address;
                br.city      = branch.City;
                br.postal    = branch.PostalCode;
                br.telephone = branch.Telephone;

                return(br);
            }
        }
Example #24
0
        public void Serialize <TDoc, TCursor>(IO.TagElementStream <TDoc, TCursor, string> s)
            where TDoc : class
            where TCursor : class
        {
            var engine = KSoft.Debug.TypeCheck.CastReference <BlamEngine>(s.Owner);

            if (s.IsReading)
            {
                Engine = engine;
            }
            else
            {
                Contract.Assert(engine == Engine);
            }

            using (s.EnterCursorBookmark("Repository"))
                using (s.EnterUserDataBookmark(this))
                {
                    s.StreamElement("Guid", this, obj => obj.Guid);

                    EngineTargetPlatform.SerializeBitSet(s, ref mValidTargetPlatforms, "ValidTargetPlatforms");

                    using (var bm = s.EnterCursorBookmarkOpt("Branches", Branches, Predicates.HasItems)) if (bm.IsNotNull)
                        {
                            s.StreamableElements("Branch", Branches);
                        }
                }

            if (s.IsReading)
            {
                KSoft.Debug.ValueCheck.IsLessThanEqualTo("Too many registered engine branches in " + Engine.Name,
                                                         EngineBuildBranch.kMaxCount, Branches.Count);

                Branches.TrimExcess();
            }
        }
Example #25
0
 public List <ClueFragment> GetPossibleClueFragments(string[] fragments, int currentIndex)
 {
     if (currentIndex == fragments.Length - 1)
     {
         string[]            possibleFragments = Branches.Keys.Where(item => item.Contains(fragments[fragments.Length - 1]) && item != fragments[fragments.Length - 1]).ToArray();
         List <ClueFragment> results           = new List <ClueFragment>();
         foreach (string frag in possibleFragments)
         {
             results.Add(new ClueFragment(frag, Branches[frag].GetDocumentsCount(), Branches[frag].Documents));
         }
         return(results);
     }
     else
     {
         if (Branches.ContainsKey(fragments[currentIndex + 1]) == false)
         {
             return(null);
         }
         else
         {
             return(GetPossibleClueFragments(fragments, currentIndex + 1));
         }
     }
 }
Example #26
0
        private static void RetrieveAllBranches()
        {
            var branches   = new Branches(token);
            var branchlist = branches.GetAllBranches();

            // For async use this:
            // var branchlist = branches.GetAllBranchesAsync();
            Console.WriteLine("Branch Locations.");
            var x = 0;

            foreach (var branch in branchlist)
            {
                Console.WriteLine();
                if (x != 0 && x % 20 == 0)
                {
                    Console.WriteLine("Type any key to retrieve another 20");
                    Console.ReadLine();
                }
                x++;
                Console.WriteLine("{0}. {1}", x, branch.Landmark);
                Console.WriteLine("Address: {0}, {1}", branch.Address, branch.PostalCode);
                Console.WriteLine("Coordinate: {0}, {1}", branch.Latitude, branch.Longitude);
            }
        }
Example #27
0
        private void FormRebaseLoad(object sender, EventArgs e)
        {
            var selectedHead = GitModule.Current.GetSelectedBranch();

            Currentbranch.Text = _currentBranchText.Text + " " + selectedHead;

            Branches.DisplayMember = "Name";
            Branches.DataSource    = GitModule.Current.GetHeads(true, true);

            if (_defaultBranch != null)
            {
                Branches.Text = _defaultBranch;
            }

            Branches.Select();

            splitContainer2.SplitterDistance = GitModule.Current.InTheMiddleOfRebase() ? 0 : 70;
            EnableButtons();

            // Honor the rebase.autosquash configuration.
            var autosquashSetting = GitModule.Current.GetEffectiveSetting("rebase.autosquash");

            chkAutosquash.Checked = "true" == autosquashSetting.Trim().ToLower();
        }
Example #28
0
        private void OkClick(object sender, EventArgs e)
        {
            Module.EffectiveSettings.NoFastForwardMerge = noFastForward.Checked;
            AppSettings.DontCommitMerge = noCommit.Checked;
            ScriptManager.RunEventScripts(this, ScriptEvent.BeforeMerge);

            var successfullyMerged = FormProcess.ShowDialog(this, GitCommandHelpers.MergeBranchCmd(Branches.GetSelectedText(),
                                                                                                   fastForward.Checked,
                                                                                                   squash.Checked,
                                                                                                   noCommit.Checked,
                                                                                                   _NO_TRANSLATE_mergeStrategy.Text,
                                                                                                   allowUnrelatedHistories.Checked,
                                                                                                   addMergeMessage.Checked ? mergeMessage.Text : null,
                                                                                                   addLogMessages.Checked ? (int)nbMessages.Value : (int?)null));

            var wasConflict = MergeConflictHandler.HandleMergeConflicts(UICommands, this, !noCommit.Checked);

            if (successfullyMerged || wasConflict)
            {
                ScriptManager.RunEventScripts(this, ScriptEvent.AfterMerge);
                UICommands.RepoChangedNotifier.Notify();
                Close();
            }
        }
Example #29
0
        private void OkClick(object sender, EventArgs e)
        {
            Module.EffectiveSettings.NoFastForwardMerge = noFastForward.Checked;
            AppSettings.DontCommitMerge = noCommit.Checked;

            var successfullyMerged = FormProcess.ShowDialog(this,
                                                            GitCommandHelpers.MergeBranchCmd(Branches.GetSelectedText(), fastForward.Checked, squash.Checked, noCommit.Checked, _NO_TRANSLATE_mergeStrategy.Text));

            var wasConflict = MergeConflictHandler.HandleMergeConflicts(UICommands, this, !noCommit.Checked);

            if (successfullyMerged || wasConflict)
            {
                UICommands.RepoChangedNotifier.Notify();
                Close();
            }
        }
Example #30
0
        private StatusModel GetAppveyorRelease(Branches branch)
        {
            var request = new ApiRequest();

            // Get latest EAP Build
            var eapBranchRequest = new RestRequest
            {
                Method = Method.GET
            };


            switch (branch)
            {
            case Branches.Dev:
                eapBranchRequest.Resource = "/projects/tidusjar/requestplex/branch/dev";
                break;

            case Branches.EarlyAccessPreview:
                eapBranchRequest.Resource = "/projects/tidusjar/requestplex/branch/EAP";
                break;
            }

            var api = StringCipher.Decrypt(Api, "Appveyor");

            eapBranchRequest.AddHeader("Authorization", $"Bearer {api}");
            eapBranchRequest.AddHeader("Content-Type", "application/json");

            var branchResult = request.ExecuteJson <AppveyorBranchResult>(eapBranchRequest, new Uri(AppveyorApiUrl));

            var jobId = branchResult.build.jobs.FirstOrDefault()?.jobId ?? string.Empty;

            if (string.IsNullOrEmpty(jobId))
            {
                return(new StatusModel {
                    UpdateAvailable = false
                });
            }

            // Get artifacts from the EAP Build
            var eapAtrifactRequest = new RestRequest
            {
                Resource = $"/buildjobs/{jobId}/artifacts",
                Method   = Method.GET
            };

            eapAtrifactRequest.AddHeader("Authorization", $"Bearer {api}");
            eapAtrifactRequest.AddHeader("Content-Type", "application/json");

            var artifactResults = request.ExecuteJson <List <AppveyorArtifactResult> >(eapAtrifactRequest, new Uri(AppveyorApiUrl));

            var artifactResult = artifactResults.FirstOrDefault();

            if (artifactResult == null)
            {
                return(new StatusModel
                {
                    UpdateAvailable = false
                });
            }
            var downloadLink = $"{AppveyorApiUrl}/buildjobs/{jobId}/artifacts/{artifactResult.fileName}";

            var branchDisplay = EnumHelper <Branches> .GetDisplayValue(branch);

            var fileversion = AssemblyHelper.GetFileVersion();

            var model = new StatusModel
            {
                DownloadUri    = downloadLink,
                ReleaseNotes   = $"{branchDisplay} (See recent commits for details)",
                ReleaseTitle   = $"Plex Requests {branchDisplay}",
                NewVersion     = branchResult.build.version,
                UpdateUri      = downloadLink,
                CurrentVersion = fileversion
            };

            if (!fileversion.Equals(branchResult.build.version, StringComparison.CurrentCultureIgnoreCase))
            {
                model.UpdateAvailable = true;
            }

            return(model);
        }