Пример #1
0
class RecurAddOptions:
    def __init__(self):
        global DefExtensions
        self._advUI = Persistent('P_RecurAdd_AdvUI', '1', 0)
        self._ExtVals = {}
        for type, valname in [('b', 'P_RecurAdd_BExts'), \
                              ('u', 'P_RecurAdd_UExts'), \
                              ('o', 'P_RecurAdd_OExts'), \
                              ('i', 'P_RecurAdd_IExts')]:
            self._ExtVals[type] = Persistent(valname,
                                             string.join(DefExtensions[type]),
                                             0)
            DefExtensions[type] = self._ExtVals[type].GetValue().split()

    def get_advUI(self):
        return self._advUI.GetValue() == '1'

    def set_advUI(self, value):
        if value:
            value = '1'
        else:
            value = '0'
        self._advUI.SetValue(value)

    def get_DefExts(self, type):
        return string.split(self._ExtVals[type].GetValue())

    def set_DefExts(self, type, value):
        global DefExtensions
        self._ExtVals[type].SetValue(string.join(value))
        DefExtensions[type] = value
Пример #2
0
 def __init__(self):
     global DefExtensions
     self._advUI = Persistent('P_RecurAdd_AdvUI', '1', 0)
     self._ExtVals = {}
     for type, valname in [('b', 'P_RecurAdd_BExts'), \
                           ('u', 'P_RecurAdd_UExts'), \
                           ('o', 'P_RecurAdd_OExts'), \
                           ('i', 'P_RecurAdd_IExts')]:
         self._ExtVals[type] = Persistent(valname,
                                          string.join(DefExtensions[type]),
                                          0)
         DefExtensions[type] = self._ExtVals[type].GetValue().split()
Пример #3
0
 def Checkout(self, event=None):
     idx, module, prefix = self.GetSelection()
     cvs = Cvs(0, 0)
     cwdbup = os.getcwd()
     try:
         dlgTitle = 'Checkout module ' + module
         answer, targetDir = App.CvsPrompt(cwdbup,
                                           'Question',
                                           'Checkout to:',
                                           alertTitle=dlgTitle)
         if answer == 'IDOK':
             p_args = Persistent('PY_RListCOArgs', '', 1)
             answer, args = App.CvsPrompt(str(p_args),
                                          'Question',
                                          'Additional Checkout arguments:',
                                          alertTitle=dlgTitle)
             if answer == 'IDOK':
                 p_args << args
                 args = string.split(args)
                 args.append(module)
                 os.chdir(targetDir)
                 args = ['-q', 'checkout'] + args
                 if self.cvsroot.get():
                     args.insert(0, '-d' + self.cvsroot.get())
                 print 'cvs %s (in %s)' % (string.join(args), os.getcwd())
                 cvs.Run(*args)
     finally:
         os.chdir(cwdbup)
         self.master.destroy()
Пример #4
0
 def Run(self):
     dlgTitle = 'Build ChangeLog'
     basedir = os.getcwd()
     croot = self.readFile(os.path.join(basedir, 'CVS', 'Root'))
     answer, cvsroot = App.CvsPrompt(croot, 'Question', 'Enter CVSROOT.', \
                                     alertTitle=dlgTitle)
     if answer == 'IDOK':
         if croot == cvsroot:
             module = self.readFile(
                 os.path.join(basedir, 'CVS', 'Repository'))
         else:
             module = os.path.basename(basedir)
         answer, module = App.CvsPrompt(module, 'Question', 'Enter module to log.', \
                                        alertTitle=dlgTitle)
         if answer == 'IDOK':
             answer, filename = App.CvsPrompt(os.path.basename(module)+'.log', \
                                              'Question', 'Enter logfile name.', \
                                              '(will be created in "%s")' % basedir,\
                                              alertTitle=dlgTitle)
             if answer == 'IDOK':
                 extargsVal = Persistent('PY_ChangeRlogExtArgs',
                                         defaultExtArgs, 0)
                 answer, extargs = App.CvsPrompt(str(extargsVal), 'Question', \
                                                 'Enter extended log options (optional)', \
                                                 'Examples:\n'\
                                                 '-w\n\tonly lists own changes\n\n'\
                                                 '-rBRANCH,FROMTAG:TOTAG\n\tlists changes between tags on branch\n\n'\
                                                 '-d2004-01-01<2003-12-31\n\tall changes of 2004\n',\
                                                 alertTitle=dlgTitle)
                 if answer == 'IDOK':
                     extargsVal << extargs
                     args = [module]
                     ChangeLogger(basedir, string.split(extargs+' ') + args, filename, \
                                  'rlog', cvsroot)
Пример #5
0
        def diffFile(self, filetopatch, branch):
                self.loggreen("%s to branch %s" % (filetopatch.GetName(), branch))
             
                
                path=filetopatch.GetFullName()
                index = path.find("eTenderSuite")
                if index == -1:
                        msg = "Wrong file: %s cancel?" % filetopatch
                        title = "Cancel?"
                        if cvsgui.App.CvsAlert('Question', msg, 'Yes', 'No', '', '', title) != 'IDOK':
                                return
                        
                endindex = path.find("\\",index+1,len(path))
                oldetenderSuit = path[index:endindex]
                newpath= path.replace(oldetenderSuit,branch)

                if os.path.exists(newpath):
                                #diff
                        p_extdiff = Persistent('P_Extdiff', '', 0)
                        extdiff = str(p_extdiff)
                        args = ['"%s"' % newpath, '"%s"' % path]
                        args.insert(0, '"%s"' % extdiff)
                                
                        self.loggreen("try diff %s : %s -------> %s" % (extdiff, path, newpath))

                        if extdiff <> '' and os.path.exists(extdiff):
                               os.spawnl(os.P_NOWAIT, extdiff, *args)
                               time.sleep(0.5)

                        else:
                                self.logerror("External diff tool not found: %s" %extdiff)        
        
                else:
                        self.logerror("Other file does not exist: %s" %newpath)        
Пример #6
0
  def Run(self):
    basedir, module = os.path.split(self.dir)
    console = ColorConsole()
    if os.path.exists(os.path.join(basedir, 'CVS')):
      console << kRed << 'Parent directory may not be CVS-controlled!\n' << kNormal
      return
    msg = 'Enter the CVSROOT of the repository you wish to add the new root module "%s" to!' % module
    title = 'Add Root Module'
    answer, root = App.CvsPrompt(str(Persistent('P_CVSROOT', '', 0)), 'Question', msg, alertTitle=title)
    if not (answer=='IDOK' and len(root)>0):
      print 'Operation cancelled by user.'
      return
    
    os.chdir(basedir)
    cvs = Cvs(1,0)
    print 'Preparing sandbox...'
    if not self.runCvs(cvs, console, '-d'+root, 'co', '-l', '.'):
      return

    print 'Creating new module %s/%s...' % (root, module)
    if not self.runCvs(cvs, console, 'add', module):
      return

    print 'Cleaning up...'
    shutil.rmtree(os.path.join(basedir, 'CVS'))

    print 'Done.'
Пример #7
0
 def Run(self):
     args = []
     basedir = prepareTargets(self.sel, args, 0)
     lognameVal = Persistent('PY_ChangelogLogName', defaultLogName, 1)
     answer, logname = App.CvsPrompt(str(lognameVal), 'Question', 'Enter Logfile name.', \
                                     '(will be created in "%s")' % basedir,\
                                     alertTitle='Build ChangeLog')
     if answer == 'IDOK':
         extargsVal = Persistent('PY_ChangelogExtArgs', defaultExtArgs,
                                 1)
         answer, extargs = App.CvsPrompt(str(extargsVal), 'Question', 'Extended log options', \
                                         'Examples:\n'\
                                        +'-w\n\tonly lists own changes\n\n'\
                                        +'-rBRANCH,FROMTAG:TOTAG\n\tlists changes between tags on branch\n\n'\
                                        +'-d2003-01-01<2003-12-31\n\tall changes of 2003\n',\
                                         alertTitle='Build ChangeLog')
         if answer == 'IDOK':
             if len(logname) > 0:
                 lognameVal << logname
             else:
                 sys.stderr.write('Must specify a file name!\n')
                 return
             extargsVal << extargs
             ChangeLogger(basedir, extargs.split() + args, logname)
Пример #8
0
        def startPatch(self, template=''):
                self.files = App.GetSelection()
                count = 1
                lastBranch = Persistent("PY_BRANCH", "eTenderSuite_TRUNK, eTenderSuite_5_8", 1)
                
                answer, branch_input = App.CvsPrompt(str(lastBranch), 'Question',
                                   'Enter the name(s) of the branch(es) to diff the ' \
                                  +'current selection to (Comma separated).',
                                   alertTitle='Copy to branch/trunk')
                lastBranch << branch_input

                branches = csv.reader([branch_input], skipinitialspace=True)
                for branch in branches:
                        for b in branch:
                                if answer=='IDOK':
                                        for entry in self.files:
                                            if entry.IsFile():
                                                self.loggreen ("------------------------------------------------------- %s / %s (%s) -----------------------------------------------------------------------" %(count,len(self.files), entry.GetName()))
                                                if os.path.exists(entry.GetFullName()):
                                                        self.diffFile(entry, b)
                                                else:
                                                        self.logerror("source file does not exist")
                                                count +=1
Пример #9
0
    def Run(self):
        """ Runs a CVS command on all selected items """
        sel = App.GetSelection()
        searchVal = Persistent('PY_LogCommentSearchExpr', '', 1)
        answer, search = App.CvsPrompt(str(searchVal), 'Question', 'Enter search term.', \
                                       '(multi-line, case-insensitive regular expression)', \
                                       alertTitle='Locate in Log comments')
        if answer != 'IDOK': return
        searchVal << search

        cwdbup = os.getcwd()
        try:
            cvs = Cvs(1, 0)
            targets = []
            prepareTargets(sel, targets)
            print 'Fetching log...'
            code, out, err = cvs.Run('log', *targets)
            if code == 0:
                self.searchLog(out, search, ColorConsole())
                print '\nDone.'
            else:
                cvs_err(err)
        finally:
            os.chdir(cwdbup)
Пример #10
0
    def __init__(self):
        Macro.__init__(self, "Config ViewCVS", MACRO_SELECTION, 0, "ViewCVS")

        self.m_cvsView = Persistent(
            "PY_CVSVIEW", "http://cvs.sourceforge.net/viewcvs.py/cvsgui/", 1)
Пример #11
0
 def __init__(self):
     self.root = Persistent('P_RListRoot', '', 1)
     self.module = Persistent('P_RListModule', '.', 1)
     self.rev = Persistent('P_RListRevision', 'HEAD', 1)
Пример #12
0
 def __init__(self):
     Macro.__init__( self, 'Browse Repository Folders...',\
                     MACRO_ADMIN, 0)
     self.p_root = Persistent('P_RListRoot', defaultRepo, 1)
Пример #13
0
        if result:
            for entry in self.sel:
                result = (not entry.IsUnknown())
                if result:
                    break
        return result

    def getArgs(self):
        #TODO: - query for revisions,
        #      - use update -p to save revisions to temp files
        #      - return paths of above temp files
        pass


try:
    try:
        p_extdiff = Persistent('P_Extdiff', '', 0)
        extdiff = str(p_extdiff)
        if extdiff <> '' and os.path.exists(extdiff):
            ExtDiffFiles(extdiff)
            #ExtDiffRevs(extdiff)
            #print 'External Diff:', extdiff
        #else:
        #print 'Could not determine valid external diff!'
    finally:
        del p_extdiff
        del extdiff
except:
    pass
    #raise