Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Specification Tools
Scripts
Commits
f09cdc3e
Commit
f09cdc3e
authored
1 year ago
by
Miguel Angel Reina Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Fix for determining the clauses being changed
parent
8b67e2e4
No related branches found
No related tags found
No related merge requests found
Pipeline
#190
passed
1 year ago
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
generateChangemarks/changemarks.py
+25
-13
25 additions, 13 deletions
generateChangemarks/changemarks.py
generate_changemarks.sh
+1
-0
1 addition, 0 deletions
generate_changemarks.sh
with
26 additions
and
13 deletions
generateChangemarks/changemarks.py
+
25
−
13
View file @
f09cdc3e
...
@@ -160,13 +160,13 @@ https://forge.etsi.org/rep/cdm/pipeline-scripts/-/blob/main/common/Dockerfile.st
...
@@ -160,13 +160,13 @@ https://forge.etsi.org/rep/cdm/pipeline-scripts/-/blob/main/common/Dockerfile.st
lines_added
=
lines_added
+
change_lines_added
lines_added
=
lines_added
+
change_lines_added
lines_removed
=
lines_removed
+
change_lines_removed
lines_removed
=
lines_removed
+
change_lines_removed
# Check the previous changed_clause
# Check the previous changed_clause
if
(
changed_clause
.
from_id
<=
change_start_line
-
lines_added
+
lines_removed
)
and
(
changed_clause
.
to_id
+
lines_added
-
lines_removed
>=
change_end_line
):
if
(
changed_clause
.
from_id
<=
change_start_line
)
and
(
changed_clause
.
to_id
+
lines_added
-
lines_removed
>=
change_end_line
):
generateMDforChange
(
progress
,
mdLines
,
changed_clause
,
change
,
outDirectory
,
True
)
generateMDforChange
(
progress
,
mdLines
,
changed_clause
,
change
,
outDirectory
,
True
)
break
continue
i
=
0
i
=
0
# Check all clauses
# Check all clauses
for
clause
in
clauses
:
for
clause
in
clauses
:
if
(
clause
.
from_id
<=
change_start_line
-
lines_added
+
lines_removed
)
and
(
clause
.
to_id
+
lines_added
-
lines_removed
>=
change_end_line
):
if
(
clause
.
from_id
<=
change_start_line
)
and
(
clause
.
to_id
+
lines_added
-
lines_removed
>=
change_end_line
):
changed_clause
=
clauses
.
pop
(
i
)
changed_clause
=
clauses
.
pop
(
i
)
changed_clauses
.
append
(
clause
)
changed_clauses
.
append
(
clause
)
generateMDforChange
(
progress
,
mdLines
,
changed_clause
,
change
,
outDirectory
,
False
)
generateMDforChange
(
progress
,
mdLines
,
changed_clause
,
change
,
outDirectory
,
False
)
...
@@ -185,21 +185,33 @@ def changeDetails(change) -> (int, int, int, int):
...
@@ -185,21 +185,33 @@ def changeDetails(change) -> (int, int, int, int):
change_start_line
=
change
.
target_start
change_start_line
=
change
.
target_start
change_end_line
=
change_start_line
change_end_line
=
change_start_line
for
line
in
change
:
for
line
in
change
:
print
(
vars
(
line
))
if
line
.
is_added
or
line
.
is_removed
:
if
line
.
is_added
or
line
.
is_removed
:
if
change_start_line
==
change
.
target_start
:
#
if change_start_line == change.target_start:
change_start_line
=
change
.
target_start
+
i
#
change_start_line = change.target_start + i
change_end_line
=
change_end_line
+
i
#
change_end_line = change_end_line + i
else
:
#
else:
change_end_line
=
change_end_line
+
i
#
change_end_line = change_end_line + i
i
=
0
#
i = 0
if
line
.
is_added
:
if
line
.
is_added
:
lines_added
=
lines_added
+
1
lines_added
=
lines_added
+
1
elif
line
.
is_removed
:
elif
line
.
is_removed
:
lines_removed
=
lines_removed
+
1
lines_removed
=
lines_removed
+
1
if
change_start_line
==
change
.
target_start
:
if
line
.
is_added
:
change_start_line
=
line
.
target_line_no
change_end_line
=
change_start_line
elif
line
.
is_removed
:
change_start_line
=
line
.
source_line_no
change_end_line
=
change_start_line
else
:
if
line
.
is_added
:
change_end_line
=
line
.
target_line_no
elif
line
.
is_removed
:
change_end_line
=
line
.
source_line_no
#i = i + 1
i
=
i
+
1
#change_end_line = change_end_line - lines_removed
change_end_line
=
change_end_line
-
lines_removed
return
change_start_line
,
change_end_line
,
lines_added
,
lines_removed
return
change_start_line
,
change_end_line
,
lines_added
,
lines_removed
def
generateMDforChange
(
progress
:
Progress
,
mdLines
:
list
[
str
],
changed_clause
:
Clause
,
change
,
outDirectory
:
str
,
existing_clause
:
bool
):
def
generateMDforChange
(
progress
:
Progress
,
mdLines
:
list
[
str
],
changed_clause
:
Clause
,
change
,
outDirectory
:
str
,
existing_clause
:
bool
):
...
@@ -217,7 +229,7 @@ https://forge.etsi.org/rep/cdm/pipeline-scripts/-/blob/main/common/Dockerfile.st
...
@@ -217,7 +229,7 @@ https://forge.etsi.org/rep/cdm/pipeline-scripts/-/blob/main/common/Dockerfile.st
clauseMDlines
.
append
(
mdLines
[
index
]
+
'
\n
'
)
clauseMDlines
.
append
(
mdLines
[
index
]
+
'
\n
'
)
index
=
index
+
1
index
=
index
+
1
else
:
else
:
clauseMDlines
=
readMDFile
(
progress
,
changed_clause
.
clause_nr
+
'
.md
'
)
clauseMDlines
=
readMDFile
(
progress
,
outDirectory
+
'
/
'
+
changed_clause
.
clause_nr
+
'
.md
'
)
j
=
change
.
target_start
-
changed_clause
.
from_id
# index gap
j
=
change
.
target_start
-
changed_clause
.
from_id
# index gap
for
line
in
change
:
for
line
in
change
:
...
...
This diff is collapsed.
Click to expand it.
generate_changemarks.sh
+
1
−
0
View file @
f09cdc3e
...
@@ -9,6 +9,7 @@ docker pull "$DOCKER_IMAGE"
...
@@ -9,6 +9,7 @@ docker pull "$DOCKER_IMAGE"
echo
"------ Removing previous outputs --------"
echo
"------ Removing previous outputs --------"
rm
**
/
*
.docx
rm
**
/
*
.docx
rm
out/
*
.md
echo
"------ Parsing repo URL --------"
echo
"------ Parsing repo URL --------"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment