diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-08-03 20:57:41 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-08-05 11:38:04 -0700 |
commit | 92f40ef00c636e3d34cc4eda0d247d8f4a657830 (patch) | |
tree | c010ae6b2c5defa136cb09963989535494132e5c | |
parent | c54083d67713066b187430990ff8376db55f9e02 (diff) | |
download | dotfiles-92f40ef00c636e3d34cc4eda0d247d8f4a657830.tar.gz |
commit script used for first rearrangement ~/doc/{org => howm}
-rwxr-xr-x | scripts/git/sort-into-yyyy | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/git/sort-into-yyyy b/scripts/git/sort-into-yyyy new file mode 100755 index 00000000..46939e91 --- /dev/null +++ b/scripts/git/sort-into-yyyy @@ -0,0 +1,26 @@ +#!/usr/bin/perl -w + +use Cwd; +use File::Copy; +use Git::Wrapper; + +$git = Git::Wrapper->new(getcwd); + +open $fh, "<", "$ENV{HOME}/doc/emacs-org-agenda-files"; +for (<$fh>) { + chomp; + s{^~/doc/}{}; + $agenda_files{m{^org/} ? $_ : "org/$_"}++; +} + +mkdir "howm"; + +for (@ARGV) { + $agenda_files{$_} and next; + @entries = $git->log("--follow", "--diff-filter=A", $_); + $entries[$#entries]->date =~ /\s(\d{4})\s/ + or die "invalid date? " . $entries[$#entries]->date; + mkdir "howm/$1"; + $git->mv($_, "howm/$1"); + print "$_ -> howm/$1\n"; +} |