Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
git-repo-updater
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Debian Python Team
packages
git-repo-updater
Commits
41354a15
Commit
41354a15
authored
14 years ago
by
Ben Kurtovic
Browse files
Options
Downloads
Patches
Plain Diff
removed unnecessary get_tail_name() function and replaced with os.path.split()[1]
parent
67e3188d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gitup.py
+4
-9
4 additions, 9 deletions
gitup.py
with
4 additions
and
9 deletions
gitup.py
+
4
−
9
View file @
41354a15
...
...
@@ -55,13 +55,6 @@ def directory_is_git_repo(directory_path):
return
True
return
False
def
get_tail_name
(
path
):
"""
Return the name of the right-most directory in a path. Uses
os.path.split, but corrects for an error when the path ends with a /.
"""
if
path
.
endswith
(
"
/
"
):
return
os
.
path
.
split
(
path
[:
-
1
])[
1
]
return
os
.
path
.
split
(
path
)[
1
]
def
update_repository
(
repo_path
,
repo_name
):
"""
Update a single git repository by pulling from the remote.
"""
out
(
1
,
"
{}{}{}:
"
.
format
(
ansi
[
'
bold
'
],
repo_name
,
ansi
[
'
reset
'
]))
...
...
@@ -164,7 +157,8 @@ def update_directories(paths):
"""
Update a list of directories supplied by command arguments.
"""
for
path
in
paths
:
path
=
os
.
path
.
abspath
(
path
)
# convert relative to absolute path
update_directory
(
path
,
get_tail_name
(
path
),
is_bookmark
=
False
)
path_name
=
os
.
path
.
split
(
path
)[
1
]
# directory name; "x" in /path/to/x/
update_directory
(
path
,
path_name
,
is_bookmark
=
False
)
def
update_bookmarks
():
"""
Loop through and update all bookmarks.
"""
...
...
@@ -207,7 +201,8 @@ def add_bookmarks(paths):
if
config
.
has_option
(
"
bookmarks
"
,
path
):
out
(
1
,
"'
{}
'
is already bookmarked.
"
.
format
(
path
))
else
:
config
.
set
(
"
bookmarks
"
,
path
,
get_tail_name
(
path
))
path_name
=
os
.
path
.
split
(
path
)[
1
]
config
.
set
(
"
bookmarks
"
,
path
,
path_name
)
out
(
1
,
"
{}{}{}
"
.
format
(
ansi
[
'
bold
'
],
path
,
ansi
[
'
reset
'
]))
save_config_file
(
config
)
...
...
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