Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lintian-brush
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Jeroen Dekkers
lintian-brush
Commits
47606bcf
Commit
47606bcf
authored
Oct 29, 2018
by
Jelmer Vernooij
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Obey git global and per-tree committer settings.
parent
f9f402ad
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
1 deletion
+68
-1
debian/changelog
debian/changelog
+1
-0
lintian_brush/__init__.py
lintian_brush/__init__.py
+20
-1
lintian_brush/tests/test_run.py
lintian_brush/tests/test_run.py
+47
-0
No files found.
debian/changelog
View file @
47606bcf
...
...
@@ -6,6 +6,7 @@ lintian-brush (0.2) UNRELEASED; urgency=medium
* Add --verbose option.
* Fix running of specific fixers.
* Add missing dependency on python3-dulwich. Closes: #912219
* Obey git global and per-tree committer settings.
-- Jelmer Vernooij <jelmer@debian.org> Sun, 28 Oct 2018 15:44:06 +0000
...
...
lintian_brush/__init__.py
View file @
47606bcf
...
...
@@ -28,6 +28,8 @@ import warnings
from
breezy
import
ui
import
breezy.bzr
# noqa: F401
import
breezy.git
# noqa: F401
from
breezy.clean_tree
import
(
iter_deletables
,
)
...
...
@@ -225,6 +227,22 @@ def delete_items(deletables, dry_run=False):
'unable to remove "{0}": {1}.'
.
format
(
path
,
e
.
strerror
))
def
get_committer
(
tree
):
"""Get the committer string for a tree.
Args:
tree: A Tree object
Returns:
A committer string
"""
# TODO(jelmer): Perhaps this logic should be in Breezy?
if
getattr
(
tree
.
branch
.
repository
,
'_git'
,
None
):
return
tree
.
branch
.
repository
.
_git
.
_get_user_identity
()
else
:
config
=
tree
.
branch
.
get_config_stack
()
return
config
.
get
(
'email'
)
def
run_lintian_fixer
(
local_tree
,
fixer
,
update_changelog
=
True
):
"""Run a lintian fixer on a tree.
...
...
@@ -284,7 +302,8 @@ def run_lintian_fixer(local_tree, fixer, update_changelog=True):
"for more details.
\n
"
)
%
tag
local_tree
.
commit
(
description
,
allow_pointless
=
False
,
reporter
=
NullCommitReporter
())
reporter
=
NullCommitReporter
(),
committer
=
get_committer
(
local_tree
))
# TODO(jelmer): Run sbuild & verify lintian warning is gone?
return
result
.
fixed_lintian_tags
,
summary
...
...
lintian_brush/tests/test_run.py
View file @
47606bcf
...
...
@@ -220,6 +220,53 @@ Arch: all
[],
list
(
self
.
tree
.
iter_changes
(
self
.
tree
.
basis_tree
())))
class
HonorsVcsCommitter
(
TestCaseWithTransport
):
def
make_package_tree
(
self
,
format
):
tree
=
self
.
make_branch_and_tree
(
'.'
,
format
=
format
)
self
.
build_tree_contents
([
(
'debian/'
,
),
(
'debian/control'
,
"""
\
Source: blah
Vcs-Git: https://example.com/blah
Testsuite: autopkgtest
Binary: blah
Arch: all
"""
),
CHANGELOG_FILE
])
tree
.
add
([
'debian'
,
'debian/changelog'
,
'debian/control'
])
tree
.
commit
(
'Initial thingy.'
)
return
tree
def
make_change
(
self
,
tree
):
with
tree
.
lock_write
():
fixed_tags
,
summary
=
run_lintian_fixer
(
tree
,
DummyFixer
(
'dummy'
,
'some-tag'
),
update_changelog
=
False
)
self
.
assertEqual
(
summary
,
"Fixed some tag."
)
self
.
assertEqual
([
'some-tag'
],
fixed_tags
)
self
.
assertEqual
(
2
,
tree
.
branch
.
revno
())
self
.
assertEqual
(
tree
.
get_file_lines
(
'debian/control'
)[
-
1
],
b
"a new line
\n
"
)
def
test_honors_tree_committer_config
(
self
):
tree
=
self
.
make_package_tree
(
'git'
)
with
open
(
os
.
path
.
join
(
tree
.
basedir
,
'.git/config'
),
'w'
)
as
f
:
f
.
write
(
"""
\
[user]
email = jane@example.com
name = Jane Example
"""
)
self
.
make_change
(
tree
)
rev
=
tree
.
branch
.
repository
.
get_revision
(
tree
.
branch
.
last_revision
())
self
.
assertEqual
(
rev
.
committer
,
'Jane Example <jane@example.com>'
)
# TODO(jelmer): run_lintian_fixers
...
...
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