proxygen
release_docs.WikiBrancher Class Reference
Inheritance diagram for release_docs.WikiBrancher:

Public Member Functions

def __init__ (self, dot_version)
 
def GetFilesToBranch (self)
 
def BranchFiles (self)
 
def UpdateLinksInBranchedFiles (self)
 
def __init__ (self, dot_version)
 
def GetFilesToBranch (self)
 
def BranchFiles (self)
 
def UpdateLinksInBranchedFiles (self)
 
def __init__ (self, dot_version)
 
def GetFilesToBranch (self)
 
def BranchFiles (self)
 
def UpdateLinksInBranchedFiles (self)
 

Public Attributes

 wiki_dir
 
 version_prefix
 
 files_to_branch
 
 search_for_re
 
 replace_with
 
 project
 

Detailed Description

Branches ...

Definition at line 89 of file release_docs.py.

Constructor & Destructor Documentation

def release_docs.WikiBrancher.__init__ (   self,
  dot_version 
)

Definition at line 92 of file release_docs.py.

References common.GetSvnInfo(), and release_docs.WikiBrancher.project.

Referenced by release_docs.WikiBrancher.__init__().

92  def __init__(self, dot_version):
93  self.project, svn_root_path = common.GetSvnInfo()
94  if self.project not in ('googletest', 'googlemock'):
95  sys.exit('This script must be run in a gtest or gmock SVN workspace.')
96  self.wiki_dir = svn_root_path + '/wiki'
97  # Turn '2.6' to 'V2_6_'.
98  self.version_prefix = 'V' + dot_version.replace('.', '_') + '_'
100  page_names = [DropWikiSuffix(f) for f in self.files_to_branch]
101  # A link to Foo.wiki is in one of the following forms:
102  # [Foo words]
103  # [Foo#Anchor words]
104  # [http://code.google.com/.../wiki/Foo words]
105  # [http://code.google.com/.../wiki/Foo#Anchor words]
106  # We want to replace 'Foo' with 'V2_6_Foo' in the above cases.
107  self.search_for_re = re.compile(
108  # This regex matches either
109  # [Foo
110  # or
111  # /wiki/Foo
112  # followed by a space or a #, where Foo is the name of an
113  # unversioned wiki page.
114  r'(\[|/wiki/)(%s)([ #])' % '|'.join(page_names))
115  self.replace_with = r'\1%s\2\3' % (self.version_prefix,)
116 
def __init__(self, dot_version)
Definition: release_docs.py:92
def GetSvnInfo()
Definition: common.py:55
def DropWikiSuffix(wiki_filename)
Definition: release_docs.py:82
#define join
def release_docs.WikiBrancher.__init__ (   self,
  dot_version 
)

Definition at line 92 of file release_docs.py.

References release_docs.WikiBrancher.__init__(), release_docs.DropWikiSuffix(), release_docs.WikiBrancher.files_to_branch, release_docs.WikiBrancher.GetFilesToBranch(), common.GetSvnInfo(), join, release_docs.WikiBrancher.project, release_docs.WikiBrancher.replace_with, release_docs.WikiBrancher.search_for_re, release_docs.WikiBrancher.version_prefix, and release_docs.WikiBrancher.wiki_dir.

92  def __init__(self, dot_version):
93  self.project, svn_root_path = common.GetSvnInfo()
94  if self.project not in ('googletest', 'googlemock'):
95  sys.exit('This script must be run in a gtest or gmock SVN workspace.')
96  self.wiki_dir = svn_root_path + '/wiki'
97  # Turn '2.6' to 'V2_6_'.
98  self.version_prefix = 'V' + dot_version.replace('.', '_') + '_'
99  self.files_to_branch = self.GetFilesToBranch()
100  page_names = [DropWikiSuffix(f) for f in self.files_to_branch]
101  # A link to Foo.wiki is in one of the following forms:
102  # [Foo words]
103  # [Foo#Anchor words]
104  # [http://code.google.com/.../wiki/Foo words]
105  # [http://code.google.com/.../wiki/Foo#Anchor words]
106  # We want to replace 'Foo' with 'V2_6_Foo' in the above cases.
107  self.search_for_re = re.compile(
108  # This regex matches either
109  # [Foo
110  # or
111  # /wiki/Foo
112  # followed by a space or a #, where Foo is the name of an
113  # unversioned wiki page.
114  r'(\[|/wiki/)(%s)([ #])' % '|'.join(page_names))
115  self.replace_with = r'\1%s\2\3' % (self.version_prefix,)
116 
def __init__(self, dot_version)
Definition: release_docs.py:92
def GetSvnInfo()
Definition: common.py:55
def DropWikiSuffix(wiki_filename)
Definition: release_docs.py:82
#define join
def release_docs.WikiBrancher.__init__ (   self,
  dot_version 
)

Definition at line 92 of file release_docs.py.

References release_docs.WikiBrancher.__init__(), release_docs.DropWikiSuffix(), release_docs.WikiBrancher.files_to_branch, release_docs.WikiBrancher.GetFilesToBranch(), common.GetSvnInfo(), join, release_docs.WikiBrancher.project, release_docs.WikiBrancher.replace_with, release_docs.WikiBrancher.search_for_re, release_docs.WikiBrancher.version_prefix, and release_docs.WikiBrancher.wiki_dir.

92  def __init__(self, dot_version):
93  self.project, svn_root_path = common.GetSvnInfo()
94  if self.project not in ('googletest', 'googlemock'):
95  sys.exit('This script must be run in a gtest or gmock SVN workspace.')
96  self.wiki_dir = svn_root_path + '/wiki'
97  # Turn '2.6' to 'V2_6_'.
98  self.version_prefix = 'V' + dot_version.replace('.', '_') + '_'
99  self.files_to_branch = self.GetFilesToBranch()
100  page_names = [DropWikiSuffix(f) for f in self.files_to_branch]
101  # A link to Foo.wiki is in one of the following forms:
102  # [Foo words]
103  # [Foo#Anchor words]
104  # [http://code.google.com/.../wiki/Foo words]
105  # [http://code.google.com/.../wiki/Foo#Anchor words]
106  # We want to replace 'Foo' with 'V2_6_Foo' in the above cases.
107  self.search_for_re = re.compile(
108  # This regex matches either
109  # [Foo
110  # or
111  # /wiki/Foo
112  # followed by a space or a #, where Foo is the name of an
113  # unversioned wiki page.
114  r'(\[|/wiki/)(%s)([ #])' % '|'.join(page_names))
115  self.replace_with = r'\1%s\2\3' % (self.version_prefix,)
116 
def __init__(self, dot_version)
Definition: release_docs.py:92
def GetSvnInfo()
Definition: common.py:55
def DropWikiSuffix(wiki_filename)
Definition: release_docs.py:82
#define join

Member Function Documentation

def release_docs.WikiBrancher.BranchFiles (   self)
Branches the .wiki files needed to be branched.

Definition at line 127 of file release_docs.py.

References release_docs.WikiBrancher.files_to_branch, release_docs.WikiBrancher.version_prefix, and release_docs.WikiBrancher.wiki_dir.

Referenced by release_docs.WikiBrancher.BranchFiles().

127  def BranchFiles(self):
128  """Branches the .wiki files needed to be branched."""
129 
130  print 'Branching %d .wiki files:' % (len(self.files_to_branch),)
131  os.chdir(self.wiki_dir)
132  for f in self.files_to_branch:
133  command = 'svn cp %s %s%s' % (f, self.version_prefix, f)
134  print command
135  os.system(command)
136 
def release_docs.WikiBrancher.BranchFiles (   self)
Branches the .wiki files needed to be branched.

Definition at line 127 of file release_docs.py.

References release_docs.WikiBrancher.BranchFiles(), release_docs.WikiBrancher.files_to_branch, release_docs.WikiBrancher.version_prefix, and release_docs.WikiBrancher.wiki_dir.

127  def BranchFiles(self):
128  """Branches the .wiki files needed to be branched."""
129 
130  print 'Branching %d .wiki files:' % (len(self.files_to_branch),)
131  os.chdir(self.wiki_dir)
132  for f in self.files_to_branch:
133  command = 'svn cp %s %s%s' % (f, self.version_prefix, f)
134  print command
135  os.system(command)
136 
def release_docs.WikiBrancher.BranchFiles (   self)
Branches the .wiki files needed to be branched.

Definition at line 127 of file release_docs.py.

References release_docs.WikiBrancher.BranchFiles(), release_docs.WikiBrancher.files_to_branch, release_docs.WikiBrancher.version_prefix, and release_docs.WikiBrancher.wiki_dir.

127  def BranchFiles(self):
128  """Branches the .wiki files needed to be branched."""
129 
130  print 'Branching %d .wiki files:' % (len(self.files_to_branch),)
131  os.chdir(self.wiki_dir)
132  for f in self.files_to_branch:
133  command = 'svn cp %s %s%s' % (f, self.version_prefix, f)
134  print command
135  os.system(command)
136 
def release_docs.WikiBrancher.GetFilesToBranch (   self)
Returns a list of .wiki file names that need to be branched.

Definition at line 117 of file release_docs.py.

References release_docs.WikiBrancher.GetFilesToBranch(), release_docs.WikiBrancher.project, and release_docs.WikiBrancher.wiki_dir.

117  def GetFilesToBranch(self):
118  """Returns a list of .wiki file names that need to be branched."""
119 
120  unversioned_wikis = (GTEST_UNVERSIONED_WIKIS if self.project == 'googletest'
121  else GMOCK_UNVERSIONED_WIKIS)
122  return [f for f in os.listdir(self.wiki_dir)
123  if (f.endswith('.wiki') and
124  not re.match(r'^V\d', f) and # Excluded versioned .wiki files.
125  f not in unversioned_wikis)]
126 
def release_docs.WikiBrancher.GetFilesToBranch (   self)
Returns a list of .wiki file names that need to be branched.

Definition at line 117 of file release_docs.py.

Referenced by release_docs.WikiBrancher.__init__(), and release_docs.WikiBrancher.GetFilesToBranch().

117  def GetFilesToBranch(self):
118  """Returns a list of .wiki file names that need to be branched."""
119 
120  unversioned_wikis = (GTEST_UNVERSIONED_WIKIS if self.project == 'googletest'
121  else GMOCK_UNVERSIONED_WIKIS)
122  return [f for f in os.listdir(self.wiki_dir)
123  if (f.endswith('.wiki') and
124  not re.match(r'^V\d', f) and # Excluded versioned .wiki files.
125  f not in unversioned_wikis)]
126 
def release_docs.WikiBrancher.GetFilesToBranch (   self)
Returns a list of .wiki file names that need to be branched.

Definition at line 117 of file release_docs.py.

References release_docs.WikiBrancher.GetFilesToBranch(), release_docs.WikiBrancher.project, and release_docs.WikiBrancher.wiki_dir.

117  def GetFilesToBranch(self):
118  """Returns a list of .wiki file names that need to be branched."""
119 
120  unversioned_wikis = (GTEST_UNVERSIONED_WIKIS if self.project == 'googletest'
121  else GMOCK_UNVERSIONED_WIKIS)
122  return [f for f in os.listdir(self.wiki_dir)
123  if (f.endswith('.wiki') and
124  not re.match(r'^V\d', f) and # Excluded versioned .wiki files.
125  f not in unversioned_wikis)]
126 
def release_docs.WikiBrancher.UpdateLinksInBranchedFiles (   self)

Definition at line 137 of file release_docs.py.

References release_docs.WikiBrancher.files_to_branch, release_docs.main(), release_docs.WikiBrancher.replace_with, release_docs.WikiBrancher.UpdateLinksInBranchedFiles(), release_docs.WikiBrancher.version_prefix, release_docs.WikiBrancher.wiki_dir, and fizz::detail.write().

138 
139  for f in self.files_to_branch:
140  source_file = os.path.join(self.wiki_dir, f)
141  versioned_file = os.path.join(self.wiki_dir, self.version_prefix + f)
142  print 'Updating links in %s.' % (versioned_file,)
143  text = file(source_file, 'r').read()
144  new_text = self.search_for_re.sub(self.replace_with, text)
145  file(versioned_file, 'w').write(new_text)
146 
147 
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
def UpdateLinksInBranchedFiles(self)
def release_docs.WikiBrancher.UpdateLinksInBranchedFiles (   self)

Definition at line 137 of file release_docs.py.

References release_docs.WikiBrancher.files_to_branch, release_docs.WikiBrancher.replace_with, release_docs.WikiBrancher.version_prefix, release_docs.WikiBrancher.wiki_dir, and fizz::detail.write().

Referenced by release_docs.WikiBrancher.UpdateLinksInBranchedFiles().

138 
139  for f in self.files_to_branch:
140  source_file = os.path.join(self.wiki_dir, f)
141  versioned_file = os.path.join(self.wiki_dir, self.version_prefix + f)
142  print 'Updating links in %s.' % (versioned_file,)
143  text = file(source_file, 'r').read()
144  new_text = self.search_for_re.sub(self.replace_with, text)
145  file(versioned_file, 'w').write(new_text)
146 
147 
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
def UpdateLinksInBranchedFiles(self)
def release_docs.WikiBrancher.UpdateLinksInBranchedFiles (   self)

Definition at line 137 of file release_docs.py.

References release_docs.WikiBrancher.files_to_branch, release_docs.main(), release_docs.WikiBrancher.replace_with, release_docs.WikiBrancher.UpdateLinksInBranchedFiles(), release_docs.WikiBrancher.version_prefix, release_docs.WikiBrancher.wiki_dir, and fizz::detail.write().

138 
139  for f in self.files_to_branch:
140  source_file = os.path.join(self.wiki_dir, f)
141  versioned_file = os.path.join(self.wiki_dir, self.version_prefix + f)
142  print 'Updating links in %s.' % (versioned_file,)
143  text = file(source_file, 'r').read()
144  new_text = self.search_for_re.sub(self.replace_with, text)
145  file(versioned_file, 'w').write(new_text)
146 
147 
void write(const T &in, folly::io::Appender &appender)
Definition: Types-inl.h:112
def UpdateLinksInBranchedFiles(self)

Member Data Documentation

release_docs.WikiBrancher.project
release_docs.WikiBrancher.replace_with
release_docs.WikiBrancher.search_for_re

Definition at line 107 of file release_docs.py.

Referenced by release_docs.WikiBrancher.__init__().


The documentation for this class was generated from the following file: