Inheritance: MonoBehaviour
Exemple #1
0
        //readonly Tree masterTree;
        //readonly Tree currentTree;
        public Stalker(String localRepo, String sourceFileName, String ignoreFileName, String localStalkBranch = null, String targetTag = null, String localMaster = "master")
        {
            repo = new Repository (localRepo);

            master = repo.Branches.Single (branch => branch.FriendlyName == localMaster);

            if (targetTag != null) {
                tag = repo.Tags.Single (t => t.FriendlyName == targetTag);
            }

            //			if (localStalkBranch != null)
                head = repo.Branches.Single (branch => branch.FriendlyName == localStalkBranch);
            //			else
            //				head = repo.Head;

            //			if (head != repo.Branches.Single (b => b.IsCurrentRepositoryHead)) {
            //                repo.Checkout(head);
            //			}
            //            head = repo.Branches.Single(b => b.IsCurrentRepositoryHead);
            //var filter = new CommitFilter { Since = repo.Branches["master"], Until = repo.Branches["development"] };
            //masterTree = repo.Lookup<Tree>(master.Tip.Sha);
            //currentTree = repo.Lookup<Tree>(head.Tip.Sha);
            try {
                sources = File.ReadAllLines (Path.Combine (localRepo, sourceFileName));
            } catch {
            } finally {
            }
            try {
                ignore = File.ReadAllLines (Path.Combine (localRepo, ignoreFileName));
            } catch {
            } finally {
            }
        }
        public User Login(string username, string password)
        {
            var session = NHibernateSessionManager.GetLocalSession();
            var macAddress = _clientAdapter.GetCurrentClientMacAddress();
            var user = _userRepository.LoginActiveUser(username, password);
            var terminal = _terminalRepository.FindByMac(macAddress);

            if (user.IsNull())
            {
                throw new ApplicationException(@"User not found");
            }

            if (terminal == null)
            {
                session.DoTransactional(sess =>
                    terminal = _terminalRepository.Insert(
                        new Terminal(
                            string.Format(@"T-{0}/{1:00}", user.Employee.Branch.Code ,_terminalRepository.Count() + 1),
                            macAddress,
                            user.Employee.Branch
                        )
                    )
                );
            }

            LoggedInUser = user;
            LoggedInUserBranch = user.Employee.Branch;
            LoggedInTerminal = terminal;

            return user;
        }
Exemple #3
0
        /// <summary>
        /// Checkout the tip commit of the specified <see cref="Branch"/> object. If this commit is the
        /// current tip of the branch, will checkout the named branch. Otherwise, will checkout the tip commit
        /// as a detached HEAD.
        /// </summary>
        /// <param name="repository">The repository to act on</param>
        /// <param name="branch">The <see cref="Branch"/> to check out.</param>
        /// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
        /// <returns>The <see cref="Branch"/> that was checked out.</returns>
        public static Branch Checkout(IRepository repository, Branch branch, CheckoutOptions options)
        {
            Ensure.ArgumentNotNull(repository, "repository");
            Ensure.ArgumentNotNull(branch, "branch");
            Ensure.ArgumentNotNull(options, "options");

            // Make sure this is not an unborn branch.
            if (branch.Tip == null)
            {
                throw new UnbornBranchException("The tip of branch '{0}' is null. There's nothing to checkout.",
                    branch.FriendlyName);
            }

            if (!branch.IsRemote && !(branch is DetachedHead) &&
                string.Equals(repository.Refs[branch.CanonicalName].TargetIdentifier, branch.Tip.Id.Sha,
                    StringComparison.OrdinalIgnoreCase))
            {
                Checkout(repository, branch.Tip.Tree, options, branch.CanonicalName);
            }
            else
            {
                Checkout(repository, branch.Tip.Tree, options, branch.Tip.Id.Sha);
            }

            return repository.Head;
        }
Exemple #4
0
        /// <summary>Create <see cref="RenameBranchDialog"/>.</summary>
        /// <param name="branch">Branch to rename.</param>
        /// <exception cref="ArgumentNullException"><paramref name="branch"/> == <c>null</c>.</exception>
        public RenameBranchDialog(Branch branch)
        {
            Verify.Argument.IsNotNull(branch, "branch");
            Verify.Argument.IsFalse(branch.IsDeleted, "branch",
                Resources.ExcObjectIsDeleted.UseAsFormat("Branch"));

            _branch = branch;

            InitializeComponent();
            Localize();

            var inputs = new IUserInputSource[]
            {
                _newNameInput = new TextBoxInputSource(_txtNewName),
            };
            _errorNotifier = new UserInputErrorNotifier(NotificationService, inputs);

            SetupReferenceNameInputBox(_txtNewName, ReferenceType.LocalBranch);

            var branchName = branch.Name;
            _txtOldName.Text = branchName;
            _txtNewName.Text = branchName;
            _txtNewName.SelectAll();

            GitterApplication.FontManager.InputFont.Apply(_txtNewName, _txtOldName);

            _controller = new RenameBranchController(branch) { View = this };
        }
 public ElectronicObject(string catalogueNumber, string manufacturer, string model, string description, int quantity, Branch category, decimal price, Color color, double display, int capacity)
     : base(catalogueNumber, manufacturer, model, description, quantity, category, price)
 {
     this.display = display;
     this.capacity = capacity;
     this.color = color;
 }
        /// <summary>
        /// Gets the <see cref="BranchConfig"/> for the current commit.
        /// </summary>
        public static BranchConfig GetBranchConfiguration(GitVersionContext context, Branch targetBranch, IList<Branch> excludedInheritBranches = null)
        {
            var matchingBranches = LookupBranchConfiguration(context.FullConfiguration, targetBranch).ToArray();

            BranchConfig branchConfiguration;
            if (matchingBranches.Length > 0)
            {
                branchConfiguration = matchingBranches[0];

                if (matchingBranches.Length > 1)
                {
                    Logger.WriteWarning(string.Format(
                        "Multiple branch configurations match the current branch branchName of '{0}'. Using the first matching configuration, '{1}'. Matching configurations include: '{2}'",
                        targetBranch.FriendlyName,
                        branchConfiguration.Name,
                        string.Join("', '", matchingBranches.Select(b => b.Name))));
                }
            }
            else
            {
                Logger.WriteInfo(string.Format(
                    "No branch configuration found for branch {0}, falling back to default configuration",
                    targetBranch.FriendlyName));

                branchConfiguration = new BranchConfig { Name = string.Empty };
                ConfigurationProvider.ApplyBranchDefaults(context.FullConfiguration, branchConfiguration, "");
            }

            return branchConfiguration.Increment == IncrementStrategy.Inherit ?
                InheritBranchConfiguration(context, targetBranch, branchConfiguration, excludedInheritBranches) :
                branchConfiguration;
        }
 public FinancialStatusByBranchController(Branch branch)
     : base(UITableViewStyle.Grouped, null)
 {
     Autorotate = false;
     this.branch = branch;
     buildReport ();
 }
 public BranchWrapper(Repository repo, Branch branch)
 {
     this.repo = repo;
     this.branch = branch;
     IsRemote = branch.IsRemote;
     if (branch.TrackedBranch != null)
     {
         TrackedBranch = new BranchWrapper(repo, branch.TrackedBranch);
     }
     IsTracking = branch.IsTracking;
     TrackingDetails = (Func<object, Task<object>>)(async (j) => { return branch.TrackingDetails; });
     IsCurrentRepositoryHead = (Func<object, Task<object>>)(async (j) => { return branch.IsCurrentRepositoryHead; });
     Tip = async (j) => { return new CommitWrapper(branch.Tip); };
     UpstreamBranchCanonicalName = (Func<object, Task<object>>)(async (j) => { return branch.UpstreamBranchCanonicalName; });
     Remote = branch.Remote;
     CanonicalName = branch.CanonicalName;
     Commits = (Func<object, Task<object>>)(async (j) => {
         if (j != null)
         {
             Commit after = repo.Lookup<Commit>((string)j);
             Commit until = branch.Tip;
             Commit ancestor = repo.Commits.FindMergeBase(after, until) ?? after;
             return CommitsAfter(after, until, ancestor).Distinct().Select(c => new CommitWrapper(c));
         }
         else
         {
             return branch.Commits.Select(c => new CommitWrapper(c));
         }
     });
     Name = branch.Name;
 }
        public static KeyValuePair<string, BranchConfig> GetBranchConfiguration(Commit currentCommit, IRepository repository, bool onlyEvaluateTrackedBranches, Config config, Branch currentBranch, IList<Branch> excludedInheritBranches = null)
        {
            var matchingBranches = LookupBranchConfiguration(config, currentBranch);

            if (matchingBranches.Length == 0)
            {
                var branchConfig = new BranchConfig();
                ConfigurationProvider.ApplyBranchDefaults(config, branchConfig);
                return new KeyValuePair<string, BranchConfig>(string.Empty, branchConfig);
            }
            if (matchingBranches.Length == 1)
            {
                var keyValuePair = matchingBranches[0];
                var branchConfiguration = keyValuePair.Value;

                if (branchConfiguration.Increment == IncrementStrategy.Inherit)
                {
                    return InheritBranchConfiguration(onlyEvaluateTrackedBranches, repository, currentCommit, currentBranch, keyValuePair, branchConfiguration, config, excludedInheritBranches);
                }

                return keyValuePair;
            }

            const string format = "Multiple branch configurations match the current branch branchName of '{0}'. Matching configurations: '{1}'";
            throw new Exception(string.Format(format, currentBranch.Name, string.Join(", ", matchingBranches.Select(b => b.Key))));
        }
        /// <summary>
        /// Create New Branch
        /// </summary>
        /// <param name="NewBranch"></param>
        public void CreateBranch(Branch NewBranch)
        {
            string qryInsertBranch =
                            @"INSERT INTO [dbo].[Company]
                            ([BranchID]
                            , [CompanyID]
                            , [BranchRegion]
                            , [BranchCode]
                            , [BranchName]
                            , [BranchHotelName]
                            , [BranchSpaName]
                            , [BranchAddress]
                            , [BranchCity]
                            , [BranchState]
                            , [BranchCountry]
                            , [BranchContactNo]
                            , [BranchComment]
                            , [BranchCreatedBy])
                            values
                            (@BranchID, @CompanyID, @BranchRegion, @BranchCode, @BranchName,
                            @BranchHotelName, @BranchSpaName, @BranchAddress, @BranchCity,
                            @BranchState, @BranchCountry, @BranchContactNo, @BranchComment, @BranchCreatedBy)";

            //creates new Branch
            this._con.Query<int>(qryInsertBranch, NewBranch);
        }
Exemple #11
0
 public Employee(Branch branch, Position position, PersonName name, Gender gender)
     : base(name)
 {
     _branch = branch;
     _position = position;
     base.Gender = gender;
 }
 /// <summary>
 /// Push the specified branch to its tracked branch on the remote.
 /// </summary>
 /// <param name="network">The <see cref="Network"/> being worked with.</param>
 /// <param name="branch">The branch to push.</param>
 /// <param name="pushOptions"><see cref="PushOptions"/> controlling push behavior</param>
 /// <exception cref="LibGit2SharpException">Throws if either the Remote or the UpstreamBranchCanonicalName is not set.</exception>
 public static void Push(
     this Network network,
     Branch branch,
     PushOptions pushOptions = null)
 {
     network.Push(new[] { branch }, pushOptions);
 }
Exemple #13
0
 public int NumberOfCommitsOnBranchSinceCommit(Branch branch, Commit commit)
 {
     var olderThan = branch.Tip.Committer.When;
     return branch.Commits
         .TakeWhile(x => x != commit)
         .Count();
 }
        public static Commit LatestMergeCommit(this Branch thisBranch, Branch otherBranch)
        {
            IEnumerable<Commit> otherBranchCommits = otherBranch.Commits;

            if (otherBranchCommits.Contains(thisBranch.Tip))
            {
                // Current branch is merged back to otherBranch.
                // So we find the last commit on otherBranch before this merge and all it's ancestors.
                var otherTipAfterMerge =
                    otherBranchCommits.SkipWhile(c => c.Parents.All(p => p != thisBranch.Tip)).FirstOrDefault();
                if (otherTipAfterMerge != null)
                {
                    var thisTipBeforeMerge = otherTipAfterMerge.Parents.First(p => p != thisBranch.Tip);
                    otherBranchCommits =
                        new List<Commit> { thisTipBeforeMerge }.Concat(thisTipBeforeMerge.GetAllAncestors());
                }
            }

            var branchCommits = thisBranch.Commits.Except(otherBranchCommits).ToList();
            var branchCommitsMergedFromOtherBranch =
                branchCommits.Where(c => c.IsMergeFrom(otherBranchCommits)).ToList();

            if (branchCommitsMergedFromOtherBranch.Any())
            {
                return branchCommitsMergedFromOtherBranch.First().GetSingleParentFrom(otherBranchCommits);
            }

            if (branchCommits.Any())
            {
                return branchCommits.Last().GetSingleParentFrom(otherBranchCommits);
            }

            return null;
        }
 static string GetUnknownBranchSuffix(Branch branch)
 {
     var unknownBranchSuffix = branch.Name.Split('-', '/');
     if (unknownBranchSuffix.Length == 1)
         return branch.Name;
     return unknownBranchSuffix[1];
 }
        static Branch[] CalculateWhenMultipleParents(IRepository repository, Commit currentCommit, ref Branch currentBranch, Branch[] excludedBranches)
        {
            var parents = currentCommit.Parents.ToArray();
            var branches = repository.Branches.Where(b => !b.IsRemote && b.Tip == parents[1]).ToList();
            if (branches.Count == 1)
            {
                var branch = branches[0];
                excludedBranches = new[]
                {
                    currentBranch,
                    branch
                };
                currentBranch = branch;
            }
            else if (branches.Count > 1)
            {
                currentBranch = branches.FirstOrDefault(b => b.Name == "master") ?? branches.First();
            }
            else
            {
                var possibleTargetBranches = repository.Branches.Where(b => !b.IsRemote && b.Tip == parents[0]).ToList();
                if (possibleTargetBranches.Count > 1)
                {
                    currentBranch = possibleTargetBranches.FirstOrDefault(b => b.Name == "master") ?? possibleTargetBranches.First();
                }
                else
                {
                    currentBranch = possibleTargetBranches.FirstOrDefault() ?? currentBranch;
                }
            }

            Logger.WriteInfo("HEAD is merge commit, this is likely a pull request using " + currentBranch.Name + " as base");

            return excludedBranches;
        }
        void EnsureVersionIsValid(SemanticVersion version, Branch branch, BranchType branchType)
        {
            var msg = string.Format("Branch '{0}' doesn't respect the {1} branch naming convention. ",
                branch.Name, branchType);

            if (version.PreReleaseTag.HasTag())
            {
                throw new ErrorException(msg + string.Format("Supported format is '{0}-Major.Minor.Patch'.", branchType.ToString().ToLowerInvariant()));
            }

            switch (branchType)
            {
                case BranchType.Hotfix:
                    if (version.Patch == 0)
                    {
                        throw new ErrorException(msg + "A patch segment different than zero is required.");
                    }

                    break;

                case BranchType.Release:
                    if (version.Patch != 0)
                    {
                        throw new ErrorException(msg + "A patch segment equals to zero is required.");
                    }

                    break;

                case BranchType.Unknown:
                    break;

                default:
                    throw new NotSupportedException(string.Format("Unexpected branch type {0}.", branchType));
            }
        }
    public void Connect(Uri path)
    {
      // Try to see if ther is already a git repository inside the filesystem path
      if (Repository.IsValid(m_fileSystemPath))
      {
        m_repository = new Repository(m_fileSystemPath, new RepositoryOptions());
      }
      else
      {
        var tempFolder = Guid.NewGuid().ToString("N");

        m_bareWorkDirPath = System.IO.Path.Combine(m_fileSystemPath, tempFolder);
        var ret = Repository.Clone(path.AbsoluteUri, m_bareWorkDirPath, new CloneOptions()
        {
          CredentialsProvider = (url, fromUrl, types) => new UsernamePasswordCredentials()
          {
            Password = m_password,
            Username = m_userName,
          },
          Checkout = false,
          IsBare = true,
        });

        m_repository = new Repository(m_bareWorkDirPath, new RepositoryOptions());
      }

      m_branch = m_repository.Branches[m_branchPath];
      if (m_branch == null)
      {
        throw new Exception("Branch not found: " + m_branchPath);
      }
    }
Exemple #19
0
        public MainViewModel(KeyHooker hookerKey, MouseHooker hookerMouse, KeySenderInput keySenderInput, MouseSenderInput mouseSenderInput)
        {
            mHookerKey = hookerKey;
            mHookerKey.SetHook();
            mHookerMouse = hookerMouse;
            mHookerMouse.SetHook();

            mKeySenderInput = keySenderInput;
            mMouseSenderInput = mouseSenderInput;

            mStopMacroBranch = new Branch<IInput>(mInputEqualityComparer);
            mMacrosModeBranch = new Branch<IInput>(mInputEqualityComparer);

            Settings.Default.Setting = Settings.Default.Setting ?? new AppSettings(mInputEqualityComparer);
            AppSettings settings = Settings.Default.Setting;
            mTreeRoot = settings.TreeRoot;
            mTreeSequence = settings.TreeSequence;
            MacrosCollection = settings.MacrosCollection;
            StopMacroCollection = settings.SequenceStopMacro;
            MacrosModeCollection = settings.SequenceMacrosMode;
            SequenceCollection = settings.Sequence;
            MacroCollection = settings.Macro;

            mSequenceReader = new HookNotRepeatReader(mHookerKey, SequenceCollection);
            ObservableCollection<IInput> tempCollection = new ObservableCollection<IInput>(MacroCollection.Cast<IInput>());
            tempCollection.CollectionChanged += ReadMacro_CollectionChanged;
            mMacroReader = new MultiHookNotRepeatReader(new List<IHooker> { mHookerKey, mHookerMouse }, tempCollection);
            mStopMacroReader = new HookNotRepeatReader(mHookerKey, StopMacroCollection);
            mMacrosModeReader = new HookNotRepeatReader(mHookerKey, MacrosModeCollection);

            RecordSequenceCommand = new RelayCommand(RecordSequence);
            RecordMacroCommand = new RelayCommand(RecordMacro);
            CreateMacrosCommand = new RelayCommand(CreateMacros);
            CleanRowsSequenceCommand = new RelayCommand(CleanSequence);
            CleanRowsMacroCommand = new RelayCommand(CleanMacro);
            CleanRowsMacrosCommand = new RelayCommand(CleanMacros);
            DeleteRowSequenceCommand = new RelayCommand<IInput>(RemoveSequence);
            DeleteRowMacroCommand = new RelayCommand<InputDelay>(RemoveMacro);
            DeleteRowMacrosCommand = new RelayCommand<Macros>(RemoveMacros);
            StopRecordStopMacroCommand = new RelayCommand(StopRecordStopMacro);
            StartRecordStopMacroCommand = new RelayCommand(StartRecordStopMacro);
            StartRecordMacrosModeCommand = new RelayCommand(StartRecordMacrosMode);
            StopRecordMacrosModeCommand = new RelayCommand(StopRecordMacrosMode);
            SetDefaultDelayCommand = new RelayCommand(SetDefaultDelay);
            StopAllRecordCommand = new RelayCommand(StopAllRecord);

            mCancellationState = new CancelState<IInput>(mInputEqualityComparer);

            StateWalker<IInput> machineWalker = new StateWalker<IInput>(mTreeRoot);
            mHookerKey.Hooked += arg =>
            {
                State<IInput> currentState = machineWalker.WalkStates(arg);
                return currentState is FunctionState<IInput>
                    ? (bool)((FunctionState<IInput>)currentState).ExecuteFunction()
                    : currentState is CancellationFunctionState<IInput>
                    ? (bool)((CancellationFunctionState<IInput>)currentState).ExecuteFunction(mCancellationState.CancelToken)
                    : true;
            };
        }
 public AddDataForTestingTransaction()
 {
     ConnectionManager connectionManager = ConnectionManager.GetInstance(DataUtil.TESTDB);
     _connection = connectionManager.SqlConnection;
     _domainOfApplicationManagement = new EconomicActivityManager(DataUtil.TESTDB);
     _clientManagement = new ClientManager(DataUtil.TESTDB);
     _branch = new Branch {Id = 1, Name = "Default"};
 }
 public void addPcReply(Branch branch)
 {
     if (m_pcReplies == null)
     {
         m_pcReplies = new List<Branch>();
     }
     m_pcReplies.Add(branch);
 }
Exemple #22
0
        public BranchPropertiesDialog(Branch branch)
        {
            Verify.Argument.IsNotNull(branch, "branch");

            _branch = branch;

            InitializeComponent();
        }
            public InternalNode(Branch branch, BranchCollection branches, bool isModified)
                : base(branch)
            {
                Debug.Assert(branch.NodeType == NodeType.Internal);

                Branches = branches;
                IsModified = isModified;
            }
        public string GenerateCode(Branch b, string newLine)
        {
            if (string.IsNullOrEmpty(b.Path))
                return string.Format("(\"{0}\", {1})", b.Name, GenerateCode(b.Tree, newLine)); ;

            return string.Format("(\"{0}\", {1} {2} {3} )", b.Name,
                b.Many ? "mapTrees" : "mapTree", b.Path, GenerateCode(b.Tree, newLine)); ;
        }
Exemple #25
0
            public LeafNode(Branch branch, bool isModified)
                : base(branch)
            {
                Debug.Assert(branch.NodeType == NodeType.Leaf);

                Container = new Dictionary<Locator, IOrderedSet<IData, IData>>();
                IsModified = isModified;
            }
        internal BranchTrackingDetails(Repository repo, Branch branch)
        {
            this.repo = repo;
            this.branch = branch;

            aheadBehind = new Lazy<Tuple<int?, int?>>(ResolveAheadBehind);
            commonAncestor = new Lazy<Commit>(ResolveCommonAncestor);
        }
 static void EnsureVersionIsValid(SemanticVersion version, Branch branch)
 {
     if (version.Patch != 0)
     {
         var message = string.Format("Branch '{0}' doesn't respect the Release branch naming convention. A patch segment equals to zero is required.", branch.Name);
         throw new WarningException(message);
     }
 }
Exemple #28
0
        public BranchDragDropMenu(Branch branch)
        {
            Verify.Argument.IsValidGitObject(branch, "branch");

            _branch = branch;

            Items.Add(new ToolStripMenuItem("TEST"));
        }
        internal BranchUpdater(Repository repo, Branch branch)
        {
            Ensure.ArgumentNotNull(repo, "repo");
            Ensure.ArgumentNotNull(branch, "branch");

            this.repo = repo;
            this.branch = branch;
        }
Exemple #30
0
        public static void Main()
        {
            IBL test = FactorySingletonBl.getInstanceBl();


            List <group_local>        zoo = new List <group_local>();
            List <group_Order_dish>   loo = new List <group_Order_dish>();
            List <group_time>         woo = new List <group_time>();
            List <List <string_int> > poo = new List <List <string_int> >();
            List <List <string_int> > goo = new List <List <string_int> >();
            List <Branch>             doo = new List <Branch>();
            List <Branch>             soo = new List <Branch>();
            int    hoo = new int();
            double koo = new double();

            Dish shnitzal = new Dish {
                Get_Dish_id = 1, get_cal = 400, Get_name = "shnitzal", get_price = 70, get_size = Sizes.Medium, get_sup = Supervision.Glatt, get_typ = Types.Meat
            };
            Dish tost = new Dish {
                Get_Dish_id = 2, get_cal = 350, Get_name = "tost", get_price = 25, get_size = Sizes.Medium, get_sup = Supervision.Glatt, get_typ = Types.Dairy
            };
            Dish salad = new Dish {
                Get_Dish_id = 3, get_cal = 250, Get_name = "salad", get_price = 45, get_size = Sizes.Small, get_sup = Supervision.Basic, get_typ = Types.Vegeterian
            };
            Dish ravioly = new Dish {
                Get_Dish_id = 4, get_cal = 380, Get_name = "ravioly", get_price = 56, get_size = Sizes.Medium, get_sup = Supervision.Mehadrin, get_typ = Types.Dairy
            };
            Dish shawarma = new Dish {
                Get_Dish_id = 5, get_cal = 500, Get_name = "shawarma", get_price = 42, get_size = Sizes.Large, get_sup = Supervision.Mehadrin, get_typ = Types.Meat
            };
            Dish tiras = new Dish {
                Get_Dish_id = 6, get_cal = 400, Get_name = "tiras", get_price = 70, get_size = Sizes.Medium, get_sup = Supervision.Glatt, get_typ = Types.Vegeterian
            };
            Dish melauach = new Dish {
                Get_Dish_id = 7, get_cal = 350, Get_name = "melauach", get_price = 25, get_size = Sizes.Medium, get_sup = Supervision.Glatt, get_typ = Types.Dairy
            };
            Dish bread = new Dish {
                Get_Dish_id = 8, get_cal = 250, Get_name = "bread", get_price = 45, get_size = Sizes.Small, get_sup = Supervision.Basic, get_typ = Types.Dairy
            };
            Dish chicken = new Dish {
                Get_Dish_id = 9, get_cal = 380, Get_name = "chicken", get_price = 56, get_size = Sizes.Medium, get_sup = Supervision.Mehadrin, get_typ = Types.Meat
            };
            Dish chips = new Dish {
                Get_Dish_id = 10, get_cal = 500, Get_name = "chips", get_price = 42, get_size = Sizes.Large, get_sup = Supervision.Mehadrin, get_typ = Types.Vegeterian
            };

            test.add_dish(shnitzal);
            test.add_dish(tost);
            test.add_dish(salad);
            test.add_dish(ravioly);
            test.add_dish(shawarma);
            test.add_dish(tiras);
            test.add_dish(melauach);
            test.add_dish(bread);
            test.add_dish(chicken);
            test.add_dish(chips);


            Ordered_Dish A = new Ordered_Dish {
                get_dish_id = 1, Get_D_Order_code = 30, get_quantity = 7
            };
            Ordered_Dish B = new Ordered_Dish {
                get_dish_id = 2, Get_D_Order_code = 31, get_quantity = 8
            };
            Ordered_Dish C = new Ordered_Dish {
                get_dish_id = 3, Get_D_Order_code = 32, get_quantity = 9
            };
            Ordered_Dish D = new Ordered_Dish {
                get_dish_id = 4, Get_D_Order_code = 33, get_quantity = 10
            };
            Ordered_Dish E = new Ordered_Dish {
                get_dish_id = 5, Get_D_Order_code = 34, get_quantity = 11
            };
            Ordered_Dish F = new Ordered_Dish {
                get_dish_id = 6, Get_D_Order_code = 35, get_quantity = 5
            };
            Ordered_Dish G = new Ordered_Dish {
                get_dish_id = 7, Get_D_Order_code = 36, get_quantity = 1
            };
            Ordered_Dish H = new Ordered_Dish {
                get_dish_id = 8, Get_D_Order_code = 37, get_quantity = 12
            };
            Ordered_Dish I = new Ordered_Dish {
                get_dish_id = 9, Get_D_Order_code = 38, get_quantity = 2
            };
            Ordered_Dish J = new Ordered_Dish {
                get_dish_id = 10, Get_D_Order_code = 39, get_quantity = 15
            };

            test.add_ordered_d(A);
            test.add_ordered_d(B);
            test.add_ordered_d(C);
            test.add_ordered_d(D);
            test.add_ordered_d(E);
            test.add_ordered_d(F);
            test.add_ordered_d(G);
            test.add_ordered_d(H);
            test.add_ordered_d(I);
            test.add_ordered_d(J);

            List <int> list_dish_b = new List <int>(); // basic

            list_dish_b.Add(salad.Get_Dish_id);
            list_dish_b.Add(bread.Get_Dish_id);
            List <int> list_dish_g = new List <int>(); // glat

            list_dish_g.Add(shnitzal.Get_Dish_id);
            list_dish_g.Add(tost.Get_Dish_id);
            list_dish_g.Add(melauach.Get_Dish_id);
            List <int> list_dish_m = new List <int>(); // mehadrin

            list_dish_m.Add(tiras.Get_Dish_id);
            list_dish_m.Add(chicken.Get_Dish_id);
            list_dish_m.Add(chips.Get_Dish_id);
            list_dish_m.Add(ravioly.Get_Dish_id);
            list_dish_m.Add(shawarma.Get_Dish_id);

            Branch a = new Branch {
                Get_name = "tovale", Get_add = "lala", Get_Branch_id = 60, Get_emp = 6, Get_emp_a = 6, Get_kosher = Supervision.Basic, get_location = Location.Center, get_menu = list_dish_b
            };
            Branch b = new Branch {
                Get_name = "musaka", Get_add = "ababa", Get_Branch_id = 61, Get_emp = 11, Get_emp_a = 11, Get_kosher = Supervision.Glatt, get_location = Location.Judea_and_Samaria, get_menu = list_dish_g
            };
            Branch c = new Branch {
                Get_name = "tovli", Get_add = "dada", Get_Branch_id = 62, Get_emp = 15, Get_emp_a = 15, Get_kosher = Supervision.Mehadrin, get_location = Location.Jerusalem, get_menu = list_dish_m
            };
            Branch d = new Branch {
                Get_name = "torat", Get_add = "picha", Get_Branch_id = 63, Get_emp = 15, Get_emp_a = 15, Get_kosher = Supervision.Mehadrin, get_location = Location.Jerusalem, get_menu = list_dish_m
            };

            test.add_branch(a);
            test.add_branch(b);
            test.add_branch(c);
            test.add_branch(d);

            Client ma = new Client {
                get_age = 50, Get_Cus_id = 100, get_name = "Ma", get_phone = 054848, get_cus_lo = Location.Center, get_card = 0303030, get_member_b = true, get_add = "newzeland", get_email = "*****@*****.**"
            };
            Client Da = new Client {
                get_age = 30, Get_Cus_id = 101, get_name = "Da", get_phone = 054868, get_cus_lo = Location.Jerusalem, get_card = 045630
            };
            Client ga = new Client {
                get_age = 20, Get_Cus_id = 102, get_name = "ga", get_phone = 054548, get_cus_lo = Location.Judea_and_Samaria, get_card = 0306000
            };
            Client la = new Client {
                get_age = 10, Get_Cus_id = 103, get_name = "la", get_phone = 0543438, get_cus_lo = Location.Center, get_card = 789055
            };
            Client ta = new Client {
                get_age = 19, Get_Cus_id = 104, get_name = "ta", get_phone = 0543438, get_cus_lo = Location.North, get_card = 045630
            };

            test.add_client(ma);
            test.add_client(Da);
            test.add_client(ga);
            test.add_client(la);
            test.add_client(ta);

            List <int> od_b = new List <int>();

            od_b.Add(32);
            List <int> od_g = new List <int>();

            od_g.Add(30); od_g.Add(31);
            List <int> od_m = new List <int>();

            od_m.Add(33); od_m.Add(34);


            Order Aa = new Order {
                Get_Order_code = 200, Get_branch_id = 60, Get_client_id = 100, get_location = Location.Center, Get_time = DateTime.Now, get_list = od_b
            };
            Order Ba = new Order {
                Get_Order_code = 201, Get_branch_id = 61, Get_client_id = 101, get_location = Location.Jerusalem, Get_time = DateTime.Now, get_list = od_m
            };
            Order Fa = new Order {
                Get_Order_code = 202, Get_branch_id = 62, Get_client_id = 102, get_location = Location.Judea_and_Samaria, Get_time = DateTime.Now, get_list = od_g
            };
            Order Ra = new Order {
                Get_Order_code = 203, Get_branch_id = 62, Get_client_id = 103, get_location = Location.Center, Get_time = DateTime.Now, get_list = od_b
            };
            Order Ea = new Order {
                Get_Order_code = 204, Get_branch_id = 61, Get_client_id = 104, get_location = Location.Center, Get_time = DateTime.Now, get_list = od_b
            };

            test.add_order(Aa);
            test.add_order(Ba);
            test.add_order(Fa);
            test.add_order(Ra);
            test.add_order(Ea);


            poo = test.client_order_history(100);         // poo
            goo = test.Brach_order_history(a);            // goo
            doo = test.available_b(Location.Center);      // doo
            soo = test.find_by_kosher(Supervision.Glatt); // soo
            hoo = test.All_Calories(od_g);                // hoo
            koo = test.oreder_bill(Ea);                   // koo
            zoo = test.Profits_by_location();             // zoo
            loo = test.dish_Profits();                    // loo
            woo = test.time_Profits();                    // woo


            /////////////////////////////////////////////////////////////////////////////
            Console.WriteLine("client_order_history");
            foreach (var item in poo)
            {
                foreach (var items in item)
                {
                    Console.WriteLine("dish: " + items.name + " quantity:" + items.number + " price: " + items.oo_number);
                }
                //Console.WriteLine("\n");
            }
            Console.WriteLine("end");
            /////////////////////////////////////////////////////////////////////////////

            Console.WriteLine("Brach_order_history");
            foreach (var item in goo)
            {
                foreach (var items in item)
                {
                    Console.WriteLine("dish: " + items.name + " quantity:" + items.number + " price: " + items.oo_number);
                }
            }
            Console.WriteLine("end");
            /////////////////////////////////////////////////////////////////////////////

            Console.WriteLine("available_b");
            foreach (var item in doo)
            {
                Console.WriteLine("branch id :" + item.Get_Branch_id + " location :" + item.get_location.ToString());
            }
            Console.WriteLine("end");

            /////////////////////////////////////////////////////////////////////////////

            Console.WriteLine("find_by_kosher");
            foreach (var item in soo)
            {
                Console.WriteLine("branch id :" + item.Get_Branch_id + " location :" + item.get_location.ToString() + " kosher : " + item.Get_kosher.ToString());
            }
            Console.WriteLine("end");

            /////////////////////////////////////////////////////////////////////////////

            Console.WriteLine("All_Calories");
            Console.WriteLine("cloriot: " + hoo);
            Console.WriteLine("end");
            /////////////////////////////////////////////////////////////////////////////

            Console.WriteLine("oreder_bill");
            Console.WriteLine("bill: " + koo);
            Console.WriteLine("end");
            /////////////////////////////////////////////////////////////////////////////
            Console.WriteLine("Profits_by_location");
            foreach (var item in zoo)
            {
                Console.WriteLine("location :" + item.local.ToString() + " profit : " + item.sum_p);
            }
            Console.WriteLine("end");
            /////////////////////////////////////////////////////////////////////////////

            Console.WriteLine("dish_Profits");
            foreach (var item in loo)
            {
                Console.WriteLine("dish name :" + item.name.ToString() + " profit : " + item.sum_p + " quantity: " + item.sum_q);
            }
            Console.WriteLine("end");
            /////////////////////////////////////////////////////////////////////////////

            Console.WriteLine("time_Profits");
            foreach (var item in woo)
            {
                Console.WriteLine("date:" + item.date.ToString() + " profit : " + item.sum_p);
            }
            Console.WriteLine("end");


            ///////////////////////////////////////////////////////////////////////////////////////////

            ///delegate run!!
            //  o_p();



            if (true)
            {
                ;       // debugging test..
            }
        }
Exemple #31
0
 public static BranchInfo ToModel([NotNull] this Branch branch) =>
 new BranchInfo
 {
     Id   = branch.Name,
     Name = branch.Name
 };
Exemple #32
0
        private void RecordConflicts(Config.RepoReport repoReportData, Branch sourceBranch, Branch targetBranch, Commit lastCommit)
        {
            foreach (var conflict in repo.Index.Conflicts)
            {
                Logger.Log("Conflicted on branch " + sourceBranch.FriendlyName + " with branch " + targetBranch.FriendlyName + ": " + conflict.Ancestor.Path);

                RecordConflict(
                    repoReportData,
                    conflict.Ours.Path,
                    sourceBranch.FriendlyName.Split('/').Last(),
                    targetBranch.FriendlyName.Split('/').Last(),
                    lastCommit.Author.Name,
                    lastCommit.Author.When);
            }
        }
 public async Task <IActionResult> Edit([FromBody] Branch branch) => Ok(await branchServices.Edit(branch));
 public bool Create(Branch branch)
 {
     return(_db.Create <Branch>(branch));
 }
Exemple #35
0
 public Instruction VisitBranch(Branch branch)
 {
     throw new NotImplementedException();
 }
        public Branch SaveBranch(Branch branch, Guid idAccount)
        {
            branch.PersonOwner.IdAccount          = idAccount;
            branch.PersonAdministration.IdAccount = idAccount;
            branch.StatusRegister = CStatusRegister.Active;
            branch.IdAccount      = idAccount;
            branch.Country        = null;
            branch.Province       = null;
            branch.District       = null;
            branch.Parish         = null;
            branch.Sector         = null;

            if (branch.PersonAdministration.Id != Guid.Empty)
            {
                branch.PersonAdministration = null;
            }
            if (branch.PersonOwner.Id != Guid.Empty)
            {
                branch.PersonOwner = null;
            }

            branch.IdAccount      = idAccount;
            branch.StatusRegister = CStatusRegister.Active;

            var stateRegister = Guid.Empty == branch.Id ? EntityState.Added : EntityState.Modified;

            using (var transaction = Context.Database.BeginTransaction())
            {
                try
                {
                    //Cuando el dueño es administrador y es un nuevo dueño
                    if (branch.IsAdministratorOwner == CBranch.Yes &&
                        (branch.IdPersonAdministrator == Guid.Empty || null == branch.IdPersonAdministrator))
                    {
                        var personOwner = branch.PersonOwner;
                        var secuencia   = _sequenceBusiness.NextSequence(CPerson.SequenceCode, idAccount);

                        if (personOwner != null)
                        {
                            personOwner.Code = secuencia.ToString();
                            Context.Persons.Add(personOwner);
                            Context.SaveChanges();
                            branch.PersonOwner          = null;
                            branch.PersonAdministration = null;

                            branch.IdPersonAdministrator = personOwner.Id;
                            branch.IdPersonOwner         = personOwner.Id;
                        }
                        else
                        {
                            throw new ExceptionMardis("Error al insertar Persona");
                        }
                    }
                    Sequence nextSequence;
                    if (string.IsNullOrEmpty(branch.Code))
                    {
                        nextSequence = _sequenceBusiness.NextSequence(CBranch.SequenceCode, idAccount);
                        var returnCode = nextSequence.Initial + "-" + nextSequence.SequenceCurrent;

                        branch.Code = returnCode;
                    }
                    else
                    {
                        //Elimino los Branchustomers
                        _branchDao.DeleteBranchCustomers(branch.Id, idAccount);
                    }

                    if (branch.IdPersonAdministrator == Guid.Empty)
                    {
                        nextSequence = _sequenceBusiness.NextSequence(CPerson.SequenceCode, idAccount);
                        if (branch.PersonAdministration != null)
                        {
                            branch.PersonAdministration.Code = nextSequence.ToString();
                        }
                    }

                    if (branch.IdPersonOwner == Guid.Empty)
                    {
                        nextSequence = _sequenceBusiness.NextSequence(CPerson.SequenceCode, idAccount);
                        if (branch.PersonOwner != null)
                        {
                            branch.PersonOwner.Code = nextSequence.ToString();
                        }
                    }

                    Context.Branches.Add(branch);

                    Context.Entry(branch).State = stateRegister;

                    Context.SaveChanges();

                    transaction.Commit();

                    branch = GetOne(branch.Id, idAccount);
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    branch = null;
                }
            }

            return(branch);
        }
Exemple #37
0
 void Start()
 {
     duoCam       = GetComponent <Branch>();
     Duo          = GameObject.Find("strandedDuo");
     followTarget = Duo;
 }
Exemple #38
0
 /// <summary>
 /// Creates a new Octree.
 /// </summary>
 /// <param name="splitCount">How many leaves a branch can hold before it splits into sub-branches.</param>
 /// <param name="region">The region that your Octree occupies, all inserted bounds should fit into this.</param>
 public Octree(int splitCount, AxisAlignedBoundingBox region)
 {
     this.splitCount = splitCount;
     root            = CreateBranch(this, null, region);
 }
Exemple #39
0
        private void updateBranchControls()
        {
            Branch branch = FractalManager.SelectedBranch;

            removeBranchToolStripButton.Enabled      = (branch != null);
            removeBranchToolStripMenuItem.Enabled    = (branch != null);
            duplicateBranchToolStripButton.Enabled   = (branch != null);
            duplicateBranchToolStripMenuItem.Enabled = (branch != null);
            invertBranchToolStripButton.Enabled      = (branch != null);
            invertBranchToolStripMenuItem.Enabled    = (branch != null);

            weightLabel.Visible        = (branch != null);
            weightSpinner.Visible      = (branch != null);
            colorWeightLabel.Visible   = (branch != null);
            colorWeightSpinner.Visible = (branch != null);
            localizedCheckbox.Visible  = (branch != null);

            foreach (ComboBox db in variDropBoxes)
            {
                db.Visible = (branch != null);
            }
            foreach (DragSpin ds in variSpinners)
            {
                ds.Visible = (branch != null);
            }

            if (branch != null)
            {
                weightSpinner.SetValueStealth((double)branch.Weight);
                colorWeightSpinner.SetValueStealth((double)branch.ColorWeight);

                localizedCheckbox.CheckedChanged -= applyLocalized;
                localizedCheckbox.Checked         = branch.Localized;
                localizedCheckbox.CheckedChanged += applyLocalized;

                foreach (ComboBox db in variDropBoxes)
                {
                    db.SelectedIndexChanged -= applyVariControls;
                    db.SelectedIndex         = 0;
                }
                foreach (DragSpin ds in variSpinners)
                {
                    ds.ValueChanged -= applyVariControls;
                    ds.Value         = 0;
                }

                for (int i = 0; i < Math.Min(variControlCount, branch.Variations.Count); i++)
                {
                    variDropBoxes[i].SelectedItem = Variation.Variations[branch.Variations[i].Index];
                    variSpinners[i].Value         = branch.Variations[i].Weight;
                }

                foreach (ComboBox db in variDropBoxes)
                {
                    db.SelectedIndexChanged += applyVariControls;
                }
                foreach (DragSpin ds in variSpinners)
                {
                    ds.ValueChanged += applyVariControls;
                }
            }
        }
 public bool Update(Branch branch)
 {
     return(_db.Update <Branch>(branch));
 }
        public bool DeleteById(int branchId)
        {
            Branch branch1 = _db.Find <Branch>(B => B.BranchId == branchId);

            return(_db.Delete <Branch>(branch1));
        }
 public bool Delete(Branch branch)
 {
     return(_db.Delete <Branch>(branch));
 }
 public IEnumerable <Branch> GetByFilter([FromQuery] Branch entity)
 {
     return(this._branchService.GetAllByFilter(entity));
 }
Exemple #44
0
 /// <summary>
 ///   Gets the number of commits in the longest single path between the specified commit and the most distant
 ///   ancestor (inclusive) that set the version to the value at the tip of the <paramref name="branch"/>.
 /// </summary>
 /// <param name="branch">The branch to measure the height of.</param>
 /// <param name="repoRelativeProjectDirectory">The repo-relative project directory for which to calculate the version.</param>
 /// <returns>The height of the branch till the version is changed.</returns>
 public static int GetVersionHeight(this Branch branch, string repoRelativeProjectDirectory = null)
 {
     return(GetVersionHeight(branch.Commits.First(), repoRelativeProjectDirectory));
 }
Exemple #45
0
 public AskFoodView(Branch branch) : this()
 {
     Branch = branch;
 }
Exemple #46
0
 public void VisitBranch(Branch branch)
 {
     throw new NotImplementedException();
 }
Exemple #47
0
 public override string ToString()
 {
     return(Branch.ToString() + ' ' + AccountNumber.ToString());
 }
Exemple #48
0
 public Instruction VisitBranch(Branch b)
 {
     b.Condition = b.Condition.Accept(eval);
     return(b);
 }
Exemple #49
0
        public async Task Delete(string projectKey, string repositorySlug, Branch branch)
        {
            string requestUrl = UrlBuilder.FormatRestApiUrl(MANAGE_BRANCHES, null, projectKey, repositorySlug);

            await _httpWorker.DeleteWithRequestContentAsync(requestUrl, branch);
        }
Exemple #50
0
 public void GiveSunlight(Branch branch)
 {
     branch.IsSunlit = true;
 }
Exemple #51
0
 public frmAddCustomer(Branch branch, frmTransactions transactions)
 {
     InitializeComponent();
     this.branch       = branch;
     this.transactions = transactions;
 }
Exemple #52
0
 /// <summary>
 ///   Gets the number of commits in the longest single path between the specified branch's head and the most distant
 ///   ancestor (inclusive).
 /// </summary>
 /// <param name="branch">The branch to measure the height of.</param>
 /// <param name="continueStepping">
 ///   A function that returns <c>false</c> when we reach a commit that should not be included in the
 ///   height calculation.
 ///   May be <c>null</c> to count the height to the original commit.
 /// </param>
 /// <returns>The height of the branch.</returns>
 public static int GetHeight(this Branch branch, Func <Commit, bool> continueStepping = null)
 {
     return(GetHeight(branch.Commits.First(), continueStepping));
 }
Exemple #53
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="branchPerson"></param>
        /// <param name="idAccount"></param>
        /// <param name="iduser"></param>
        /// <param name="option"></param>
        /// <param name="campaign"></param>
        /// <param name="statusStask"></param>
        /// <param name="datestart"></param>
        /// <returns></returns>
        public Branch GuardarlocalesCreadoAPPPedido(Branch branchPerson, int idAccount, string iduser, int option, int campaign, int statusStask, DateTime datestart)
        {
            bool   status = false;
            Branch branch = null;
            Person person = null;

#pragma warning disable CS0219 // La variable 'task' está asignada pero su valor nunca se usa
            TaskCampaign task = null;
#pragma warning restore CS0219 // La variable 'task' está asignada pero su valor nunca se usa
            try
            {
                //var rutas = branchPerson.Select(x => x.RUTAAGGREGATE).Distinct();



                if (branchPerson.Id != 0)
                {
                    Context.Branches.Update(branchPerson);
                    Context.SaveChanges();
                }
                //var _datainsert = branchPerson.Where(x => x.Id == Guid.Parse("00000000-0000-0000-0000-000000000000"));
                if (branchPerson.Id == 0)
                {
                    Context.Branches.Add(branchPerson);
                    Context.SaveChanges();
                }

                if (option.Equals(2))
                {
                    TaskCampaign _modelTask = new TaskCampaign();

                    var IMEID = branchPerson.IMEI_ID.Split('-');
                    if (IMEID.Length > 0)
                    {
                        if (IMEID[0] != "0")
                        {
                            try
                            {
                                var idpollster = Context.Pollsters.Where(x => x.IMEI == IMEID[0] &&
                                                                         (datestart >= x.Fecha_Inicio && datestart <= x.Fecha_Fin) &&
                                                                         x.idaccount.ToString().ToUpper() == idAccount.ToString().ToUpper() &&
                                                                         x.Status == CStatusRegister.Active
                                                                         );
                                _modelTask.idPollster = idpollster.FirstOrDefault().Id;
                            }
                            catch (Exception e)
                            {
                                return(null);

                                throw;
                            }
                        }
                    }

                    _modelTask.IdAccount        = idAccount;
                    _modelTask.IdBranch         = branchPerson.Id;
                    _modelTask.IdCampaign       = campaign;
                    _modelTask.IdMerchant       = Guid.Parse(iduser);
                    _modelTask.IdStatusTask     = statusStask;
                    _modelTask.Route            = branchPerson.RUTAAGGREGATE;
                    _modelTask.DateCreation     = DateTime.Now;
                    _modelTask.StartDate        = datestart;
                    _modelTask.DateModification = DateTime.Now;
                    _modelTask.Code             = branchPerson.Code;
                    _modelTask.ExternalCode     = branchPerson.Code;
                    _modelTask.Description      = "Tarea creada desde carga de rutas";
                    _modelTask.StatusMigrate    = "M";
                    Context.TaskCampaigns.Add(_modelTask);
                    Context.SaveChanges();
                }

                return(branchPerson);
            }
            catch (Exception e)
            {
                return(null);

                throw;
            }
            finally
            {
                status = true;
            }
        }
Exemple #54
0
        private static bool BranchesAlreadyMerged(List <string> mergedPairs, Branch sourceBranch, Branch targetBranch)
        {
            if (mergedPairs.Contains(targetBranch.CanonicalName + " <- " + sourceBranch.CanonicalName) ||
                mergedPairs.Contains(sourceBranch.CanonicalName + " <- " + targetBranch.CanonicalName))
            {
                Logger.Log("Branches have already been compared - skipping...");
                return(true);
            }

            return(false);
        }
 public CUPayment(Branch selectedBranch)
 {
     InitializeComponent();
     init(selectedBranch);
 }
Exemple #56
0
 public Instruction VisitBranch(Branch branch)
 {
     //$TODO: this may not be necessary once scanner-development is done.
     return(new SideEffect(Constant.String(string.Format("cloned {0}", branch), StringType.NullTerminated(PrimitiveType.Char))));
 }
Exemple #57
0
        /// <summary>
        /// Branches need to terminate the current basic block and make links
        /// to the 'true' and 'false' destinations.
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public bool VisitBranch(RtlBranch b)
        {
            // We don't know the 'then' block yet, as the following statements may chop up the block
            // we're presently in. Back-patch in when the block target is obtained.
            var branch = new Branch(b.Condition, new Block(blockCur.Procedure, "TMP!"));

            Emit(branch, blockCur);

            // The following statements may chop up the blockCur, so hang on to the essentials.
            var proc = blockCur.Procedure;
            RtlInstructionCluster ricDelayed = null;

            if ((b.Class & RtlClass.Delay) != 0)
            {
                rtlStream.MoveNext();
                ricDelayed = rtlStream.Current;
                ric        = ricDelayed;
            }
            var fallthruAddress = ric.Address + ric.Length;

            var blockThen = BlockFromAddress(ric.Address, b.Target, proc, state.Clone());

            var blockElse      = FallthroughBlock(ric.Address, proc, fallthruAddress);
            var branchingBlock = blockCur.IsSynthesized
                ? blockCur
                : scanner.FindContainingBlock(ric.Address);

            if ((b.Class & RtlClass.Delay) != 0 &&
                ricDelayed.Instructions.Count > 0)
            {
                // Introduce stubs for the delay slot, but only
                // if the delay slot isn't empty.

                if ((b.Class & RtlClass.Annul) != 0)
                {
                    EnsureEdge(proc, branchingBlock, blockElse);
                }
                else
                {
                    Block blockDsF = null;
                    blockDsF = proc.AddBlock(branchingBlock.Name + "_ds_f");
                    blockDsF.IsSynthesized = true;
                    blockCur = blockDsF;
                    ProcessRtlCluster(ricDelayed);
                    EnsureEdge(proc, blockDsF, blockElse);
                    EnsureEdge(proc, branchingBlock, blockDsF);
                }

                Block blockDsT = proc.AddBlock(branchingBlock.Name + "_ds_t");
                blockDsT.IsSynthesized = true;
                blockCur = blockDsT;
                ProcessRtlCluster(ricDelayed);
                EnsureEdge(proc, blockDsT, blockThen);
                branch.Target = blockDsT;
                EnsureEdge(proc, branchingBlock, blockDsT);
            }
            else
            {
                branch.Target = blockThen;      // The back-patch referred to above.
                EnsureEdge(proc, branchingBlock, blockElse);
                if (blockElse != blockThen)
                {
                    EnsureEdge(proc, branchingBlock, blockThen);
                }
                else
                {
                    proc.ControlGraph.AddEdge(branchingBlock, blockThen);
                }
            }

            // Now, switch to the fallthru block and keep rewriting.
            blockCur = blockElse;
            return(true);
        }
 public async Task <IActionResult> Post(Branch branch)
 {
     return(Ok(await branchServices.PostBranch(branch)));
 }
 public BranchTest()
 {
     _branch        = new Branch(null);
     _revision      = Revision.Number(3);
     _laterRevision = Revision.Number(4);
 }
 /// <summary>
 ///   Push the specified branch to its tracked branch on the remote.
 /// </summary>
 /// <param name="network">The <see cref="Network"/> being worked with.</param>
 /// <param name="branch">The branch to push.</param>
 /// <param name="onPushStatusError">Handler for reporting failed push updates.</param>
 /// <param name="credentials">Credentials to use for user/pass authentication.</param>
 /// <exception cref="LibGit2SharpException">Throws if either the Remote or the UpstreamBranchCanonicalName is not set.</exception>
 public static void Push(
     this Network network,
     Branch branch,
     PushStatusErrorHandler onPushStatusError = null,
     Credentials credentials = null)
 {
     network.Push(new[] { branch }, onPushStatusError, credentials);
 }