Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Seblu
installsystems
Commits
59d2fa7d
Commit
59d2fa7d
authored
13 years ago
by
Sebastien Luttringer
Browse files
Options
Downloads
Patches
Plain Diff
remove double definition of last in repository
parent
3a2b19b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
installsystems/repository.py
+8
-19
8 additions, 19 deletions
installsystems/repository.py
with
8 additions
and
19 deletions
installsystems/repository.py
+
8
−
19
View file @
59d2fa7d
...
...
@@ -135,16 +135,16 @@ class Repository(object):
except
Exception
as
e
:
raise
Exception
(
"
Update last file failed: %s
"
%
e
)
def
last
(
self
):
def
last
(
self
,
name
):
'''
Return
the
last v
alue
Return last v
ersion of name in repo or -1 if not found
'''
try
:
last_path
=
os
.
path
.
join
(
config
.
path
,
config
.
lastname
)
return
int
(
open
(
last_path
,
"
r
"
).
read
().
rstrip
())
except
Exception
as
e
:
raise
Exception
(
"
Read last file failed: %s
"
%
e
)
return
0
r
=
self
.
db
.
ask
(
"
SELECT version FROM image WHERE name = ? ORDER BY version DESC LIMIT 1
"
,
(
name
,)).
fetchone
()
# no row => no way
if
r
is
None
:
return
-
1
# return last
return
r
[
0
]
def
add
(
self
,
image
,
delete
=
False
):
'''
...
...
@@ -433,17 +433,6 @@ class Repository(object):
(
a
[
0
],)).
fetchall
()
return
[
a
[
0
]
]
+
[
x
[
0
]
for
x
in
b
]
def
last
(
self
,
name
):
'''
Return last version of name in repo or -1 if not found
'''
r
=
self
.
db
.
ask
(
"
SELECT version FROM image WHERE name = ? ORDER BY version DESC LIMIT 1
"
,
(
name
,)).
fetchone
()
# no row => no way
if
r
is
None
:
return
-
1
# return last
return
r
[
0
]
class
RepositoryManager
(
object
):
'''
...
...
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