Merge branch 'master' of ssh://git.onelab.eu/git/build
[build.git] / module-tools.py
index fc2598e..1afe04e 100755 (executable)
@@ -259,14 +259,14 @@ class GitRepository:
         return os.path.basename(self.path)
 
     def url(self):
-        self.repo_root()
+        return self.repo_root()
 
     def repo_root(self):
         c = Command("git remote show origin", self.options)
         out = self.__run_in_repo(c.output_of)
         for line in out.split('\n'):
             if line.strip().startswith("Fetch URL:"):
-                repo = line.split()[2]
+                return line.split()[2]
 
     @classmethod
     def checkout(cls, remote, local, options, depth=0):
@@ -344,7 +344,7 @@ class GitRepository:
         self.__run_command_in_repo("git add .", ignore_errors=True)
         self.__run_command_in_repo("git add -u", ignore_errors=True)
         self.__run_command_in_repo("git commit -F  %s" % logfile, ignore_errors=True)
-        if branch == "master":
+        if branch == "master" or self.__is_commit_id(branch):
             self.__run_command_in_repo("git push")
         else:
             self.__run_command_in_repo("git push origin %s:%s" % (branch, branch))
@@ -838,17 +838,17 @@ that for other purposes than tagging""" % options.workdir
         else:
             if self.options.verbose:
                 print 'Searching for -SVNPATH or -GITPATH lines referring to /%s/\n\tin %s .. '%(self.name,tagsfile),
-            pattern="\A\s*(?P<make_name>[^\s]+)-(SVNPATH|GITPATH)\s*(=|:=)\s*(?P<url_main>[^\s]+)/%s[^\s]+"\
-                                          %(self.name)
+            pattern="\A\s*%s-(SVNPATH|GITPATH)\s*(=|:=)\s*(?P<url_main>[^\s]+)/%s[^\s]+"\
+                                          %(self.name,self.name)
             matcher_module=re.compile(pattern)
             for line in tags.readlines():
                 attempt=matcher_module.match(line)
                 if attempt:
                     if line.find("-GITPATH") >= 0:
-                        modulepath = "%s-GITPATH"%(attempt.group('make_name'))
+                        modulepath = "%s-GITPATH"%self.name
                         replacement = "%-32s:= %s/%s.git@%s\n"%(modulepath,attempt.group('url_main'),self.name,newname)
                     else:
-                        modulepath = "%s-SVNPATH"%(attempt.group('make_name'))
+                        modulepath = "%s-SVNPATH"%self.name
                         replacement = "%-32s:= %s/%s/tags/%s\n"%(modulepath,attempt.group('url_main'),self.name,newname)
                     if self.options.verbose:
                         print ' ' + modulepath, 
@@ -988,7 +988,7 @@ Please write a changelog for this new tag in the section above
                     elif choice == 'f':
                         self.patch_tags_file(tagsfile,old_tag_name,new_tag_name,fine_grain=False)
                     elif choice == 'd':
-                        print build.diff(f=tagsfile)
+                        print build.diff(f=os.path.basename(tagsfile))
                     elif choice == 'r':
                         build.revert(f=tagsfile)
                     elif choice == 'c':
@@ -1045,6 +1045,7 @@ n: move to next file"""%locals()
                 return
             else:
                 self.html_print ("%-16s %s"%(varname,spec_dict[varname]))
+        self.html_print ("%-16s %s"%('url',self.repository.url()))
         if self.options.verbose:
             self.html_print ("%-16s %s"%('main specfile:',self.main_specname()))
             self.html_print ("%-16s %s"%('specfiles:',self.all_specnames()))