-##############################
- def do_version (self):
- self.init_module_dir()
- self.init_edge_dir()
- self.revert_edge_dir()
- self.update_edge_dir()
- spec_dict = self.spec_dict()
- if self.options.www:
- self.html_store_title('Version for module %s (%s)' % (self.friendly_name(),self.last_tag(spec_dict)))
- for varname in self.varnames:
- if not spec_dict.has_key(varname):
- self.html_print ('Could not find %%define for %s'%varname)
- return
- else:
- self.html_print ("%-16s %s"%(varname,spec_dict[varname]))
- if self.options.show_urls:
- self.html_print ("%-16s %s"%('edge url',self.edge_url()))
- self.html_print ("%-16s %s"%('latest tag url',self.tag_url(spec_dict)))
- if self.options.verbose:
- self.html_print ("%-16s %s"%('main specfile:',self.main_specname()))
- self.html_print ("%-16s %s"%('specfiles:',self.all_specnames()))
- self.html_print_end()
-
-##############################
- def do_list (self):
-# print 'verbose',self.options.verbose
-# print 'list_tags',self.options.list_tags
-# print 'list_branches',self.options.list_branches
-# print 'all_modules',self.options.all_modules
-
- (verbose,branches,pattern,exact) = (self.options.verbose,self.options.list_branches,
- self.options.list_pattern,self.options.list_exact)
-
- extra_command=""
- extra_message=""
- if hasattr(self,'branch'):
- pattern=self.branch
- if pattern or exact:
- if exact:
- if verbose: grep="%s/$"%exact
- else: grep="^%s$"%exact
- else:
- grep=pattern
- extra_command=" | grep %s"%grep
- extra_message=" matching %s"%grep
-
- if not branches:
- message="==================== tags for %s"%self.friendly_name()
- command="svn list "
- if verbose: command+="--verbose "
- command += "%s/tags"%self.mod_url()
- command += extra_command
- message += extra_message
- if verbose: print message
- self.run(command)
-
- else:
- message="==================== branches for %s"%self.friendly_name()
- command="svn list "
- if verbose: command+="--verbose "
- command += "%s/branches"%self.mod_url()
- command += extra_command
- message += extra_message
- if verbose: print message
- self.run(command)
-
-##############################
- sync_warning="""*** WARNING
-The module-sync function has the following limitations
-* it does not handle changelogs
-* it does not scan the -tags*.mk files to adopt the new tags"""
-
- def do_sync(self):
- if self.options.verbose:
- print Module.sync_warning
- if not prompt('Want to proceed anyway'):
- return
-
- self.init_module_dir()
- self.init_edge_dir()
- self.revert_edge_dir()
- self.update_edge_dir()
- spec_dict = self.spec_dict()
-
- edge_url=self.edge_url()
- tag_name=self.tag_name(spec_dict)
- tag_url=self.tag_url(spec_dict)
- # check the tag does not exist yet
- self.check_svnpath_not_exists(tag_url,"new tag")
-
- if self.options.message:
- svnopt='--message "%s"'%self.options.message
- else:
- svnopt='--editor-cmd=%s'%self.options.editor
- self.run_prompt("Create initial tag",
- "svn copy %s %s %s"%(svnopt,edge_url,tag_url))
-
-##############################
- def do_diff (self,compute_only=False):
- self.init_module_dir()
- self.init_edge_dir()
- self.revert_edge_dir()
- self.update_edge_dir()
- spec_dict = self.spec_dict()
- self.show_dict(spec_dict)
-
- edge_url=self.edge_url()
- tag_url=self.tag_url(spec_dict)
- self.check_svnpath_exists(edge_url,"edge track")
- self.check_svnpath_exists(tag_url,"latest tag")
- command="svn diff %s %s"%(tag_url,edge_url)
- if compute_only:
- if self.options.verbose:
- print 'Getting diff with %s'%command
- diff_output = Command(command,self.options).output_of()
- # if used as a utility
- if compute_only:
- return (spec_dict,edge_url,tag_url,diff_output)
- # otherwise print the result
- if self.options.list:
- if diff_output:
- print self.name
- else:
- thename=self.friendly_name()
- do_print=False
- if self.options.www and diff_output:
- self.html_store_title("Diffs in module %s (%s) : %d chars"%(\
- thename,self.last_tag(spec_dict),len(diff_output)))
- link=self.html_href(tag_url,tag_url)
- self.html_store_raw ('<p> < (left) %s </p>'%link)
- link=self.html_href(edge_url,edge_url)
- self.html_store_raw ('<p> > (right) %s </p>'%link)
- self.html_store_pre (diff_output)
- elif not self.options.www:
- print 'x'*30,'module',thename
- print 'x'*20,'<',tag_url
- print 'x'*20,'>',edge_url
- print diff_output