summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-03-27 13:49:07 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-03-27 13:49:07 -0700
commita19e9b64a606deb2859244814911d35ba31bd1be (patch)
tree900a0a32146539fd62c46cb48bab8063512abca4
parent6cd6f55344b81a07cfd0a12a516c7cc88b4a8f00 (diff)
parentd8cb539465e002f77f4766b03942344c2491b3ae (diff)
downloadp5-Git-Annex-a19e9b64a606deb2859244814911d35ba31bd1be.tar.gz
Merge tag 'debian/0.006-1' into buster-bpo
libgit-annex-perl release 0.006-1 for unstable (sid) [dgit] [dgit distro=debian no-split --quilt=linear] # gpg: Signature made Tue 24 Mar 2020 11:12:35 AM MST # gpg: using RSA key 9B917007AE030E36E4FC248B695B7AE4BF066240 # gpg: Good signature from "Sean Whitton <spwhitton@spwhitton.name>" [ultimate] # Primary key fingerprint: 8DC2 487E 51AB DD90 B5C4 753F 0F56 D055 3B6D 411B # Subkey fingerprint: 9B91 7007 AE03 0E36 E4FC 248B 695B 7AE4 BF06 6240
-rw-r--r--Changes14
-rwxr-xr-xbin/annex-to-annex-dropunused2
-rw-r--r--debian/changelog18
-rw-r--r--dist.ini2
-rw-r--r--lib/App/annex_review_unused.pm74
-rw-r--r--lib/App/annex_to_annex_reinject.pm1
6 files changed, 79 insertions, 32 deletions
diff --git a/Changes b/Changes
index 7d72e95..a7995b0 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,20 @@ Revision history for Git::Annex
{{$NEXT}}
+0.006 2020-03-23 17:02:28-07:00 America/Phoenix
+ - annex-review-unused: Check whether unused files still exist earlier.
+ Avoids misleading output when --just-print is supplied.
+
+0.005 2020-03-23 11:55:48-07:00 America/Phoenix
+ - annex-review-unused: Add missing prompt_yn subroutine.
+ - annex-review-unused: Always pass --force to 'git annex dropunused'.
+ Previously it couldn't be passed at all, which is much less useful.
+
+0.004 2020-03-18 17:08:57-07:00 America/Phoenix
+ - annex-to-annex-dropunused: Fix attempt to call wrong main()
+ routine.
+ - annex-to-annex-reinject: Add missing import of File::Temp.
+
0.003 2020-03-11 14:35:04-07:00 America/Phoenix
- annex-to-annex: Fix path passed to git-annex-find(1) when
looking for missing files.
diff --git a/bin/annex-to-annex-dropunused b/bin/annex-to-annex-dropunused
index bbbea80..c09cdc5 100755
--- a/bin/annex-to-annex-dropunused
+++ b/bin/annex-to-annex-dropunused
@@ -41,4 +41,4 @@ git-annex-dropunused(1), annex-to-annex(1), annex-to-annex-reinject(1)
=cut
use App::annex_to_annex_dropunused;
-exit App::annex_to_annex->main;
+exit App::annex_to_annex_dropunused->main;
diff --git a/debian/changelog b/debian/changelog
index 9ba004c..45a0950 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
+libgit-annex-perl (0.006-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Tue, 24 Mar 2020 11:12:23 -0700
+
+libgit-annex-perl (0.005-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Mon, 23 Mar 2020 12:03:32 -0700
+
+libgit-annex-perl (0.004-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Sean Whitton <spwhitton@spwhitton.name> Wed, 18 Mar 2020 17:30:48 -0700
+
libgit-annex-perl (0.003-1~bpo10+1) buster-backports; urgency=medium
* Rebuild for buster-backports.
diff --git a/dist.ini b/dist.ini
index a85f87c..1d52ed8 100644
--- a/dist.ini
+++ b/dist.ini
@@ -4,7 +4,7 @@ license = GPL_3
copyright_holder = Sean Whitton <spwhitton@spwhitton.name>
copyright_year = 2019-2020
-version = 0.003
+version = 0.006
[PkgVersion]
[PodWeaver]
diff --git a/lib/App/annex_review_unused.pm b/lib/App/annex_review_unused.pm
index 22e7a56..dd2ed23 100644
--- a/lib/App/annex_review_unused.pm
+++ b/lib/App/annex_review_unused.pm
@@ -67,7 +67,28 @@ sub main {
$unused_opts{used_refspec} = $used_refspec_arg if $used_refspec_arg;
my @to_drop;
- my @unused_files = @{ $annex->unused(%unused_opts, log => 1) };
+ my @unused_files = grep {
+ # check the unused file still exists i.e. has not been dropped
+ # already (in the case of reviewing unused files at a remote,
+ # just check that it's not been dropped according to the local
+ # git-annex branch by using readpresentkey rather than
+ # checkpresentkey)
+
+ my $ret = $_->{contentlocation}
+ = $annex->abs_contentlocation($_->{key});
+
+ if ($from_arg) {
+ #<<<
+ try {
+ $annex->annex->readpresentkey($_->{key}, $uuid);
+ } catch {
+ $ret = 0;
+ };
+ #>>>
+ }
+
+ $ret;
+ } $annex->unused(%unused_opts, log => 1)->@*;
exit unless @unused_files;
if ($just_print) {
_say_spaced_bullet("There are unused files you can drop with"
@@ -77,27 +98,8 @@ sub main {
}
my $i = 0;
UNUSED: while ($i < @unused_files) {
- my $unused_file = $unused_files[$i];
-
- # check the unused file still exists i.e. has not been dropped
- # already (in the case of reviewing unused files at a remote, just
- # check that it's not been dropped according to the local
- # git-annex branch by using readpresentkey rather than
- # checkpresentkey)
- my $contentlocation = $annex->abs_contentlocation($unused_file->{key});
- if ($from_arg) {
- #<<<
- try {
- $annex->annex->readpresentkey($unused_file->{key}, $uuid);
- } catch {
- splice @unused_files, $i, 1;
- next UNUSED;
- };
- #>>>
- } elsif (!$contentlocation) {
- splice @unused_files, $i, 1;
- next UNUSED;
- }
+ my $unused_file = $unused_files[$i];
+ my $contentlocation = $unused_file->{contentlocation};
system qw(clear -x) unless $just_print;
_say_bold("unused file #" . $unused_file->{number} . ":");
@@ -110,9 +112,9 @@ sub main {
unless ($just_print) {
# truncate log output if necessary to ensure user's
# terminal does not scroll
- my (undef, $height) = GetTerminalSize();
- splice @log_lines, (($height - 5) - @log_lines)
- if @log_lines > ($height - 5);
+ my (undef, $height) = GetTerminalSize;
+ splice @log_lines, $height - (5 + @log_lines)
+ if 5 + @log_lines > $height;
}
print "\n";
say for @log_lines;
@@ -137,7 +139,7 @@ sub main {
ReadMode 0;
# respond to C-c
- exit 0 if ord($response) == 3;
+ exit 0 if ord $response == 3;
say $response;
$response = lc($response);
@@ -170,11 +172,10 @@ sub main {
}
if (@to_drop) {
- _say_spaced_bullet("Will dropunused"
- . (exists $dropunused_args{force} ? " with --force:" : ":"));
+ _say_spaced_bullet("Will dropunused with --force:");
say "@to_drop\n";
- $annex->annex->dropunused(\%dropunused_args, @to_drop)
- if prompt_yn("Go ahead with this?");
+ $annex->annex->dropunused(\%dropunused_args, "--force", @to_drop)
+ if _prompt_yn("Go ahead with this?");
}
# exit value represents whether or not there are any unused files left
@@ -192,6 +193,19 @@ sub _say_bullet { _say_bold(" • ", @_) }
sub _say_spaced_bullet { _say_bold("\n", " • ", @_, "\n") }
+sub _prompt_yn {
+ my $prompt = shift;
+ local $| = 1;
+ my $response;
+ while (1) {
+ print colored(['bold'], "$prompt ");
+ chomp(my $response = <STDIN>);
+ return 1 if lc($response) eq "y";
+ return 0 if lc($response) eq "n";
+ say "invalid response";
+ }
+}
+
sub exit { $exit_main = shift // 0; goto EXIT_MAIN }
1;
diff --git a/lib/App/annex_to_annex_reinject.pm b/lib/App/annex_to_annex_reinject.pm
index 5a0296f..e28e3c5 100644
--- a/lib/App/annex_to_annex_reinject.pm
+++ b/lib/App/annex_to_annex_reinject.pm
@@ -29,6 +29,7 @@ use File::Path qw(rmtree);
use File::Spec::Functions qw(rel2abs);
use File::Find;
use Try::Tiny;
+use File::Temp qw(tempdir);
exit main() unless caller;