gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nicola...@apache.org
Subject cvs commit: jakarta-gump/python/gump update.py
Date Fri, 09 May 2003 10:37:58 GMT
nicolaken    2003/05/09 03:37:58

  Modified:    python/gump update.py
  Log:
  Refactored code in an update() method so it can be used by other modules
  
  Revision  Changes    Path
  1.5       +18 -15    jakarta-gump/python/gump/update.py
  
  Index: update.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/update.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- update.py	8 May 2003 06:35:41 -0000	1.4
  +++ update.py	9 May 2003 10:37:58 -0000	1.5
  @@ -61,7 +61,13 @@
   """
   Execute the appropriate cvs checkout or update commands
   """
  +import os
   
  +from gump import load
  +from gump.conf import *
  +from gump.model import Module,Repository
  +from fnmatch import fnmatch
  + 
   # password encryption table used by cvs
   shifts = [
       0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
  @@ -85,14 +91,7 @@
   def mangle(passwd):
     return 'A' +''.join(map(chr,[shifts[ord(c)] for c in str(passwd or '')]))
   
  -if __name__=='__main__':
  -  from gump import load
  -  from gump.conf import *
  -  from gump.model import Module,Repository
  -  from fnmatch import fnmatch
  -
  -  import os
  -
  +def update(workspace_path, project_name = 'all'):
     # read the list of cvs repositories that the user is already logged into
     password={}
     cvspassfile=os.path.expanduser(os.path.join('~','.cvspass'))
  @@ -103,14 +102,12 @@
       cvspass.close()
     except:
       pass
  -
  -  args = handleArgv(sys.argv)
     
     # load the workspace
  -  workspace=load(args[0])
  +  workspace=load(workspace_path)
   
     # determine which modules the user desires (wildcards are permitted)
  -  selected=args[1]
  +  selected=project_name
   
     # determine which modules are available
     modules=Module.list.keys()
  @@ -167,3 +164,9 @@
         print line
         sys.stdout.flush()
         line=stdout.read()
  +  
  +if __name__=='__main__':
  +
  +  args = handleArgv(sys.argv)
  +
  +  update(args[0], args[1])
  
  
  

Mime
View raw message