本文整理汇总了Python中webkitpy.common.system.executive.run_command函数的典型用法代码示例。如果您正苦于以下问题:Python run_command函数的具体用法?Python run_command怎么用?Python run_command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_command函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: commit_with_message
def commit_with_message(self, message, username=None, git_commit=None, squash=None):
# Username is ignored during Git commits.
if git_commit:
# Need working directory changes to be committed so we can checkout the merge branch.
if not self.working_directory_is_clean():
# FIXME: webkit-patch land will modify the ChangeLogs to correct the reviewer.
# That will modify the working-copy and cause us to hit this error.
# The ChangeLog modification could be made to modify the existing local commit?
raise ScriptError(message="Working copy is modified. Cannot commit individual git_commits.")
return self._commit_on_branch(message, git_commit)
squash = self.should_squash(squash)
if squash:
run_command(['git', 'reset', '--soft', self.svn_branch_name()])
self.commit_locally_with_message(message)
elif not self.working_directory_is_clean():
if not len(self.local_commits()):
# There are only working copy changes. Assume they should be committed.
self.commit_locally_with_message(message)
elif squash is None:
# The user didn't explicitly say to squash or not squash. There are local commits
# and working copy changes. Not clear what the user wants.
raise ScriptError(message="""There are local commits and working copy changes. Do one of the following:
1) Commit/revert working copy changes.
2) Use --squash or --no-squash
3) git config webkit-patch.squash true/false
""")
# FIXME: This will commit all local commits, each with it's own message. We should restructure
# so that each local commit has the appropriate commit message based off it's ChangeLogs.
return self.push_local_commits_to_server()
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:31,代码来源:scm.py
示例2: apply_reverse_diff
def apply_reverse_diff(self, revision):
# '-c -revision' applies the inverse diff of 'revision'
svn_merge_args = ['svn', 'merge', '--non-interactive', '-c', '-%s' % revision, self._repository_url()]
log("WARNING: svn merge has been known to take more than 10 minutes to complete. It is recommended you use git for rollouts.")
log("Running '%s'" % " ".join(svn_merge_args))
# FIXME: Should this use cwd=self.checkout_root?
run_command(svn_merge_args)
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:7,代码来源:scm.py
示例3: clean_working_directory
def clean_working_directory(self):
# FIXME: These should probably use cwd=self.checkout_root.
# Could run git clean here too, but that wouldn't match working_directory_is_clean
run_command(['git', 'reset', '--hard', 'HEAD'])
# Aborting rebase even though this does not match working_directory_is_clean
if self.rebase_in_progress():
run_command(['git', 'rebase', '--abort'])
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:7,代码来源:scm.py
示例4: _setup_test_commits
def _setup_test_commits(cls, test_object):
# Add some test commits
os.chdir(test_object.svn_checkout_path)
write_into_file_at_path("test_file", "test1")
cls._svn_add("test_file")
cls._svn_commit("initial commit")
write_into_file_at_path("test_file", "test1test2")
# This used to be the last commit, but doing so broke
# GitTest.test_apply_git_patch which use the inverse diff of the last commit.
# svn-apply fails to remove directories in Git, see:
# https://bugs.webkit.org/show_bug.cgi?id=34871
os.mkdir("test_dir")
# Slash should always be the right path separator since we use cygwin on Windows.
test_file3_path = "test_dir/test_file3"
write_into_file_at_path(test_file3_path, "third file")
cls._svn_add("test_dir")
cls._svn_commit("second commit")
write_into_file_at_path("test_file", "test1test2test3\n")
write_into_file_at_path("test_file2", "second file")
cls._svn_add("test_file2")
cls._svn_commit("third commit")
write_into_file_at_path("test_file", "test1test2test3\ntest4\n")
cls._svn_commit("fourth commit")
# svn does not seem to update after commit as I would expect.
run_command(['svn', 'update'])
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:30,代码来源:scm_unittest.py
示例5: ensure_clean_working_directory
def ensure_clean_working_directory(self, force_clean):
if not force_clean and not self.working_directory_is_clean():
# FIXME: Shouldn't this use cwd=self.checkout_root?
print run_command(self.status_command(), error_handler=Executive.ignore_error)
raise ScriptError(message="Working directory has modifications, pass --force-clean or --no-clean to continue.")
log("Cleaning working directory")
self.clean_working_directory()
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:8,代码来源:scm.py
示例6: test_svn_merge_base
def test_svn_merge_base(self):
# Diff to merge-base should include working-copy changes,
# which the diff to svn_branch.. doesn't.
test_file = os.path.join(self.git_checkout_path, 'test_file')
write_into_file_at_path(test_file, 'foo')
diff_to_common_base = run_command(['git', 'diff', self.scm.svn_branch_name() + '..'])
diff_to_merge_base = run_command(['git', 'diff', self.scm.svn_merge_base()])
self.assertFalse(re.search(r'foo', diff_to_common_base))
self.assertTrue(re.search(r'foo', diff_to_merge_base))
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:11,代码来源:scm_unittest.py
示例7: setup
def setup(cls, test_object):
# Create an test SVN repository
test_object.svn_repo_path = tempfile.mkdtemp(suffix="svn_test_repo")
test_object.svn_repo_url = "file://%s" % test_object.svn_repo_path # Not sure this will work on windows
# git svn complains if we don't pass --pre-1.5-compatible, not sure why:
# Expected FS format '2'; found format '3' at /usr/local/libexec/git-core//git-svn line 1477
run_command(['svnadmin', 'create', '--pre-1.5-compatible', test_object.svn_repo_path])
# Create a test svn checkout
test_object.svn_checkout_path = tempfile.mkdtemp(suffix="svn_test_checkout")
run_command(['svn', 'checkout', '--quiet', test_object.svn_repo_url, test_object.svn_checkout_path])
cls._setup_test_commits(test_object)
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:13,代码来源:scm_unittest.py
示例8: apply_patch
def apply_patch(self, patch, force=False):
# It's possible that the patch was not made from the root directory.
# We should detect and handle that case.
# FIXME: Use Executive instead of subprocess here.
curl_process = subprocess.Popen(['curl', '--location', '--silent', '--show-error', patch.url()], stdout=subprocess.PIPE)
# FIXME: Move _scm.script_path here once we get rid of all the dependencies.
args = [self._scm.script_path('svn-apply')]
if patch.reviewer():
args += ['--reviewer', patch.reviewer().full_name]
if force:
args.append('--force')
run_command(args, input=curl_process.stdout)
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:13,代码来源:api.py
示例9: commit_ids_from_commitish_arguments
def commit_ids_from_commitish_arguments(self, args):
if not len(args):
args.append('%s..HEAD' % self.svn_branch_name())
commit_ids = []
for commitish in args:
if '...' in commitish:
raise ScriptError(message="'...' is not supported (found in '%s'). Did you mean '..'?" % commitish)
elif '..' in commitish:
commit_ids += reversed(run_command(['git', 'rev-list', commitish]).splitlines())
else:
# Turn single commits or branch or tag names into commit ids.
commit_ids += run_command(['git', 'rev-parse', '--revs-only', commitish]).splitlines()
return commit_ids
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:14,代码来源:scm.py
示例10: _get_repo_type
def _get_repo_type(self):
"""Get the repository type that client is using."""
return_code = run_command(['svn', 'info'], return_exit_code=True)
if return_code == 0:
return REPO_SVN
return REPO_UNKNOWN
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:7,代码来源:rebaseline_chromium_webkit_tests.py
示例11: has_authorization_for_realm
def has_authorization_for_realm(self, realm=svn_server_realm, home_directory=os.getenv("HOME")):
# Assumes find and grep are installed.
if not os.path.isdir(os.path.join(home_directory, ".subversion")):
return False
find_args = ["find", ".subversion", "-type", "f", "-exec", "grep", "-q", realm, "{}", ";", "-print"];
find_output = run_command(find_args, cwd=home_directory, error_handler=Executive.ignore_error).rstrip()
return find_output and os.path.isfile(os.path.join(home_directory, find_output))
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:7,代码来源:scm.py
示例12: create_patch
def create_patch(self, git_commit=None, squash=None):
"""Returns a byte array (str()) representing the patch file.
Patch files are effectively binary since they may contain
files of multiple different encodings."""
return run_command([self.script_path("svn-create-patch")],
cwd=self.checkout_root, return_stderr=False,
decode_output=False)
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:7,代码来源:scm.py
示例13: find_checkout_root
def find_checkout_root(cls, path):
# "git rev-parse --show-cdup" would be another way to get to the root
(checkout_root, dot_git) = os.path.split(run_command(['git', 'rev-parse', '--git-dir'], cwd=(path or "./")))
# If we were using 2.6 # checkout_root = os.path.relpath(checkout_root, path)
if not os.path.isabs(checkout_root): # Sometimes git returns relative paths
checkout_root = os.path.join(path, checkout_root)
return checkout_root
开发者ID:dankurka,项目名称:webkit_titanium,代码行数:7,代码来源:scm.py
示例14: value_from_svn_info
def value_from_svn_info(cls, path, field_name):
svn_info_args = ['svn', 'info', path]
info_output = run_command(svn_info_args).rstrip()
match = re.search("^%s: (?P<value>.+)$" % field_name, info_output, re.MULTILINE)
if not match:
raise ScriptError(script_args=svn_info_args, message='svn info did not contain a %s.' % field_name)
return match.group('value')
开发者ID:dankurka,项目名称:webkit_titanium,代码行数:7,代码来源:scm.py
示例15: test_apply_git_patch
def test_apply_git_patch(self):
scm = detect_scm_system(self.git_checkout_path)
# We carefullly pick a diff which does not have a directory addition
# as currently svn-apply will error out when trying to remove directories
# in Git: https://bugs.webkit.org/show_bug.cgi?id=34871
patch = self._create_patch(run_command(['git', 'diff', 'HEAD..HEAD^']))
self._setup_webkittools_scripts_symlink(scm)
Checkout(scm).apply_patch(patch)
开发者ID:mikezit,项目名称:Webkit_Code,代码行数:8,代码来源:scm_unittest.py
注:本文中的webkitpy.common.system.executive.run_command函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论