Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
arch-svn-package-to-git
Commits
06005305
Verified
Commit
06005305
authored
Nov 05, 2022
by
Levente Polyak
🚀
Browse files
helper: add command to clean up pkgs converted but removed from repos
parent
23e9527a
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
06005305
...
...
@@ -12,6 +12,7 @@ collection and history/content rewrite.
-
bash
-
findutils
-
coreutils
-
diffutils
-
grep
### Rewrites:
...
...
@@ -130,3 +131,7 @@ gitsvn-repo-helper configure repos/community
##### Fresh clone of the community repo:
gitsvn-repo-helper clone community
##### Clean up old converted packages that were removed from the repos:
gitsvn-repo-helper clean repos/packages/ repos/svntogit/community/ repos/svntogit/packages/
gitsvn-repo-helper
View file @
06005305
...
...
@@ -19,6 +19,11 @@ usage() {
Clones the gitsvn repo as mirror and fetch all refs into the target dir.
REPO can be an url or one of: community, packages
TARGET is an optional path and defaults to the repo basename
or:
${
BASH_SOURCE
[0]
}
clean PKGDIR REPOS...
Cleans the directory containing packages by deleting all that are not in any of the repos.
PKGDIR the directory containing all converted packages
REPOS... all available repos to search packages in
_EOF_
}
...
...
@@ -85,6 +90,20 @@ clone() {
git_pack_refs
"
${
target
}
"
}
clean
()
{
pkgdir
=
$1
shift
for
pkg
in
$(
diff
--unified
=
10000
\
--minimal
\
<
(
list_packages
"
$@
"
|
sort
-u
)
\
<
(
find
"
$pkgdir
"
-mindepth
1
-maxdepth
1
-type
d
-printf
'%f\n'
|
sort
-u
)
\
|
tail
+4
\
|
grep
-E
'^\+'
\
|
sed
-E
's/\+(.+)/\1/'
)
;
do
rm
-rfvi
"
${
pkgdir
:?
}
/
${
pkg
:?
}
"
done
}
git_pack_refs
()
{
repo
=
"
$1
"
git
-C
"
${
repo
}
"
pack-refs
--all
...
...
@@ -130,6 +149,13 @@ case $1 in
require_args
$#
1
clone
"
$1
"
"
$2
"
;;
clean
)
shift
;
require_args
$#
2
pkgdir
=
$1
shift
clean
"
$pkgdir
"
"
$@
"
;;
-h
|
--help
)
usage
;;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment