-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathupdate-subtree.pl
More file actions
executable file
·27 lines (23 loc) · 872 Bytes
/
Copy pathupdate-subtree.pl
File metadata and controls
executable file
·27 lines (23 loc) · 872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env perl6
my %subtrees =
'ext/File__Find' => 'git://github.com/tadzik/File-Find.git',
'ext/File__Which' => 'git://github.com/azawawi/perl6-file-which.git',
'ext/JSON__Fast' => 'git://github.com/timo/json_fast.git',
'ext/Shell__Command' => 'git://github.com/tadzik/Shell-Command.git',
;
sub update-one(Str() $prefix is copy) {
$prefix.=chop if substr($prefix, *-1) eq '/';
my $url = %subtrees{$prefix} // die "$prefix is not a known subtree directory"
~ " (known dirs: { %subtrees.keys.sort.join: ', ' }";
my $cmd = $prefix.IO.e ?? 'pull' !! 'add';
run 'git', 'subtree', $cmd, '--prefix', $prefix, $url, 'master', '--squash';
}
sub MAIN(Str $prefix) {
if $prefix eq 'all' {
update-one($_) for keys %subtrees;
}
else {
update-one($prefix);
}
}
# vim: ft=perl6