Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
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
Stefane Fermigier
neo
Commits
188c55f9
Commit
188c55f9
authored
Nov 17, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neolog: add support for xz-compressed logs, using external xzcat commands
parent
9ee4e04d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
neo/scripts/neolog.py
neo/scripts/neolog.py
+6
-3
No files found.
neo/scripts/neolog.py
View file @
188c55f9
...
@@ -22,7 +22,7 @@ from bisect import insort
...
@@ -22,7 +22,7 @@ from bisect import insort
from
logging
import
getLevelName
from
logging
import
getLevelName
from
zlib
import
decompress
from
zlib
import
decompress
comp_dict
=
dict
(
bz2
=
bz2
.
BZ2File
,
gz
=
gzip
.
GzipFile
)
comp_dict
=
dict
(
bz2
=
bz2
.
BZ2File
,
gz
=
gzip
.
GzipFile
,
xz
=
'xzcat'
)
class
Log
(
object
):
class
Log
(
object
):
...
@@ -46,8 +46,11 @@ class Log(object):
...
@@ -46,8 +46,11 @@ class Log(object):
os
.
stat
(
db_path
)
# do not create empty DB if file is missing
os
.
stat
(
db_path
)
# do not create empty DB if file is missing
self
.
_db
=
sqlite3
.
connect
(
db_path
)
self
.
_db
=
sqlite3
.
connect
(
db_path
)
else
:
else
:
import
shutil
,
tempfile
import
shutil
,
subprocess
,
tempfile
with
tempfile
.
NamedTemporaryFile
()
as
f
:
with
tempfile
.
NamedTemporaryFile
()
as
f
:
if
type
(
ZipFile
)
is
str
:
subprocess
.
check_call
((
ZipFile
,
db_path
),
stdout
=
f
)
else
:
shutil
.
copyfileobj
(
ZipFile
(
db_path
),
f
)
shutil
.
copyfileobj
(
ZipFile
(
db_path
),
f
)
self
.
_db
=
sqlite3
.
connect
(
f
.
name
)
self
.
_db
=
sqlite3
.
connect
(
f
.
name
)
name
=
name
.
rsplit
(
os
.
extsep
,
1
)[
0
]
name
=
name
.
rsplit
(
os
.
extsep
,
1
)[
0
]
...
...
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