Exemplo n.º 1
0
        /// <summary>
        /// Gets the command line arguments for the current task
        /// </summary>
        /// <param name="BranchLocation">Full path to the current branch location (or the new branch location for qbranch)</param>
        /// <param name="LaunchpadUrl">Full URL to Launchpad for the current user and current branch (or the new branch for qbranch)</param>
        /// <returns>String containg the command line args</returns>
        public string GetBazaarArgs(string BranchLocation, string LaunchpadUrl)
        {
            switch (_taskItem)
            {
            case TaskItem.qlog:
                return("qlog");

            case TaskItem.qlogFile:
                OpenFileDialog dlgLog = new OpenFileDialog();
                dlgLog.InitialDirectory = BranchLocation;
                dlgLog.Multiselect      = false;

                if (dlgLog.ShowDialog() == DialogResult.Cancel)
                {
                    return(String.Empty);
                }

                return(String.Format("qlog \"{0}\"", dlgLog.FileName));

            case TaskItem.qdiff:
                return("qdiff");

            case TaskItem.qdiffFile:
                OpenFileDialog dlgDiff = new OpenFileDialog();
                dlgDiff.InitialDirectory = BranchLocation;
                dlgDiff.Multiselect      = false;

                if (dlgDiff.ShowDialog() == DialogResult.Cancel)
                {
                    return(String.Empty);
                }

                return(String.Format("qdiff \"{0}\"", dlgDiff.FileName));

            case TaskItem.qbrowse:
                return("qbrowse");

            case TaskItem.qadd:
                return("qadd --ui-mode");

            case TaskItem.qcommit:
                return("qcommit --ui-mode");

            case TaskItem.qshelve:
                return("qshelve --ui-mode");

            case TaskItem.qunshelve:
                return("qunshelve --ui-mode");

            case TaskItem.qmerge:
                return("qmerge lp:/openpetraorg --ui-mode");

            case TaskItem.qconflicts:
                return("qconflicts");

            case TaskItem.qpull:
                return("qpull lp:/openpetraorg --ui-mode");

            case TaskItem.qupdate:
                return("qupdate --ui-mode");

            case TaskItem.bugUrl:
                DlgBugNumber dlgBug = new DlgBugNumber();

                if (dlgBug.ShowDialog() != DialogResult.OK)
                {
                    return(String.Empty);
                }

                return(String.Format("bug-url op:{0} --open", dlgBug.txtBugNumber.Text));

            case TaskItem.qbranch:
                return(String.Format("qbranch lp:/openpetraorg {0} --ui-mode", LaunchpadUrl));

            case TaskItem.qbranch2:
                return(String.Format("qbranch {0} \"{1}\" --bind --ui-mode", LaunchpadUrl, BranchLocation));

            case TaskItem.winexplore:
                return(String.Format("/C explorer.exe \"{0}\"", BranchLocation));

            default:
                return(String.Empty);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the command line arguments for the current task
        /// </summary>
        /// <param name="BranchLocation">Full path to the current branch location (or the new branch location for qbranch)</param>
        /// <param name="LaunchpadUrl">Full URL to Launchpad for the current user and current branch (or the new branch for qbranch)</param>
        /// <returns>String containg the command line args</returns>
        public string GetBazaarArgs(string BranchLocation, string LaunchpadUrl)
        {
            switch (_taskItem)
            {
                case TaskItem.qlog:
                    return "qlog";

                case TaskItem.qlogFile:
                    OpenFileDialog dlgLog = new OpenFileDialog();
                    dlgLog.InitialDirectory = BranchLocation;
                    dlgLog.Multiselect = false;

                    if (dlgLog.ShowDialog() == DialogResult.Cancel)
                    {
                        return String.Empty;
                    }

                    return String.Format("qlog \"{0}\"", dlgLog.FileName);

                case TaskItem.qdiff:
                    return "qdiff";

                case TaskItem.qdiffFile:
                    OpenFileDialog dlgDiff = new OpenFileDialog();
                    dlgDiff.InitialDirectory = BranchLocation;
                    dlgDiff.Multiselect = false;

                    if (dlgDiff.ShowDialog() == DialogResult.Cancel)
                    {
                        return String.Empty;
                    }

                    return String.Format("qdiff \"{0}\"", dlgDiff.FileName);

                case TaskItem.qbrowse:
                    return "qbrowse";

                case TaskItem.qadd:
                    return "qadd --ui-mode";

                case TaskItem.qcommit:
                    return "qcommit --ui-mode";

                case TaskItem.qshelve:
                    return "qshelve --ui-mode";

                case TaskItem.qunshelve:
                    return "qunshelve --ui-mode";

                case TaskItem.qmerge:
                    return "qmerge lp:/openpetraorg --ui-mode";

                case TaskItem.qconflicts:
                    return "qconflicts";

                case TaskItem.qpull:
                    return "qpull lp:/openpetraorg --ui-mode";

                case TaskItem.qupdate:
                    return "qupdate --ui-mode";

                case TaskItem.bugUrl:
                    DlgBugNumber dlgBug = new DlgBugNumber();

                    if (dlgBug.ShowDialog() != DialogResult.OK)
                    {
                        return String.Empty;
                    }

                    return String.Format("bug-url op:{0} --open", dlgBug.txtBugNumber.Text);

                case TaskItem.qbranch:
                    return String.Format("qbranch lp:/openpetraorg {0} --ui-mode", LaunchpadUrl);

                case TaskItem.qbranch2:
                    return String.Format("qbranch {0} \"{1}\" --bind --ui-mode", LaunchpadUrl, BranchLocation);

                case TaskItem.winexplore:
                    return String.Format("/C explorer.exe \"{0}\"", BranchLocation);

                default:
                    return String.Empty;
            }
        }