Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
erp5
Commits
4df412c9
Commit
4df412c9
authored
Oct 18, 2022
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5Type.tests.CodingStyleTestCase: Include deleted and added files in patch
parent
a45feb66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
12 deletions
+42
-12
product/ERP5Type/tests/CodingStyleTestCase.py
product/ERP5Type/tests/CodingStyleTestCase.py
+42
-12
No files found.
product/ERP5Type/tests/CodingStyleTestCase.py
View file @
4df412c9
...
@@ -159,27 +159,57 @@ class CodingStyleTestCase(ERP5TypeTestCase):
...
@@ -159,27 +159,57 @@ class CodingStyleTestCase(ERP5TypeTestCase):
if
p
and
not
p
.
strip
().
startswith
(
"#"
)}
if
p
and
not
p
.
strip
().
startswith
(
"#"
)}
diff_line_list
=
[]
diff_line_list
=
[]
def
get_difference
(
path
,
has_old
=
True
,
has_new
=
True
):
old
=
(
os
.
path
.
join
(
bt_base_path
,
path
)
if
has_old
else
os
.
devnull
)
new
=
(
os
.
path
.
join
(
export_base_path
,
path
)
if
has_new
else
os
.
devnull
)
old_is_dir
=
os
.
path
.
isdir
(
old
)
new_is_dir
=
os
.
path
.
isdir
(
new
)
# Raise if we are going from a directory to a file or vice-versa.
assert
not
has_old
or
not
has_new
or
old_is_dir
==
new_is_dir
,
(
path
,
old_is_dir
,
new_is_dir
)
if
old_is_dir
or
new_is_dir
:
return
with
open
(
old
)
as
ff
,
open
(
new
)
as
tf
:
diff_line_list
.
extend
(
difflib
.
unified_diff
(
ff
.
readlines
(),
tf
.
readlines
(),
(
os
.
path
.
join
(
'git'
,
path
)
if
has_old
else
os
.
devnull
),
(
os
.
path
.
join
(
'bt5'
,
path
)
if
has_new
else
os
.
devnull
),
),
)
def
get_differences
(
dcmp
,
base
):
def
get_differences
(
dcmp
,
base
):
for
name
in
dcmp
.
left_only
:
for
name
in
dcmp
.
left_only
:
yield
'removed: '
+
os
.
path
.
join
(
base
,
name
)
path
=
os
.
path
.
join
(
base
,
name
)
yield
'removed: '
+
path
get_difference
(
path
,
has_new
=
False
)
for
name
in
dcmp
.
right_only
:
for
name
in
dcmp
.
right_only
:
yield
'added: '
+
os
.
path
.
join
(
base
,
name
)
path
=
os
.
path
.
join
(
base
,
name
)
yield
'added: '
+
path
get_difference
(
path
,
has_old
=
False
)
for
name
in
dcmp
.
funny_files
:
for
name
in
dcmp
.
funny_files
:
yield
'funny: '
+
os
.
path
.
join
(
base
,
name
)
yield
'funny: '
+
os
.
path
.
join
(
base
,
name
)
for
name
in
dcmp
.
diff_files
:
for
name
in
dcmp
.
diff_files
:
path
=
os
.
path
.
join
(
base
,
name
)
path
=
os
.
path
.
join
(
base
,
name
)
get_difference
(
path
)
if
not
any
(
fnmatch
.
fnmatch
(
path
,
ignored_path
)
for
ignored_path
in
ignored_paths
):
if
not
any
(
fnmatch
.
fnmatch
(
path
,
ignored_path
)
for
ignored_path
in
ignored_paths
):
yield
'modified: '
+
path
yield
'modified: '
+
path
with
open
(
os
.
path
.
join
(
bt_base_path
,
path
))
as
ff
,
\
open
(
os
.
path
.
join
(
export_base_path
,
path
))
as
tf
:
diff_line_list
.
extend
(
difflib
.
unified_diff
(
ff
.
readlines
(),
tf
.
readlines
(),
os
.
path
.
join
(
'git'
,
path
),
os
.
path
.
join
(
'bt5'
,
path
),
))
diff_line_list
.
append
(
'
\
n
'
)
for
sub_path
,
sub_dcmp
in
six
.
iteritems
(
dcmp
.
subdirs
):
for
sub_path
,
sub_dcmp
in
six
.
iteritems
(
dcmp
.
subdirs
):
for
diff
in
get_differences
(
sub_dcmp
,
os
.
path
.
join
(
base
,
sub_path
)):
for
diff
in
get_differences
(
sub_dcmp
,
os
.
path
.
join
(
base
,
sub_path
)):
yield
diff
yield
diff
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment