Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a Perl script. Right?</p> <p>Why not let Perl figure out what 24 hours earlier time wise is, and then use <code>Time::Piece</code> to parse the Subversion dates?</p> <p>In fact, why are you using <code>svn info</code> and not simply <code>svn log --xml</code>. That will give you the history of all the changes, and you merely have to look at each date and see if it matches your older date.</p> <p>To get the time from 24 hours before, you can use this:</p> <pre><code>use Time::Piece use Time::Seconds #Constants that come in handy my $current_time = localtime; my $yesterday_time = $current_time - ONE_DAY; </code></pre> <p>Now, <code>$yesterday_time</code> is 24 hours before.</p> <p>If you use <code>XML::Simple</code>, you can get the format of the <code>svn log --xml $file</code> output into a handy structure. Here's a simple test program I wrote:</p> <pre class="lang-perl prettyprint-override"><code>#! /usr/bin/perl use strict; use warnings; use autodie; use feature qw(say); use XML::Simple qw(xml_in xml_out); use Time::Piece; use Time::Seconds; my $file_name = "?Some Name?"; my $now = localtime; my $yesterday_time = $now - ONE_DAY; open (my $xml_file, "-|", qq(svn log --xml "$file_name")); my $xml = xml_in($xml_file); # XML is a reference to a hash with a single key 'logentry' # This points to a reference to an array and each entry is # a reference to a hash that contains the four pieces to the # log entry. my $entries_ref = $xml-&gt;{logentry}; foreach my $entry (@{$entries_ref}) { # Each entry is a reference to a hash my $revision = $entry-&gt;{revision}; my $author = $entry-&gt;{author}; my $date = $entry-&gt;{date}; my $message = $entry-&gt;{msg}; # For giggles, we print out the four items. # In truth, there could be more than four items # in the hash if there was also a revprop too. say "$revision: $author: $date: $message"; # The date is in 100,000 of a second. We need to get # rid of everything on the other side of the seconds # decimal before we manipulate it. $date =~ s/\.\d+Z$//; # Get rid of 10,000 of seconds # Now, we can convert the "svn log" date to a Time::Piece my $rev_date = Time::Piece-&gt;strptime($date, "%Y-%m-%dT%H:%M:%S"); # Compare the rev date to the $yesterday_time date if ($rev_date &lt; $yesterday_time) { say "Revision $revision is older than one day" } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload