Skip to content

Commit

Permalink
[backend] fix timezone handling in .changes merge tool
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Oct 30, 2014
1 parent b28e23b commit 86aa923
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
@@ -1,15 +1,15 @@
-------------------------------------------------------------------
Thu Oct 30 09:57:13 UTC 2014 - adrian@suse.de
Thu Oct 30 08:57:13 UTC 2014 - adrian@suse.de

- new change upstream

-------------------------------------------------------------------
Thu Oct 30 09:57:11 UTC 2014 - adrian@suse.de
Thu Oct 30 08:57:11 UTC 2014 - adrian@suse.de

- new change in branch

-------------------------------------------------------------------
Sat Jun 3 00:00:00 UTC 2006 - adrian@suse.de
Fri Jun 2 22:00:00 UTC 2006 - adrian@suse.de

- One old entry

Expand Down
2 changes: 1 addition & 1 deletion src/api/test/functional/source_controller_test.rb
Expand Up @@ -2462,7 +2462,7 @@ def test_branch_and_merge_changes
assert_response :success
get '/source/home:Iggy/kdelibs_branch/kdelibs.changes?expand=1'
assert_response :success
assert_equal @response.body, File.open("#{Rails.root}/test/fixtures/backend/source/kde4/kdelibs/kdelibs.changes.merged").read
assert_equal File.open("#{Rails.root}/test/fixtures/backend/source/kde4/kdelibs/kdelibs.changes.merged").read, @response.body

#cleanup
delete '/source/home:Iggy/kdelibs_branch'
Expand Down
10 changes: 6 additions & 4 deletions src/backend/bs_mergechanges
Expand Up @@ -89,7 +89,7 @@ my %entries;

sub time2mystr {
my ($time) = @_;
my @lt = localtime($time);
my @lt = gmtime($time);
# ctime(3) format output
return strftime("%a %b %e %H:%M:%S UTC %Y", @lt);
}
Expand Down Expand Up @@ -133,7 +133,7 @@ while (@files) {

unless($time) {
my ($timestr, $emailstr) = split(' - ', $line, 2);
$time = str2time($timestr, "UTC");
$time = str2time($timestr);
die("unable to parse time $line") unless $time;
$email = $emailstr;
die("unable to find email in time line") unless $email;
Expand All @@ -142,10 +142,12 @@ while (@files) {
}

if ($line eq $seperator) {
my @lt = localtime($time);
my @lt = gmtime($time);
# check for the special case, we had many entries at 00:00:00 on same day in the past ...
# ignoring the hour due to timezone issues, but do not accept it anymore for current entries
# we take this as one blob.
if ( $lt[0] != 0 || $lt[1] != 0 || $lt[2] != 0) {
# Accept this only for entries in 2006 and before with 00 minutes and 00 seconds
if ( $lt[5] > 106 || $lt[1] != 0 || $lt[0] != 0) {
setentry($time, $email, $text);
$text = "";
$time = undef;
Expand Down

0 comments on commit 86aa923

Please sign in to comment.