Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
oh-my-fish
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
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
nanahira
oh-my-fish
Commits
0699c9ff
Commit
0699c9ff
authored
Mar 27, 2016
by
Derek Willian Stavis
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #285 from oranja/pkg-uptodate
omf update: Report up-to-date packages as such
parents
2526efd9
720c499e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
39 deletions
+46
-39
pkg/omf/functions/packages/omf.packages.update.fish
pkg/omf/functions/packages/omf.packages.update.fish
+17
-12
pkg/omf/functions/repo/omf.repo.pull.fish
pkg/omf/functions/repo/omf.repo.pull.fish
+29
-27
No files found.
pkg/omf/functions/packages/omf.packages.update.fish
View file @
0699c9ff
function omf.packages.update -a name
function omf.packages.update -a name
if set target_path (omf.packages.path $name)
if not set target_path (omf.packages.path $name)
# Skip packages outside version control
echo (omf::err)"Could not find $name."(omf::off) 1>&2
not test -e $target_path/.git;
return 1
and return 0
end
# Skip packages outside version control
not test -e $target_path/.git;
and return 0
if omf.repo.pull $target_path
omf.repo.pull $target_path
switch $status
case 0
omf.bundle.install $target_path/bundle
omf.bundle.install $target_path/bundle
echo (omf::em)"$name successfully updated."(omf::off)
echo (omf::em)"$name successfully updated."(omf::off)
return 0
case 1
else
echo (omf::err)"Could not update $name."(omf::off) 1>&2
echo (omf::err)"Could not update $name."(omf::off) 1^&2
return 1
end
case 2
else
echo (omf::dim)"$name is already up-to-date."(omf::off)
echo (omf::err)"Could not find $name."(omf::off) 1^&2
end
end
return
1
return
0
end
end
pkg/omf/functions/repo/omf.repo.pull.fish
View file @
0699c9ff
function omf.repo.pull
function omf.repo.pull
if test (count $argv) -eq 0
if test (count $argv) -eq 0
echo (omf::err)"
Argument of omf.repo.pull is the repo path."(omf::off)
echo (omf::err)"
omf.repo.pull takes a repository path as an argument."(omf::off) 1>&2
return $OMF_MISSING_ARG
return $OMF_MISSING_ARG
end
end
set -l repo_dir $argv[1]
set -l repo_dir $argv[1]
function omf.repo.git -V repo_dir
function __omf.repo.git -V repo_dir
command git --git-dir "$repo_dir"/.git --work-tree "$repo_dir" $argv
command git -C "$repo_dir" $argv
end
function omf.repo.git.stash -V repo_dir
command git -C "$repo_dir" stash $argv
end
end
set -l remote origin
set -l remote origin
if test (omf.repo.git config --get remote.upstream.url)
if test (
__
omf.repo.git config --get remote.upstream.url)
set remote upstream
set remote upstream
end
end
set initial_branch (omf.repo.git symbolic-ref -q --short HEAD);
set initial_branch (__omf.repo.git symbolic-ref -q --short HEAD);
or return $OMF_UNKNOWN_ERR
or return 1
set initial_revision (omf.repo.git rev-parse -q --verify HEAD);
set initial_revision (__omf.repo.git rev-parse -q --verify HEAD);
or return $OMF_UNKNOWN_ERR
or return 1
# the refspec ensures that '$remote/master' gets updated
set -l refspec "refs/heads/master:refs/remotes/$remote/master"
__omf.repo.git fetch --quiet $remote $refspec;
or return 1
if test (__omf.repo.git rev-list --count master...FETCH_HEAD) -eq 0
return 2
end
if not omf.repo.git diff --quiet
if not
__
omf.repo.git diff --quiet
echo (omf::em)"Stashing your changes:"(omf::off)
echo (omf::em)"Stashing your changes:"(omf::off)
omf.repo.git status --short --untracked-files
__
omf.repo.git status --short --untracked-files
omf.repo.git.
stash save --include-untracked --quiet;
__omf.repo.git
stash save --include-untracked --quiet;
and set stashed
and set stashed
end
end
if test "$initial_branch" != master
if test "$initial_branch" != master
omf.repo.git checkout master --quiet
__
omf.repo.git checkout master --quiet
end
end
set -l refspec "refs/heads/master:refs/remotes/$remote/master"
if not __omf.repo.git merge --ff-only --quiet FETCH_HEAD
__omf.repo.git checkout $initial_branch
# the refspec ensures that '$remote/master' gets updated
__omf.repo.git reset --hard $initial_revision
if not omf.repo.git pull --ff-only --quiet $remote $refspec
set -q stashed; and __omf.repo.git stash pop
omf.repo.git checkout $initial_branch
return 1
omf.repo.git reset --hard $initial_revision
set -q stashed; and omf.repo.git.stash pop
end
end
if test "$initial_branch" != master
if test "$initial_branch" != master
omf.repo.git checkout $initial_branch --quiet
__
omf.repo.git checkout $initial_branch --quiet
end
end
if set -q stashed
if set -q stashed
omf.repo.git.
stash pop --quiet
__omf.repo.git
stash pop --quiet
echo (omf::em)"Restored your changes:"(omf::off)
echo (omf::em)"Restored your changes:"(omf::off)
command git -C "$repo_dir"
status --short --untracked-files
__omf.repo.git
status --short --untracked-files
end
end
functions -e omf.repo.git{,.stash}
return 0
return 0
end
end
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