bug 440001 - source server support for mercurial. r=ted

This commit is contained in:
Jesse Valianes 2008-12-19 11:04:50 -05:00
Родитель 281ac7d485
Коммит a48e774187
1 изменённых файлов: 19 добавлений и 20 удалений

Просмотреть файл

@ -351,8 +351,6 @@ def GetVCSFilename(file, srcdir):
else:
if os.path.isdir(os.path.join(path, "CVS")):
fileInfo = CVSFileInfo(file, srcdir)
if fileInfo:
root = fileInfo.root
elif os.path.isdir(os.path.join(path, ".svn")) or \
os.path.isdir(os.path.join(path, "_svn")):
fileInfo = SVNFileInfo(file);
@ -363,6 +361,7 @@ def GetVCSFilename(file, srcdir):
if fileInfo:
file = fileInfo.filename
root = fileInfo.root
# we want forward slashes on win32 paths
return (file.replace("\\", "/"), root)
@ -376,15 +375,15 @@ def GetPlatformSpecificDumper(**kwargs):
'sunos5': Dumper_Solaris,
'darwin': Dumper_Mac}[sys.platform](**kwargs)
def SourceIndex(fileStream, outputPath, cvs_root):
def SourceIndex(fileStream, outputPath, vcs_root):
"""Takes a list of files, writes info to a data block in a .stream file"""
# Creates a .pdb.stream file in the mozilla\objdir to be used for source indexing
# Create the srcsrv data block that indexes the pdb file
result = True
pdbStreamFile = open(outputPath, "w")
pdbStreamFile.write('''SRCSRV: ini ------------------------------------------------\r\nVERSION=1\r\nSRCSRV: variables ------------------------------------------\r\nCVS_EXTRACT_CMD=%fnchdir%(%targ%)cvs.exe -d %fnvar%(%var2%) checkout -r %var4% -d %var4% -N %var3%\r\nMYSERVER=''')
pdbStreamFile.write(cvs_root)
pdbStreamFile.write('''\r\nSRCSRVTRG=%targ%\%var4%\%fnbksl%(%var3%)\r\nSRCSRVCMD=%CVS_EXTRACT_CMD%\r\nSRCSRV: source files ---------------------------------------\r\n''')
pdbStreamFile.write('''SRCSRV: ini ------------------------------------------------\r\nVERSION=2\r\nINDEXVERSION=2\r\nVERCTRL=http\r\nSRCSRV: variables ------------------------------------------\r\nHGSERVER=''')
pdbStreamFile.write(vcs_root)
pdbStreamFile.write('''\r\nSRCSRVVERCTRL=http\r\nHTTP_EXTRACT_TARGET=%hgserver%/raw-file/%var3%/%var2%\r\nSRCSRVTRG=%http_extract_target%\r\nSRCSRV: source files ---------------------------------------\r\n''')
pdbStreamFile.write(fileStream) # can't do string interpolation because the source server also uses this and so there are % in the above
pdbStreamFile.write("SRCSRV: end ------------------------------------------------\r\n\n")
pdbStreamFile.close()
@ -445,7 +444,7 @@ class Dumper:
return file
# This is a no-op except on Win32
def SourceServerIndexing(self, debug_file, guid, sourceFileStream, cvs_root):
def SourceServerIndexing(self, debug_file, guid, sourceFileStream, vcs_root):
return ""
# subclasses override this if they want to support this
@ -481,9 +480,9 @@ class Dumper:
in the proper directory structure in |symbol_path|."""
result = False
sourceFileStream = ''
# tries to get cvsroot from the .mozconfig first - if it's not set
# the tinderbox cvs_path will be assigned further down
cvs_root = os.environ.get("SRCSRV_ROOT")
# tries to get the vcs root from the .mozconfig first - if it's not set
# the tinderbox vcs path will be assigned further down
vcs_root = os.environ.get("SRCSRV_ROOT")
for arch in self.archs:
try:
cmd = os.popen("%s %s %s" % (self.dump_syms, arch, file), "r")
@ -519,14 +518,14 @@ class Dumper:
sourcepath = filename
if self.vcsinfo:
(filename, rootname) = GetVCSFilename(filename, self.srcdir)
# sets cvs_root in case the loop through files were to end on an empty rootname
if cvs_root is None:
# sets vcs_root in case the loop through files were to end on an empty rootname
if vcs_root is None:
if rootname:
cvs_root = rootname
# gather up files with cvs for indexing
if filename.startswith("cvs"):
vcs_root = rootname
# gather up files with hg for indexing
if filename.startswith("hg"):
(ver, checkout, source_file, revision) = filename.split(":", 3)
sourceFileStream += sourcepath + "*MYSERVER*" + source_file + '*' + revision + "\r\n"
sourceFileStream += sourcepath + "*" + source_file + '*' + revision + "\r\n"
f.write("FILE %s %s\n" % (index, filename))
else:
# pass through all other lines unchanged
@ -538,9 +537,9 @@ class Dumper:
print rel_path
if self.copy_debug:
self.CopyDebug(file, debug_file, guid)
if self.srcsrv:
if self.srcsrv and vcs_root:
# Call on SourceServerIndexing
result = self.SourceServerIndexing(debug_file, guid, sourceFileStream, cvs_root)
result = self.SourceServerIndexing(debug_file, guid, sourceFileStream, vcs_root)
result = True
except StopIteration:
pass
@ -597,13 +596,13 @@ class Dumper_Win32(Dumper):
shutil.copyfile(file, full_path)
pass
def SourceServerIndexing(self, debug_file, guid, sourceFileStream, cvs_root):
def SourceServerIndexing(self, debug_file, guid, sourceFileStream, vcs_root):
# Creates a .pdb.stream file in the mozilla\objdir to be used for source indexing
cwd = os.getcwd()
streamFilename = debug_file + ".stream"
stream_output_path = os.path.join(cwd, streamFilename)
# Call SourceIndex to create the .stream file
result = SourceIndex(sourceFileStream, stream_output_path, cvs_root)
result = SourceIndex(sourceFileStream, stream_output_path, vcs_root)
if self.copy_debug:
pdbstr_path = os.environ.get("PDBSTR_PATH")