proxygen
upload.MercurialVCS Class Reference
Inheritance diagram for upload.MercurialVCS:
upload.VersionControlSystem upload.VersionControlSystem upload.VersionControlSystem upload.VersionControlSystem upload.VersionControlSystem upload.VersionControlSystem

Public Member Functions

def __init__ (self, options, repo_dir)
 
def GenerateDiff (self, extra_args)
 
def GetUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def __init__ (self, options, repo_dir)
 
def GenerateDiff (self, extra_args)
 
def GetUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def __init__ (self, options, repo_dir)
 
def GenerateDiff (self, extra_args)
 
def GetUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def __init__ (self, options, repo_dir)
 
def GenerateDiff (self, extra_args)
 
def GetUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def __init__ (self, options, repo_dir)
 
def GenerateDiff (self, extra_args)
 
def GetUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def __init__ (self, options, repo_dir)
 
def GenerateDiff (self, extra_args)
 
def GetUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
- Public Member Functions inherited from upload.VersionControlSystem
def __init__ (self, options)
 
def GenerateDiff (self, args)
 
def GetUnknownFiles (self)
 
def CheckForUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def GetBaseFiles (self, diff)
 
def UploadBaseFiles (self, issue, rpc_server, patch_list, patchset, options, files)
 
def IsImage (self, filename)
 
def __init__ (self, options)
 
def GenerateDiff (self, args)
 
def GetUnknownFiles (self)
 
def CheckForUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def GetBaseFiles (self, diff)
 
def UploadBaseFiles (self, issue, rpc_server, patch_list, patchset, options, files)
 
def IsImage (self, filename)
 
def __init__ (self, options)
 
def GenerateDiff (self, args)
 
def GetUnknownFiles (self)
 
def CheckForUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def GetBaseFiles (self, diff)
 
def UploadBaseFiles (self, issue, rpc_server, patch_list, patchset, options, files)
 
def IsImage (self, filename)
 
def __init__ (self, options)
 
def GenerateDiff (self, args)
 
def GetUnknownFiles (self)
 
def CheckForUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def GetBaseFiles (self, diff)
 
def UploadBaseFiles (self, issue, rpc_server, patch_list, patchset, options, files)
 
def IsImage (self, filename)
 
def __init__ (self, options)
 
def GenerateDiff (self, args)
 
def GetUnknownFiles (self)
 
def CheckForUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def GetBaseFiles (self, diff)
 
def UploadBaseFiles (self, issue, rpc_server, patch_list, patchset, options, files)
 
def IsImage (self, filename)
 
def __init__ (self, options)
 
def GenerateDiff (self, args)
 
def GetUnknownFiles (self)
 
def CheckForUnknownFiles (self)
 
def GetBaseFile (self, filename)
 
def GetBaseFiles (self, diff)
 
def UploadBaseFiles (self, issue, rpc_server, patch_list, patchset, options, files)
 
def IsImage (self, filename)
 

Public Attributes

 repo_dir
 
 subdir
 
 base_rev
 
- Public Attributes inherited from upload.VersionControlSystem
 options
 

Private Member Functions

def _GetRelPath (self, filename)
 
def _GetRelPath (self, filename)
 
def _GetRelPath (self, filename)
 
def _GetRelPath (self, filename)
 
def _GetRelPath (self, filename)
 
def _GetRelPath (self, filename)
 

Detailed Description

Implementation of the VersionControlSystem interface for Mercurial.

Definition at line 1042 of file upload.py.

Constructor & Destructor Documentation

def upload.MercurialVCS.__init__ (   self,
  options,
  repo_dir 
)

Definition at line 1045 of file upload.py.

Referenced by upload.MercurialVCS.__init__().

1045  def __init__(self, options, repo_dir):
1046  super(MercurialVCS, self).__init__(options)
1047  # Absolute path to repository (we can be in a subdir)
1048  self.repo_dir = os.path.normpath(repo_dir)
1049  # Compute the subdir
1050  cwd = os.path.normpath(os.getcwd())
1051  assert cwd.startswith(self.repo_dir)
1052  self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
1053  if self.options.revision:
1054  self.base_rev = self.options.revision
1055  else:
1056  self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
1057 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def __init__(self, options, repo_dir)
Definition: upload.py:1045
def upload.MercurialVCS.__init__ (   self,
  options,
  repo_dir 
)

Definition at line 1045 of file upload.py.

References upload.MercurialVCS.__init__(), upload.MercurialVCS.base_rev, upload.MercurialVCS.repo_dir, upload.RunShell(), folly::gen.split(), folly::detail::distributed_mutex.strip(), and upload.MercurialVCS.subdir.

1045  def __init__(self, options, repo_dir):
1046  super(MercurialVCS, self).__init__(options)
1047  # Absolute path to repository (we can be in a subdir)
1048  self.repo_dir = os.path.normpath(repo_dir)
1049  # Compute the subdir
1050  cwd = os.path.normpath(os.getcwd())
1051  assert cwd.startswith(self.repo_dir)
1052  self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
1053  if self.options.revision:
1054  self.base_rev = self.options.revision
1055  else:
1056  self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
1057 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def __init__(self, options, repo_dir)
Definition: upload.py:1045
def upload.MercurialVCS.__init__ (   self,
  options,
  repo_dir 
)

Definition at line 1045 of file upload.py.

References upload.MercurialVCS.__init__(), upload.MercurialVCS.base_rev, upload.MercurialVCS.repo_dir, upload.RunShell(), folly::gen.split(), folly::detail::distributed_mutex.strip(), and upload.MercurialVCS.subdir.

1045  def __init__(self, options, repo_dir):
1046  super(MercurialVCS, self).__init__(options)
1047  # Absolute path to repository (we can be in a subdir)
1048  self.repo_dir = os.path.normpath(repo_dir)
1049  # Compute the subdir
1050  cwd = os.path.normpath(os.getcwd())
1051  assert cwd.startswith(self.repo_dir)
1052  self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
1053  if self.options.revision:
1054  self.base_rev = self.options.revision
1055  else:
1056  self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
1057 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def __init__(self, options, repo_dir)
Definition: upload.py:1045
def upload.MercurialVCS.__init__ (   self,
  options,
  repo_dir 
)

Definition at line 1045 of file upload.py.

References upload.MercurialVCS.__init__(), upload.MercurialVCS.base_rev, upload.MercurialVCS.repo_dir, upload.RunShell(), folly::gen.split(), folly::detail::distributed_mutex.strip(), and upload.MercurialVCS.subdir.

1045  def __init__(self, options, repo_dir):
1046  super(MercurialVCS, self).__init__(options)
1047  # Absolute path to repository (we can be in a subdir)
1048  self.repo_dir = os.path.normpath(repo_dir)
1049  # Compute the subdir
1050  cwd = os.path.normpath(os.getcwd())
1051  assert cwd.startswith(self.repo_dir)
1052  self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
1053  if self.options.revision:
1054  self.base_rev = self.options.revision
1055  else:
1056  self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
1057 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def __init__(self, options, repo_dir)
Definition: upload.py:1045
def upload.MercurialVCS.__init__ (   self,
  options,
  repo_dir 
)

Definition at line 1045 of file upload.py.

References upload.MercurialVCS.__init__(), upload.MercurialVCS.base_rev, upload.MercurialVCS.repo_dir, upload.RunShell(), folly::gen.split(), folly::detail::distributed_mutex.strip(), and upload.MercurialVCS.subdir.

1045  def __init__(self, options, repo_dir):
1046  super(MercurialVCS, self).__init__(options)
1047  # Absolute path to repository (we can be in a subdir)
1048  self.repo_dir = os.path.normpath(repo_dir)
1049  # Compute the subdir
1050  cwd = os.path.normpath(os.getcwd())
1051  assert cwd.startswith(self.repo_dir)
1052  self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
1053  if self.options.revision:
1054  self.base_rev = self.options.revision
1055  else:
1056  self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
1057 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def __init__(self, options, repo_dir)
Definition: upload.py:1045
def upload.MercurialVCS.__init__ (   self,
  options,
  repo_dir 
)

Definition at line 1045 of file upload.py.

References upload.MercurialVCS.__init__(), upload.MercurialVCS.base_rev, upload.MercurialVCS.repo_dir, upload.RunShell(), folly::gen.split(), folly::detail::distributed_mutex.strip(), and upload.MercurialVCS.subdir.

1045  def __init__(self, options, repo_dir):
1046  super(MercurialVCS, self).__init__(options)
1047  # Absolute path to repository (we can be in a subdir)
1048  self.repo_dir = os.path.normpath(repo_dir)
1049  # Compute the subdir
1050  cwd = os.path.normpath(os.getcwd())
1051  assert cwd.startswith(self.repo_dir)
1052  self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
1053  if self.options.revision:
1054  self.base_rev = self.options.revision
1055  else:
1056  self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip()
1057 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def __init__(self, options, repo_dir)
Definition: upload.py:1045

Member Function Documentation

def upload.MercurialVCS._GetRelPath (   self,
  filename 
)
private
Get relative path of a file according to the current directory,
given its logical path in the repo.

Definition at line 1058 of file upload.py.

References upload.MercurialVCS.subdir.

Referenced by upload.MercurialVCS._GetRelPath(), and upload.MercurialVCS.GetBaseFile().

1058  def _GetRelPath(self, filename):
1059  """Get relative path of a file according to the current directory,
1060  given its logical path in the repo."""
1061  assert filename.startswith(self.subdir), filename
1062  return filename[len(self.subdir):].lstrip(r"\/")
1063 
def _GetRelPath(self, filename)
Definition: upload.py:1058
def upload.MercurialVCS._GetRelPath (   self,
  filename 
)
private
Get relative path of a file according to the current directory,
given its logical path in the repo.

Definition at line 1058 of file upload.py.

References upload.MercurialVCS._GetRelPath(), and upload.MercurialVCS.subdir.

1058  def _GetRelPath(self, filename):
1059  """Get relative path of a file according to the current directory,
1060  given its logical path in the repo."""
1061  assert filename.startswith(self.subdir), filename
1062  return filename[len(self.subdir):].lstrip(r"\/")
1063 
def _GetRelPath(self, filename)
Definition: upload.py:1058
def upload.MercurialVCS._GetRelPath (   self,
  filename 
)
private
Get relative path of a file according to the current directory,
given its logical path in the repo.

Definition at line 1058 of file upload.py.

References upload.MercurialVCS._GetRelPath(), and upload.MercurialVCS.subdir.

1058  def _GetRelPath(self, filename):
1059  """Get relative path of a file according to the current directory,
1060  given its logical path in the repo."""
1061  assert filename.startswith(self.subdir), filename
1062  return filename[len(self.subdir):].lstrip(r"\/")
1063 
def _GetRelPath(self, filename)
Definition: upload.py:1058
def upload.MercurialVCS._GetRelPath (   self,
  filename 
)
private
Get relative path of a file according to the current directory,
given its logical path in the repo.

Definition at line 1058 of file upload.py.

References upload.MercurialVCS._GetRelPath(), and upload.MercurialVCS.subdir.

1058  def _GetRelPath(self, filename):
1059  """Get relative path of a file according to the current directory,
1060  given its logical path in the repo."""
1061  assert filename.startswith(self.subdir), filename
1062  return filename[len(self.subdir):].lstrip(r"\/")
1063 
def _GetRelPath(self, filename)
Definition: upload.py:1058
def upload.MercurialVCS._GetRelPath (   self,
  filename 
)
private
Get relative path of a file according to the current directory,
given its logical path in the repo.

Definition at line 1058 of file upload.py.

References upload.MercurialVCS._GetRelPath(), and upload.MercurialVCS.subdir.

1058  def _GetRelPath(self, filename):
1059  """Get relative path of a file according to the current directory,
1060  given its logical path in the repo."""
1061  assert filename.startswith(self.subdir), filename
1062  return filename[len(self.subdir):].lstrip(r"\/")
1063 
def _GetRelPath(self, filename)
Definition: upload.py:1058
def upload.MercurialVCS._GetRelPath (   self,
  filename 
)
private
Get relative path of a file according to the current directory,
given its logical path in the repo.

Definition at line 1058 of file upload.py.

References upload.MercurialVCS._GetRelPath(), and upload.MercurialVCS.subdir.

1058  def _GetRelPath(self, filename):
1059  """Get relative path of a file according to the current directory,
1060  given its logical path in the repo."""
1061  assert filename.startswith(self.subdir), filename
1062  return filename[len(self.subdir):].lstrip(r"\/")
1063 
def _GetRelPath(self, filename)
Definition: upload.py:1058
def upload.MercurialVCS.GenerateDiff (   self,
  extra_args 
)

Definition at line 1064 of file upload.py.

References upload.MercurialVCS.base_rev, upload.ErrorExit(), upload.MercurialVCS.GenerateDiff(), join, and upload.RunShell().

1064  def GenerateDiff(self, extra_args):
1065  # If no file specified, restrict to the current subdir
1066  extra_args = extra_args or ["."]
1067  cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
1068  data = RunShell(cmd, silent_ok=True)
1069  svndiff = []
1070  filecount = 0
1071  for line in data.splitlines():
1072  m = re.match("diff --git a/(\S+) b/(\S+)", line)
1073  if m:
1074  # Modify line to make it look like as it comes from svn diff.
1075  # With this modification no changes on the server side are required
1076  # to make upload.py work with Mercurial repos.
1077  # NOTE: for proper handling of moved/copied files, we have to use
1078  # the second filename.
1079  filename = m.group(2)
1080  svndiff.append("Index: %s" % filename)
1081  svndiff.append("=" * 67)
1082  filecount += 1
1083  logging.info(line)
1084  else:
1085  svndiff.append(line)
1086  if not filecount:
1087  ErrorExit("No valid patches found in output from hg diff")
1088  return "\n".join(svndiff) + "\n"
1089 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def ErrorExit(msg)
Definition: upload.py:109
#define join
def GenerateDiff(self, extra_args)
Definition: upload.py:1064
def upload.MercurialVCS.GenerateDiff (   self,
  extra_args 
)

Definition at line 1064 of file upload.py.

References upload.MercurialVCS.base_rev, upload.ErrorExit(), join, and upload.RunShell().

Referenced by upload.MercurialVCS.GenerateDiff().

1064  def GenerateDiff(self, extra_args):
1065  # If no file specified, restrict to the current subdir
1066  extra_args = extra_args or ["."]
1067  cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
1068  data = RunShell(cmd, silent_ok=True)
1069  svndiff = []
1070  filecount = 0
1071  for line in data.splitlines():
1072  m = re.match("diff --git a/(\S+) b/(\S+)", line)
1073  if m:
1074  # Modify line to make it look like as it comes from svn diff.
1075  # With this modification no changes on the server side are required
1076  # to make upload.py work with Mercurial repos.
1077  # NOTE: for proper handling of moved/copied files, we have to use
1078  # the second filename.
1079  filename = m.group(2)
1080  svndiff.append("Index: %s" % filename)
1081  svndiff.append("=" * 67)
1082  filecount += 1
1083  logging.info(line)
1084  else:
1085  svndiff.append(line)
1086  if not filecount:
1087  ErrorExit("No valid patches found in output from hg diff")
1088  return "\n".join(svndiff) + "\n"
1089 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def ErrorExit(msg)
Definition: upload.py:109
#define join
def GenerateDiff(self, extra_args)
Definition: upload.py:1064
def upload.MercurialVCS.GenerateDiff (   self,
  extra_args 
)

Definition at line 1064 of file upload.py.

References upload.MercurialVCS.base_rev, upload.ErrorExit(), upload.MercurialVCS.GenerateDiff(), join, and upload.RunShell().

1064  def GenerateDiff(self, extra_args):
1065  # If no file specified, restrict to the current subdir
1066  extra_args = extra_args or ["."]
1067  cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
1068  data = RunShell(cmd, silent_ok=True)
1069  svndiff = []
1070  filecount = 0
1071  for line in data.splitlines():
1072  m = re.match("diff --git a/(\S+) b/(\S+)", line)
1073  if m:
1074  # Modify line to make it look like as it comes from svn diff.
1075  # With this modification no changes on the server side are required
1076  # to make upload.py work with Mercurial repos.
1077  # NOTE: for proper handling of moved/copied files, we have to use
1078  # the second filename.
1079  filename = m.group(2)
1080  svndiff.append("Index: %s" % filename)
1081  svndiff.append("=" * 67)
1082  filecount += 1
1083  logging.info(line)
1084  else:
1085  svndiff.append(line)
1086  if not filecount:
1087  ErrorExit("No valid patches found in output from hg diff")
1088  return "\n".join(svndiff) + "\n"
1089 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def ErrorExit(msg)
Definition: upload.py:109
#define join
def GenerateDiff(self, extra_args)
Definition: upload.py:1064
def upload.MercurialVCS.GenerateDiff (   self,
  extra_args 
)

Definition at line 1064 of file upload.py.

References upload.MercurialVCS.base_rev, upload.ErrorExit(), upload.MercurialVCS.GenerateDiff(), join, and upload.RunShell().

1064  def GenerateDiff(self, extra_args):
1065  # If no file specified, restrict to the current subdir
1066  extra_args = extra_args or ["."]
1067  cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
1068  data = RunShell(cmd, silent_ok=True)
1069  svndiff = []
1070  filecount = 0
1071  for line in data.splitlines():
1072  m = re.match("diff --git a/(\S+) b/(\S+)", line)
1073  if m:
1074  # Modify line to make it look like as it comes from svn diff.
1075  # With this modification no changes on the server side are required
1076  # to make upload.py work with Mercurial repos.
1077  # NOTE: for proper handling of moved/copied files, we have to use
1078  # the second filename.
1079  filename = m.group(2)
1080  svndiff.append("Index: %s" % filename)
1081  svndiff.append("=" * 67)
1082  filecount += 1
1083  logging.info(line)
1084  else:
1085  svndiff.append(line)
1086  if not filecount:
1087  ErrorExit("No valid patches found in output from hg diff")
1088  return "\n".join(svndiff) + "\n"
1089 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def ErrorExit(msg)
Definition: upload.py:109
#define join
def GenerateDiff(self, extra_args)
Definition: upload.py:1064
def upload.MercurialVCS.GenerateDiff (   self,
  extra_args 
)

Definition at line 1064 of file upload.py.

References upload.MercurialVCS.base_rev, upload.ErrorExit(), upload.MercurialVCS.GenerateDiff(), join, and upload.RunShell().

1064  def GenerateDiff(self, extra_args):
1065  # If no file specified, restrict to the current subdir
1066  extra_args = extra_args or ["."]
1067  cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
1068  data = RunShell(cmd, silent_ok=True)
1069  svndiff = []
1070  filecount = 0
1071  for line in data.splitlines():
1072  m = re.match("diff --git a/(\S+) b/(\S+)", line)
1073  if m:
1074  # Modify line to make it look like as it comes from svn diff.
1075  # With this modification no changes on the server side are required
1076  # to make upload.py work with Mercurial repos.
1077  # NOTE: for proper handling of moved/copied files, we have to use
1078  # the second filename.
1079  filename = m.group(2)
1080  svndiff.append("Index: %s" % filename)
1081  svndiff.append("=" * 67)
1082  filecount += 1
1083  logging.info(line)
1084  else:
1085  svndiff.append(line)
1086  if not filecount:
1087  ErrorExit("No valid patches found in output from hg diff")
1088  return "\n".join(svndiff) + "\n"
1089 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def ErrorExit(msg)
Definition: upload.py:109
#define join
def GenerateDiff(self, extra_args)
Definition: upload.py:1064
def upload.MercurialVCS.GenerateDiff (   self,
  extra_args 
)

Definition at line 1064 of file upload.py.

References upload.MercurialVCS.base_rev, upload.ErrorExit(), upload.MercurialVCS.GenerateDiff(), join, and upload.RunShell().

1064  def GenerateDiff(self, extra_args):
1065  # If no file specified, restrict to the current subdir
1066  extra_args = extra_args or ["."]
1067  cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
1068  data = RunShell(cmd, silent_ok=True)
1069  svndiff = []
1070  filecount = 0
1071  for line in data.splitlines():
1072  m = re.match("diff --git a/(\S+) b/(\S+)", line)
1073  if m:
1074  # Modify line to make it look like as it comes from svn diff.
1075  # With this modification no changes on the server side are required
1076  # to make upload.py work with Mercurial repos.
1077  # NOTE: for proper handling of moved/copied files, we have to use
1078  # the second filename.
1079  filename = m.group(2)
1080  svndiff.append("Index: %s" % filename)
1081  svndiff.append("=" * 67)
1082  filecount += 1
1083  logging.info(line)
1084  else:
1085  svndiff.append(line)
1086  if not filecount:
1087  ErrorExit("No valid patches found in output from hg diff")
1088  return "\n".join(svndiff) + "\n"
1089 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def ErrorExit(msg)
Definition: upload.py:109
#define join
def GenerateDiff(self, extra_args)
Definition: upload.py:1064
def upload.MercurialVCS.GetBaseFile (   self,
  filename 
)

Definition at line 1102 of file upload.py.

References upload.MercurialVCS._GetRelPath(), upload.MercurialVCS.base_rev, count, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.MercurialVCS.GetBaseFile(), upload.GetRpcServer(), upload.GuessVCS(), upload.VersionControlSystem.IsImage(), join, upload.main(), fizz::detail.read(), upload.RealMain(), replace(), upload.RunShell(), upload.RunShellWithReturnCode(), folly::gen.split(), upload.SplitPatch(), upload.StatusUpdate(), folly::detail::distributed_mutex.strip(), and upload.UploadSeparatePatches().

1102  def GetBaseFile(self, filename):
1103  # "hg status" and "hg cat" both take a path relative to the current subdir
1104  # rather than to the repo root, but "hg diff" has given us the full path
1105  # to the repo root.
1106  base_content = ""
1107  new_content = None
1108  is_binary = False
1109  oldrelpath = relpath = self._GetRelPath(filename)
1110  # "hg status -C" returns two lines for moved/copied files, one otherwise
1111  out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
1112  out = out.splitlines()
1113  # HACK: strip error message about missing file/directory if it isn't in
1114  # the working copy
1115  if out[0].startswith('%s: ' % relpath):
1116  out = out[1:]
1117  if len(out) > 1:
1118  # Moved/copied => considered as modified, use old filename to
1119  # retrieve base contents
1120  oldrelpath = out[1].strip()
1121  status = "M"
1122  else:
1123  status, _ = out[0].split(' ', 1)
1124  if status != "A":
1125  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1126  silent_ok=True)
1127  is_binary = "\0" in base_content # Mercurial's heuristic
1128  if status != "R":
1129  new_content = open(relpath, "rb").read()
1130  is_binary = is_binary or "\0" in new_content
1131  if is_binary and base_content:
1132  # Fetch again without converting newlines
1133  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1134  silent_ok=True, universal_newlines=False)
1135  if not is_binary or not self.IsImage(relpath):
1136  new_content = None
1137  return base_content, new_content, is_binary, status
1138 
1139 
1140 # NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
def _GetRelPath(self, filename)
Definition: upload.py:1058
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
size_t read(T &out, folly::io::Cursor &cursor)
Definition: Types-inl.h:258
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def IsImage(self, filename)
Definition: upload.py:713
def GetBaseFile(self, filename)
Definition: upload.py:1102
def upload.MercurialVCS.GetBaseFile (   self,
  filename 
)

Definition at line 1102 of file upload.py.

References upload.MercurialVCS._GetRelPath(), upload.MercurialVCS.base_rev, count, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.MercurialVCS.GetBaseFile(), upload.GetRpcServer(), upload.GuessVCS(), upload.VersionControlSystem.IsImage(), join, upload.main(), fizz::detail.read(), upload.RealMain(), replace(), upload.RunShell(), upload.RunShellWithReturnCode(), folly::gen.split(), upload.SplitPatch(), upload.StatusUpdate(), folly::detail::distributed_mutex.strip(), and upload.UploadSeparatePatches().

1102  def GetBaseFile(self, filename):
1103  # "hg status" and "hg cat" both take a path relative to the current subdir
1104  # rather than to the repo root, but "hg diff" has given us the full path
1105  # to the repo root.
1106  base_content = ""
1107  new_content = None
1108  is_binary = False
1109  oldrelpath = relpath = self._GetRelPath(filename)
1110  # "hg status -C" returns two lines for moved/copied files, one otherwise
1111  out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
1112  out = out.splitlines()
1113  # HACK: strip error message about missing file/directory if it isn't in
1114  # the working copy
1115  if out[0].startswith('%s: ' % relpath):
1116  out = out[1:]
1117  if len(out) > 1:
1118  # Moved/copied => considered as modified, use old filename to
1119  # retrieve base contents
1120  oldrelpath = out[1].strip()
1121  status = "M"
1122  else:
1123  status, _ = out[0].split(' ', 1)
1124  if status != "A":
1125  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1126  silent_ok=True)
1127  is_binary = "\0" in base_content # Mercurial's heuristic
1128  if status != "R":
1129  new_content = open(relpath, "rb").read()
1130  is_binary = is_binary or "\0" in new_content
1131  if is_binary and base_content:
1132  # Fetch again without converting newlines
1133  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1134  silent_ok=True, universal_newlines=False)
1135  if not is_binary or not self.IsImage(relpath):
1136  new_content = None
1137  return base_content, new_content, is_binary, status
1138 
1139 
1140 # NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
def _GetRelPath(self, filename)
Definition: upload.py:1058
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
size_t read(T &out, folly::io::Cursor &cursor)
Definition: Types-inl.h:258
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def IsImage(self, filename)
Definition: upload.py:713
def GetBaseFile(self, filename)
Definition: upload.py:1102
def upload.MercurialVCS.GetBaseFile (   self,
  filename 
)

Definition at line 1102 of file upload.py.

References upload.MercurialVCS._GetRelPath(), upload.MercurialVCS.base_rev, count, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.MercurialVCS.GetBaseFile(), upload.GetRpcServer(), upload.GuessVCS(), upload.VersionControlSystem.IsImage(), join, upload.main(), fizz::detail.read(), upload.RealMain(), replace(), upload.RunShell(), upload.RunShellWithReturnCode(), folly::gen.split(), upload.SplitPatch(), upload.StatusUpdate(), folly::detail::distributed_mutex.strip(), and upload.UploadSeparatePatches().

1102  def GetBaseFile(self, filename):
1103  # "hg status" and "hg cat" both take a path relative to the current subdir
1104  # rather than to the repo root, but "hg diff" has given us the full path
1105  # to the repo root.
1106  base_content = ""
1107  new_content = None
1108  is_binary = False
1109  oldrelpath = relpath = self._GetRelPath(filename)
1110  # "hg status -C" returns two lines for moved/copied files, one otherwise
1111  out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
1112  out = out.splitlines()
1113  # HACK: strip error message about missing file/directory if it isn't in
1114  # the working copy
1115  if out[0].startswith('%s: ' % relpath):
1116  out = out[1:]
1117  if len(out) > 1:
1118  # Moved/copied => considered as modified, use old filename to
1119  # retrieve base contents
1120  oldrelpath = out[1].strip()
1121  status = "M"
1122  else:
1123  status, _ = out[0].split(' ', 1)
1124  if status != "A":
1125  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1126  silent_ok=True)
1127  is_binary = "\0" in base_content # Mercurial's heuristic
1128  if status != "R":
1129  new_content = open(relpath, "rb").read()
1130  is_binary = is_binary or "\0" in new_content
1131  if is_binary and base_content:
1132  # Fetch again without converting newlines
1133  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1134  silent_ok=True, universal_newlines=False)
1135  if not is_binary or not self.IsImage(relpath):
1136  new_content = None
1137  return base_content, new_content, is_binary, status
1138 
1139 
1140 # NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
def _GetRelPath(self, filename)
Definition: upload.py:1058
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
size_t read(T &out, folly::io::Cursor &cursor)
Definition: Types-inl.h:258
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def IsImage(self, filename)
Definition: upload.py:713
def GetBaseFile(self, filename)
Definition: upload.py:1102
def upload.MercurialVCS.GetBaseFile (   self,
  filename 
)

Definition at line 1102 of file upload.py.

References upload.MercurialVCS._GetRelPath(), upload.MercurialVCS.base_rev, upload.VersionControlSystem.IsImage(), fizz::detail.read(), upload.RunShell(), folly::gen.split(), and folly::detail::distributed_mutex.strip().

Referenced by upload.MercurialVCS.GetBaseFile().

1102  def GetBaseFile(self, filename):
1103  # "hg status" and "hg cat" both take a path relative to the current subdir
1104  # rather than to the repo root, but "hg diff" has given us the full path
1105  # to the repo root.
1106  base_content = ""
1107  new_content = None
1108  is_binary = False
1109  oldrelpath = relpath = self._GetRelPath(filename)
1110  # "hg status -C" returns two lines for moved/copied files, one otherwise
1111  out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
1112  out = out.splitlines()
1113  # HACK: strip error message about missing file/directory if it isn't in
1114  # the working copy
1115  if out[0].startswith('%s: ' % relpath):
1116  out = out[1:]
1117  if len(out) > 1:
1118  # Moved/copied => considered as modified, use old filename to
1119  # retrieve base contents
1120  oldrelpath = out[1].strip()
1121  status = "M"
1122  else:
1123  status, _ = out[0].split(' ', 1)
1124  if status != "A":
1125  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1126  silent_ok=True)
1127  is_binary = "\0" in base_content # Mercurial's heuristic
1128  if status != "R":
1129  new_content = open(relpath, "rb").read()
1130  is_binary = is_binary or "\0" in new_content
1131  if is_binary and base_content:
1132  # Fetch again without converting newlines
1133  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1134  silent_ok=True, universal_newlines=False)
1135  if not is_binary or not self.IsImage(relpath):
1136  new_content = None
1137  return base_content, new_content, is_binary, status
1138 
1139 
1140 # NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
def _GetRelPath(self, filename)
Definition: upload.py:1058
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
size_t read(T &out, folly::io::Cursor &cursor)
Definition: Types-inl.h:258
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def IsImage(self, filename)
Definition: upload.py:713
def GetBaseFile(self, filename)
Definition: upload.py:1102
def upload.MercurialVCS.GetBaseFile (   self,
  filename 
)

Definition at line 1102 of file upload.py.

References upload.MercurialVCS._GetRelPath(), upload.MercurialVCS.base_rev, count, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.MercurialVCS.GetBaseFile(), upload.GetRpcServer(), upload.GuessVCS(), upload.VersionControlSystem.IsImage(), join, upload.main(), fizz::detail.read(), upload.RealMain(), replace(), upload.RunShell(), upload.RunShellWithReturnCode(), folly::gen.split(), upload.SplitPatch(), upload.StatusUpdate(), folly::detail::distributed_mutex.strip(), and upload.UploadSeparatePatches().

1102  def GetBaseFile(self, filename):
1103  # "hg status" and "hg cat" both take a path relative to the current subdir
1104  # rather than to the repo root, but "hg diff" has given us the full path
1105  # to the repo root.
1106  base_content = ""
1107  new_content = None
1108  is_binary = False
1109  oldrelpath = relpath = self._GetRelPath(filename)
1110  # "hg status -C" returns two lines for moved/copied files, one otherwise
1111  out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
1112  out = out.splitlines()
1113  # HACK: strip error message about missing file/directory if it isn't in
1114  # the working copy
1115  if out[0].startswith('%s: ' % relpath):
1116  out = out[1:]
1117  if len(out) > 1:
1118  # Moved/copied => considered as modified, use old filename to
1119  # retrieve base contents
1120  oldrelpath = out[1].strip()
1121  status = "M"
1122  else:
1123  status, _ = out[0].split(' ', 1)
1124  if status != "A":
1125  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1126  silent_ok=True)
1127  is_binary = "\0" in base_content # Mercurial's heuristic
1128  if status != "R":
1129  new_content = open(relpath, "rb").read()
1130  is_binary = is_binary or "\0" in new_content
1131  if is_binary and base_content:
1132  # Fetch again without converting newlines
1133  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1134  silent_ok=True, universal_newlines=False)
1135  if not is_binary or not self.IsImage(relpath):
1136  new_content = None
1137  return base_content, new_content, is_binary, status
1138 
1139 
1140 # NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
def _GetRelPath(self, filename)
Definition: upload.py:1058
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
size_t read(T &out, folly::io::Cursor &cursor)
Definition: Types-inl.h:258
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def IsImage(self, filename)
Definition: upload.py:713
def GetBaseFile(self, filename)
Definition: upload.py:1102
def upload.MercurialVCS.GetBaseFile (   self,
  filename 
)

Definition at line 1102 of file upload.py.

References upload.MercurialVCS._GetRelPath(), upload.MercurialVCS.base_rev, count, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.MercurialVCS.GetBaseFile(), upload.GetRpcServer(), upload.GuessVCS(), upload.VersionControlSystem.IsImage(), join, upload.main(), fizz::detail.read(), upload.RealMain(), replace(), upload.RunShell(), upload.RunShellWithReturnCode(), folly::gen.split(), upload.SplitPatch(), upload.StatusUpdate(), folly::detail::distributed_mutex.strip(), and upload.UploadSeparatePatches().

1102  def GetBaseFile(self, filename):
1103  # "hg status" and "hg cat" both take a path relative to the current subdir
1104  # rather than to the repo root, but "hg diff" has given us the full path
1105  # to the repo root.
1106  base_content = ""
1107  new_content = None
1108  is_binary = False
1109  oldrelpath = relpath = self._GetRelPath(filename)
1110  # "hg status -C" returns two lines for moved/copied files, one otherwise
1111  out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath])
1112  out = out.splitlines()
1113  # HACK: strip error message about missing file/directory if it isn't in
1114  # the working copy
1115  if out[0].startswith('%s: ' % relpath):
1116  out = out[1:]
1117  if len(out) > 1:
1118  # Moved/copied => considered as modified, use old filename to
1119  # retrieve base contents
1120  oldrelpath = out[1].strip()
1121  status = "M"
1122  else:
1123  status, _ = out[0].split(' ', 1)
1124  if status != "A":
1125  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1126  silent_ok=True)
1127  is_binary = "\0" in base_content # Mercurial's heuristic
1128  if status != "R":
1129  new_content = open(relpath, "rb").read()
1130  is_binary = is_binary or "\0" in new_content
1131  if is_binary and base_content:
1132  # Fetch again without converting newlines
1133  base_content = RunShell(["hg", "cat", "-r", self.base_rev, oldrelpath],
1134  silent_ok=True, universal_newlines=False)
1135  if not is_binary or not self.IsImage(relpath):
1136  new_content = None
1137  return base_content, new_content, is_binary, status
1138 
1139 
1140 # NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
def _GetRelPath(self, filename)
Definition: upload.py:1058
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
std::uint64_t strip(std::chrono::nanoseconds t)
size_t read(T &out, folly::io::Cursor &cursor)
Definition: Types-inl.h:258
S split(const StringPiece source, char delimiter)
Definition: String.h:61
def IsImage(self, filename)
Definition: upload.py:713
def GetBaseFile(self, filename)
Definition: upload.py:1102
def upload.MercurialVCS.GetUnknownFiles (   self)
Return a list of files unknown to the VCS.

Definition at line 1090 of file upload.py.

References upload.MercurialVCS.base_rev, upload.MercurialVCS.GetUnknownFiles(), and upload.RunShell().

1090  def GetUnknownFiles(self):
1091  """Return a list of files unknown to the VCS."""
1092  args = []
1093  status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
1094  silent_ok=True)
1095  unknown_files = []
1096  for line in status.splitlines():
1097  st, fn = line.split(" ", 1)
1098  if st == "?":
1099  unknown_files.append(fn)
1100  return unknown_files
1101 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def GetUnknownFiles(self)
Definition: upload.py:1090
def upload.MercurialVCS.GetUnknownFiles (   self)
Return a list of files unknown to the VCS.

Definition at line 1090 of file upload.py.

References upload.MercurialVCS.base_rev, upload.MercurialVCS.GetUnknownFiles(), and upload.RunShell().

1090  def GetUnknownFiles(self):
1091  """Return a list of files unknown to the VCS."""
1092  args = []
1093  status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
1094  silent_ok=True)
1095  unknown_files = []
1096  for line in status.splitlines():
1097  st, fn = line.split(" ", 1)
1098  if st == "?":
1099  unknown_files.append(fn)
1100  return unknown_files
1101 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def GetUnknownFiles(self)
Definition: upload.py:1090
def upload.MercurialVCS.GetUnknownFiles (   self)
Return a list of files unknown to the VCS.

Definition at line 1090 of file upload.py.

References upload.MercurialVCS.base_rev, upload.MercurialVCS.GetUnknownFiles(), and upload.RunShell().

1090  def GetUnknownFiles(self):
1091  """Return a list of files unknown to the VCS."""
1092  args = []
1093  status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
1094  silent_ok=True)
1095  unknown_files = []
1096  for line in status.splitlines():
1097  st, fn = line.split(" ", 1)
1098  if st == "?":
1099  unknown_files.append(fn)
1100  return unknown_files
1101 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def GetUnknownFiles(self)
Definition: upload.py:1090
def upload.MercurialVCS.GetUnknownFiles (   self)
Return a list of files unknown to the VCS.

Definition at line 1090 of file upload.py.

References upload.MercurialVCS.base_rev, upload.MercurialVCS.GetUnknownFiles(), and upload.RunShell().

1090  def GetUnknownFiles(self):
1091  """Return a list of files unknown to the VCS."""
1092  args = []
1093  status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
1094  silent_ok=True)
1095  unknown_files = []
1096  for line in status.splitlines():
1097  st, fn = line.split(" ", 1)
1098  if st == "?":
1099  unknown_files.append(fn)
1100  return unknown_files
1101 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def GetUnknownFiles(self)
Definition: upload.py:1090
def upload.MercurialVCS.GetUnknownFiles (   self)
Return a list of files unknown to the VCS.

Definition at line 1090 of file upload.py.

References upload.MercurialVCS.base_rev, and upload.RunShell().

Referenced by upload.MercurialVCS.GetUnknownFiles().

1090  def GetUnknownFiles(self):
1091  """Return a list of files unknown to the VCS."""
1092  args = []
1093  status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
1094  silent_ok=True)
1095  unknown_files = []
1096  for line in status.splitlines():
1097  st, fn = line.split(" ", 1)
1098  if st == "?":
1099  unknown_files.append(fn)
1100  return unknown_files
1101 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def GetUnknownFiles(self)
Definition: upload.py:1090
def upload.MercurialVCS.GetUnknownFiles (   self)
Return a list of files unknown to the VCS.

Definition at line 1090 of file upload.py.

References upload.MercurialVCS.base_rev, upload.MercurialVCS.GetUnknownFiles(), and upload.RunShell().

1090  def GetUnknownFiles(self):
1091  """Return a list of files unknown to the VCS."""
1092  args = []
1093  status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
1094  silent_ok=True)
1095  unknown_files = []
1096  for line in status.splitlines():
1097  st, fn = line.split(" ", 1)
1098  if st == "?":
1099  unknown_files.append(fn)
1100  return unknown_files
1101 
def RunShell(command, silent_ok=False, universal_newlines=True, print_output=False)
Definition: upload.py:578
def GetUnknownFiles(self)
Definition: upload.py:1090

Member Data Documentation

upload.MercurialVCS.repo_dir

Definition at line 1048 of file upload.py.

Referenced by upload.MercurialVCS.__init__().

upload.MercurialVCS.subdir

Definition at line 1052 of file upload.py.

Referenced by upload.MercurialVCS.__init__(), and upload.MercurialVCS._GetRelPath().


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