Creates the branch pop up menu that ask if the user wants to hide all the
bugs in that branch.
505405
JPopupMenu createBranchPopUpMenu() {
        JPopupMenu popupMenu = new JPopupMenu();

        JMenuItem filterMenuItem = MainFrameHelper.newJMenuItem("menu.filterTheseBugs", "Filter these bugs");

        filterMenuItem.addActionListener(evt -> {
            // TODO This code does a smarter version of filtering that is
            // only possible for branches, and does so correctly
            // However, it is still somewhat of a hack, because if we ever
            // add more tree listeners than simply the bugtreemodel,
            // They will not be called by this code. Using FilterActivity to
            // notify all listeners will however destroy any
            // benefit of using the smarter deletion method.

            try {
                int startCount;
                TreePath path = MainFrame.getInstance().getTree().getSelectionPath();
                TreePath deletePath = path;
                startCount = ((BugAspects) (path.getLastPathComponent())).getCount();
                int count = ((BugAspects) (path.getParentPath().getLastPathComponent())).getCount();
                while (count == startCount) {
                    deletePath = deletePath.getParentPath();
                    if (deletePath.getParentPath() == null)// We are at the
                        // top of the
                        // tree, don't
                        // let this be
                        // removed,
                        // rebuild tree
                        // from root.
                    {
                        Matcher m1 = mainFrame.getCurrentSelectedBugAspects().getMatcher();
                        Filter suppressionFilter1 = MainFrame.getInstance().getProject().getSuppressionFilter();
                        suppressionFilter1.addChild(m1);
                        PreferencesFrame.getInstance().updateFilterPanel();
                        FilterActivity.notifyListeners(FilterListener.Action.FILTERING, null);
                        return;
                    }
                    count = ((BugAspects) (deletePath.getParentPath().getLastPathComponent())).getCount();
                }
                /*
                 * deletePath should now be a path to the highest ancestor
                 * branch with the same number of elements as the branch to
                 * be deleted in other words, the branch that we actually
                 * have to remove in order to correctly remove the selected
                 * branch.
                 */
                BugTreeModel model = MainFrame.getInstance().getBugTreeModel();
                TreeModelEvent event = new TreeModelEvent(mainFrame, deletePath.getParentPath(),
                        new int[] { model.getIndexOfChild(deletePath.getParentPath().getLastPathComponent(),
                                deletePath.getLastPathComponent()) }, new Object[] { deletePath.getLastPathComponent() });
                Matcher m2 = mainFrame.getCurrentSelectedBugAspects().getMatcher();
                Filter suppressionFilter2 = MainFrame.getInstance().getProject().getSuppressionFilter();
                suppressionFilter2.addChild(m2);
                PreferencesFrame.getInstance().updateFilterPanel();
                model.sendEvent(event, BugTreeModel.TreeModification.REMOVE);
                // FilterActivity.notifyListeners(FilterListener.Action.FILTERING,
                // null);

                mainFrame.setProjectChanged(true);

                MainFrame.getInstance().getTree().setSelectionRow(0);// Selects
                // the
                // top
                // of
                // the
                // Jtree
                // so
                // the
                // CommentsArea
                // syncs
                // up.
            } catch (RuntimeException e) {
                MainFrame.getInstance().showMessageDialog("Unable to create filter: " + e.getMessage());
            }
        });

        popupMenu.add(filterMenuItem);

        return popupMenu;
    }
137881
def _add_default_branch(self, body):
        """"""
        assert isinstance(body, CodeStatement)
        if isinstance(body, CodeBlock):
            self.else_body = body
        else:
            self.else_body._add(body)
580336
def build_branch(self):
        
        # pylint: disable=len-as-condition
        if len(self.dutinformation) > 0 and (self.dutinformation.get(0).build is not None):
            return self.dutinformation.get(0).build.branch
        return None
1315971
def checkout_default_branch(self):
        
        set_state(WORKFLOW_STATES.CHECKING_OUT_DEFAULT_BRANCH)

        cmd = "git", "checkout", self.config["default_branch"]
        self.run_cmd(cmd)

        set_state(WORKFLOW_STATES.CHECKED_OUT_DEFAULT_BRANCH)
1164531
def get_protection(self):
        
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            self.protection_url,
            headers={'Accept': Consts.mediaTypeRequireMultipleApprovingReviews}
        )
        return github.BranchProtection.BranchProtection(self._requester, headers, data, completed=True)
147236
def branch_exists(self, branch):
        """"""
        try:
            git(self.gitdir, self.gitwd, "rev-parse", branch)
        except sh.ErrorReturnCode:
            return False
        return True
270758
public Ref createBranchAndCheckout(Git git, String branch) {
        try {
            return git.checkout()
                .setCreateBranch(true)
                .setName(branch)
                .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK)
                .call();
        } catch (GitAPIException e) {
            throw new IllegalStateException(e);
        }
    }
484278
def show_popup(self, selected, pos):
        ''''''
        state = self.state
        if selected.popup_menu is not None:
            import copy
            popup_menu = selected.popup_menu
            if state.default_popup is not None and state.default_popup.combine:
                popup_menu = copy.deepcopy(popup_menu)
                popup_menu.add(MPMenuSeparator())
                popup_menu.combine(state.default_popup.popup)
            wx_menu = popup_menu.wx_menu()
            state.frame.PopupMenu(wx_menu, pos)
469116
def createbug(self, *args, **kwargs):
        
        data = self._validate_createbug(*args, **kwargs)
        rawbug = self._proxy.Bug.create(data)
        return Bug(self, bug_id=rawbug["id"],
                   autorefresh=self.bug_autorefresh)
795836
protected final boolean callbackCreateOptionsMenu(Menu menu) {
        if (DEBUG) Log.d(TAG, "[callbackCreateOptionsMenu] menu: " + menu);

        boolean result = true;
        if (mActivity instanceof OnCreatePanelMenuListener) {
            OnCreatePanelMenuListener listener = (OnCreatePanelMenuListener)mActivity;
            result = listener.onCreatePanelMenu(Window.FEATURE_OPTIONS_PANEL, menu);
        } else if (mActivity instanceof OnCreateOptionsMenuListener) {
            OnCreateOptionsMenuListener listener = (OnCreateOptionsMenuListener)mActivity;
            result = listener.onCreateOptionsMenu(menu);
        }

        if (DEBUG) Log.d(TAG, "[callbackCreateOptionsMenu] returning " + result);
        return result;
    }
575983
def pre_release(version):
    """"""
    announce(version)
    regen()
    changelog(version, write_out=True)
    fix_formatting()

    msg = "Preparing release version {}".format(version)
    check_call(["git", "commit", "-a", "-m", msg])

    print()
    print(f"{Fore.CYAN}[generate.pre_release] {Fore.GREEN}All done!")
    print()
    print(f"Please push your branch and open a PR.")
1050721
def showPopup(self):
        
        if not self.showTreePopup():
            return super(XOrbRecordBox, self).showPopup()
        
        tree = self.treePopupWidget()
        
        if tree and not tree.isVisible():
            tree.move(self.mapToGlobal(QPoint(0, self.height())))
            tree.resize(self.width(), 250)
            tree.resizeToContents()
            tree.filterItems('')
            tree.setFilteredColumns(range(tree.columnCount()))
            tree.show()
418245
@Override public boolean onCreateOptionsMenu(Menu menu) {
    if (actionBarMenuAction != null) {
      menu.add(actionBarMenuAction.title)
          .setShowAsActionFlags(SHOW_AS_ACTION_ALWAYS)
          .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
            @Override public boolean onMenuItemClick(MenuItem menuItem) {
              actionBarMenuAction.action.call();
              return true;
            }
          });
    }
    menu.add("Log Scope Hierarchy")
        .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
          @Override public boolean onMenuItemClick(MenuItem item) {
            Log.d("DemoActivity", MortarScopeDevHelper.scopeHierarchyToString(activityScope));
            return true;
          }
        });
    return true;
  }
150125
private void syncMenu() {
        if (bugInstance != null) {
            BugProperty severityProperty = bugInstance.lookupProperty(BugProperty.SEVERITY);
            if (severityProperty != null) {
                try {
                    int severity = severityProperty.getValueAsInt();
                    if (severity > 0 && severity <= severityItemList.length) {
                        selectSeverity(severity);
                        return;
                    }
                } catch (NumberFormatException e) {
                    // Ignore: we'll allow the user to select a valid severity
                }
            }

            // We didn't get a valid severity from the BugInstance.
            // So, leave the menu items enabled but cleared, so
            // the user can select a severity.
            resetMenuItems(true);
        } else {
            // No BugInstance - disable all menu items.
            resetMenuItems(false);
        }
    }
810866
public void blackListTargetBranches(Iterable<String> branches) {
        for (String branch : branches) {
            blackListTargetBranches.add(new GhprbBranch(branch));
        }
    }
491993
private function get_local_branch() {
		$repo = false;
		if ( isset( $_REQUEST['plugin'] ) ) {
			$repos = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs();
			$repo  = isset( $repos[ $_REQUEST['plugin'] ] ) ? $repos[ $_REQUEST['plugin'] ] : false;
		}
		if ( isset( $_REQUEST['theme'] ) ) {
			$repos = Singleton::get_instance( 'Theme', $this )->get_theme_configs();
			$repo  = isset( $repos[ $_REQUEST['theme'] ] ) ? $repos[ $_REQUEST['theme'] ] : false;
		}
		$current_branch = $repo ?
			Singleton::get_instance( 'Branch', $this )->get_current_branch( $repo ) :
			'master';

		return $current_branch;
	}
768230
def checkout_deploy_branch(deploy_branch, canpush=True):
    
    # Create an empty branch with .nojekyll if it doesn't already exist
    create_deploy_branch(deploy_branch, push=canpush)
    remote_branch = "doctr_remote/{}".format(deploy_branch)
    print("Checking out doctr working branch tracking", remote_branch)
    clear_working_branch()
    # If gh-pages doesn't exist the above create_deploy_branch() will create
    # it we can push, but if we can't, it won't and the --track would fail.
    if run(['git', 'rev-parse', '--verify', remote_branch], exit=False) == 0:
        extra_args = ['--track', remote_branch]
    else:
        extra_args = []
    run(['git', 'checkout', '-b', DOCTR_WORKING_BRANCH] + extra_args)
    print("Done")

    return canpush