mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #24031: make patchcheck now supports git checkouts, too.
This commit is contained in:
parent
71f73ca7a9
commit
d98c6773fa
2 changed files with 29 additions and 9 deletions
|
@ -225,6 +225,10 @@ Documentation
|
||||||
|
|
||||||
- Issue #24029: Document the name binding behavior for submodule imports.
|
- Issue #24029: Document the name binding behavior for submodule imports.
|
||||||
|
|
||||||
|
Tools/Demos
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- Issue #24031: make patchcheck now supports git checkouts, too.
|
||||||
|
|
||||||
What's New in Python 3.4.3?
|
What's New in Python 3.4.3?
|
||||||
===========================
|
===========================
|
||||||
|
|
|
@ -49,15 +49,31 @@ def mq_patches_applied():
|
||||||
@status("Getting the list of files that have been added/changed",
|
@status("Getting the list of files that have been added/changed",
|
||||||
info=lambda x: n_files_str(len(x)))
|
info=lambda x: n_files_str(len(x)))
|
||||||
def changed_files():
|
def changed_files():
|
||||||
"""Get the list of changed or added files from Mercurial."""
|
"""Get the list of changed or added files from Mercurial or git."""
|
||||||
if not os.path.isdir(os.path.join(SRCDIR, '.hg')):
|
if os.path.isdir(os.path.join(SRCDIR, '.hg')):
|
||||||
sys.exit('need a checkout to get modified files')
|
cmd = 'hg status --added --modified --no-status'
|
||||||
|
if mq_patches_applied():
|
||||||
cmd = 'hg status --added --modified --no-status'
|
cmd += ' --rev qparent'
|
||||||
if mq_patches_applied():
|
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
|
||||||
cmd += ' --rev qparent'
|
return [x.decode().rstrip() for x in st.stdout]
|
||||||
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
|
elif os.path.isdir(os.path.join(SRCDIR, '.git')):
|
||||||
return [x.decode().rstrip() for x in st.stdout]
|
cmd = 'git status --porcelain'
|
||||||
|
filenames = []
|
||||||
|
with subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) as st:
|
||||||
|
for line in st.stdout:
|
||||||
|
line = line.decode().rstrip()
|
||||||
|
status = set(line[:2])
|
||||||
|
# modified, added or unmerged files
|
||||||
|
if not status.intersection('MAU'):
|
||||||
|
continue
|
||||||
|
filename = line[3:]
|
||||||
|
if ' -> ' in filename:
|
||||||
|
# file is renamed
|
||||||
|
filename = filename.split(' -> ', 2)[1].strip()
|
||||||
|
filenames.append(filename)
|
||||||
|
return filenames
|
||||||
|
else:
|
||||||
|
sys.exit('need a Mercurial or git checkout to get modified files')
|
||||||
|
|
||||||
|
|
||||||
def report_modified_files(file_paths):
|
def report_modified_files(file_paths):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue