{"thread":{"id":"51406","subject":"Why \"Updated upstream\" block is so small?","startedAt":"2019-06-29T10:11:34Z","lastAt":"2019-06-29T10:23:34Z","messageCount":2,"participants":["Eugen Konkov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"378323","messageId":"1936584831.20190629130545@yandex.ru","threadId":"51406","inReplyTo":null,"subject":"Why \"Updated upstream\" block is so small?","fromName":"Eugen Konkov","fromEmail":"kes-kes@yandex.ru","sentAt":"2019-06-29T10:05:45Z","receivedAt":"2019-06-29T10:11:34Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"Hello\n\nI want to apply this patch from stage:\n\ndiff --git a/lib/App/Schema/Result/Invoice.pm b/lib/App/Schema/Result/Invoice.pm\nindex 0176916f..0ce2d698 100644\n--- a/lib/App/Schema/Result/Invoice.pm\n+++ b/lib/App/Schema/Result/Invoice.pm\n@@ -219,14 +219,14 @@ sub new_package {\n     # my $package_type =  $package->Invoice->Order->Tariff->type;\n     my $pass =  $package->password;\n     ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n-    $sth->execute( $package->login, 'NT-Password', ':=', $pass );\n+    $sth->execute( $package->login, 'NT-Password', ':=', $pass //'');\n     $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n \n     $sth =  $radius_dbh->prepare(\n         \"INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n     );\n     my $ip =  $package->Ips->first;\n-    $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n+    # $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n \n     $radius_dbh->commit;\n     # NOTICE: This is a bit inconsistent\n\n\nafter applying I get merge conflict:\n\n\ndiff --cc lib/App/Schema/Result/Invoice.pm\nindex e3f55654,0ce2d698..00000000\n--- a/lib/App/Schema/Result/Invoice.pm\n+++ b/lib/App/Schema/Result/Invoice.pm\n@@@ -211,33 -204,34 +211,87 @@@ sub new_package \n     }\n  \n     ## Create radius account\n +   eval{\n         my $radius_dbh =  $self->result_source->storage->schema->{ _radius_dbh };\n -   if( !$radius_dbh->FETCH('AutoCommit') ) {\n +       $radius_dbh->begin_work;\n +       my $sth =  $radius_dbh->prepare(\n +           \"INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)\"\n +       );\n +       $sth->execute( $package->login );\n +\n +       $sth =  $radius_dbh->prepare(\n +           \"INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )\"\n +       );\n +       # my $package_type =  $package->Invoice->Order->Tariff->type;\n +       my $pass =  $package->password;\n +       ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n +       $sth->execute( $package->login, 'NT-Password', ':=', $pass //'' );\n +       $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n +\n +       $sth =  $radius_dbh->prepare(\n +           \"INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n +       );\n +       my $ip =  $package->Ips->first;\n +       $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n +\n         $radius_dbh->commit;\n++<<<<<<< Updated upstream\n +       # NOTICE: This is a bit inconsistent\n +       # if whole payment failed we will have radius account without payment\n +   };\n++||||||| merged common ancestors\n++   }\n++   $radius_dbh->begin_work;\n++   my $sth =  $radius_dbh->prepare(\n++       \"INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)\"\n++   );\n++   $sth->execute( $package->login );\n++\n++   $sth =  $radius_dbh->prepare(\n++       \"INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )\"\n++   );\n++   # my $package_type =  $package->Invoice->Order->Tariff->type;\n++   my $pass =  $package->password;\n++   ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n++   $sth->execute( $package->login, 'NT-Password', ':=', $pass );\n++   $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n++\n++   $sth =  $radius_dbh->prepare(\n++       \"INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n++   );\n++   my $ip =  $package->Ips->first;\n++   $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n++\n++   $radius_dbh->commit;\n++   # NOTICE: This is a bit inconsistent\n++   # if whole payment failed we will have radius account without payment\n++=======\n+    }\n+    $radius_dbh->begin_work;\n+    my $sth =  $radius_dbh->prepare(\n+        \"INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)\"\n+    );\n+    $sth->execute( $package->login );\n+ \n+    $sth =  $radius_dbh->prepare(\n+        \"INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )\"\n+    );\n+    # my $package_type =  $package->Invoice->Order->Tariff->type;\n+    my $pass =  $package->password;\n+    ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n+    $sth->execute( $package->login, 'NT-Password', ':=', $pass //'');\n+    $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n+ \n+    $sth =  $radius_dbh->prepare(\n+        \"INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n+    );\n+    my $ip =  $package->Ips->first;\n+    # $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n+ \n+    $radius_dbh->commit;\n+    # NOTICE: This is a bit inconsistent\n+    # if whole payment failed we will have radius account without payment\n++>>>>>>> Stashed changes\n  \n  \n     return $package;\n\n\n\nWhy updated upstream block is so small?\n\n++<<<<<<< Updated upstream\n +       # NOTICE: This is a bit inconsistent\n +       # if whole payment failed we will have radius account without payment\n +   };\n++||||||| merged common ancestors\n\n \nI suppose it should start from to line line:\n\n     +       $radius_dbh->begin_work;\n     ...\n    +    # if whole payment failed we will have radius account without payment\n\n\n\n\n-- \nBest regards,\nEugen Konkov\n\n"},{"id":"378324","messageId":"542494034.20190629132325@yandex.ru","threadId":"51406","inReplyTo":"1936584831.20190629130545@yandex.ru","subject":"Re: Why \"Updated upstream\" block is so small?","fromName":"Eugen Konkov","fromEmail":"kes-kes@yandex.ru","sentAt":"2019-06-29T10:23:25Z","receivedAt":"2019-06-29T10:23:34Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"Hello Eugen,\n\nIf I do space changes to lines as next:\n\n        ## Create radius account\n        eval{\n        my $radius_dbh =  $self->result_source->storage->schema->{ _radius_dbh };\n        $radius_dbh->begin_work;\n        my $sth =  $radius_dbh->prepare(\n                \"INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)\"\n        );\n        $sth->execute( $package->login );\n\n        $sth =  $radius_dbh->prepare(\n                \"INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )\"\n        );\n        # my $package_type =  $package->Invoice->Order->Tariff->type;\n        my $pass =  $package->password;\n        ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n        $sth->execute( $package->login, 'NT-Password', ':=', $pass //'' );\n        $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n\n        $sth =  $radius_dbh->prepare(\n                \"INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n        );\n        my $ip =  $package->Ips->first;\n        $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n\n        $radius_dbh->commit;\n        # NOTICE: This is a bit inconsistent\n        # if whole payment failed we will have radius account without payment\n        };\n\n\nand `git stash apply` then I get expected result:\n\ndiff --cc lib/App/Schema/Result/Invoice.pm\nindex 07e1b373,0ce2d698..00000000\n--- a/lib/App/Schema/Result/Invoice.pm\n+++ b/lib/App/Schema/Result/Invoice.pm\n@@@ -223,23 -217,22 +223,29 @@@ sub new_package \n         \"INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )\"\n     );\n     # my $package_type =  $package->Invoice->Order->Tariff->type;\n     my $pass =  $package->password;\n     ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n++<<<<<<< Updated upstream\n     $sth->execute( $package->login, 'NT-Password', ':=', $pass //'' );\n++||||||| merged common ancestors\n++   $sth->execute( $package->login, 'NT-Password', ':=', $pass );\n++=======\n++   $sth->execute( $package->login, 'NT-Password', ':=', $pass //'');\n++>>>>>>> Stashed changes\n     $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n  \n     $sth =  $radius_dbh->prepare(\n         \"INSERT INTO radreply ( username, attribute, op, value, nasip) values ( ?, 'Frame\n     );\n     my $ip =  $package->Ips->first;\n-    $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n+    # $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n  \n     $radius_dbh->commit;\n     # NOTICE: This is a bit inconsistent\n     # if whole payment failed we will have radius account without payment\n +   };\n  \n  \n     return $package;\n  }\n\n\nWhy before space change I get broken result?\n\n\n\nSaturday, June 29, 2019, 1:05:45 PM, you wrote:\n\n> Hello\n\n> I want to apply this patch from stage:\n\n> diff --git a/lib/App/Schema/Result/Invoice.pm\n> b/lib/App/Schema/Result/Invoice.pm\n> index 0176916f..0ce2d698 100644\n> --- a/lib/App/Schema/Result/Invoice.pm\n> +++ b/lib/App/Schema/Result/Invoice.pm\n> @@ -219,14 +219,14 @@ sub new_package {\n>      # my $package_type =  $package->Invoice->Order->Tariff->type;\n>      my $pass =  $package->password;\n>      ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n-    $sth->>execute( $package->login, 'NT-Password', ':=', $pass );\n+    $sth->>execute( $package->login, 'NT-Password', ':=', $pass //'');\n>      $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n>  \n>      $sth =  $radius_dbh->prepare(\n>          \"INSERT INTO radreply ( username, attribute, op, value,\n> nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n>      );\n>      my $ip =  $package->Ips->first;\n-    $sth->>execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n+    # $sth->>execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n>  \n>      $radius_dbh->commit;\n>      # NOTICE: This is a bit inconsistent\n\n\n> after applying I get merge conflict:\n\n\n> diff --cc lib/App/Schema/Result/Invoice.pm\n> index e3f55654,0ce2d698..00000000\n> --- a/lib/App/Schema/Result/Invoice.pm\n> +++ b/lib/App/Schema/Result/Invoice.pm\n> @@@ -211,33 -204,34 +211,87 @@@ sub new_package \n>      }\n>   \n>      ## Create radius account\n>  +   eval{\n>          my $radius_dbh =  $self->result_source->storage->schema->{ _radius_dbh };\n>  -   if( !$radius_dbh->FETCH('AutoCommit') ) {\n>  +       $radius_dbh->begin_work;\n>  +       my $sth =  $radius_dbh->prepare(\n>  +           \"INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)\"\n>  +       );\n>  +       $sth->execute( $package->login );\n>  +\n>  +       $sth =  $radius_dbh->prepare(\n>  +           \"INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )\"\n>  +       );\n>  +       # my $package_type =  $package->Invoice->Order->Tariff->type;\n>  +       my $pass =  $package->password;\n>  +       ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n>  +       $sth->execute( $package->login, 'NT-Password', ':=', $pass //'' );\n>  +       $sth->execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n>  +\n>  +       $sth =  $radius_dbh->prepare(\n>  +           \"INSERT INTO radreply ( username, attribute, op,\n> value, nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n>  +       );\n>  +       my $ip =  $package->Ips->first;\n>  +       $sth->execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n>  +\n>          $radius_dbh->commit;\n> ++<<<<<<< Updated upstream\n>  +       # NOTICE: This is a bit inconsistent\n>  +       # if whole payment failed we will have radius account without payment\n>  +   };\n> ++||||||| merged common ancestors\n> ++   }\n++   $radius_dbh->>begin_work;\n> ++   my $sth =  $radius_dbh->prepare(\n> ++       \"INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)\"\n> ++   );\n++   $sth->>execute( $package->login );\n> ++\n> ++   $sth =  $radius_dbh->prepare(\n> ++       \"INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )\"\n> ++   );\n> ++   # my $package_type =  $package->Invoice->Order->Tariff->type;\n> ++   my $pass =  $package->password;\n> ++   ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n++   $sth->>execute( $package->login, 'NT-Password', ':=', $pass );\n++   $sth->>execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n> ++\n> ++   $sth =  $radius_dbh->prepare(\n> ++       \"INSERT INTO radreply ( username, attribute, op, value,\n> nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n> ++   );\n> ++   my $ip =  $package->Ips->first;\n++   $sth->>execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n> ++\n++   $radius_dbh->>commit;\n> ++   # NOTICE: This is a bit inconsistent\n> ++   # if whole payment failed we will have radius account without payment\n> ++=======\n> +    }\n+    $radius_dbh->>begin_work;\n> +    my $sth =  $radius_dbh->prepare(\n> +        \"INSERT INTO radusergroup ( username, groupname, priority ) values (?,'static',1)\"\n> +    );\n+    $sth->>execute( $package->login );\n> + \n> +    $sth =  $radius_dbh->prepare(\n> +        \"INSERT INTO radcheck ( username, attribute, op, value ) values ( ?, ?, ?, ? )\"\n> +    );\n> +    # my $package_type =  $package->Invoice->Order->Tariff->type;\n> +    my $pass =  $package->password;\n> +    ($pass) =  (`smbencrypt $pass` =~ /([^\\s]+)$/s);\n+    $sth->>execute( $package->login, 'NT-Password', ':=', $pass //'');\n+    $sth->>execute( $package->login, 'NAS-Identifier', '=~', 'ppp' );\n> + \n> +    $sth =  $radius_dbh->prepare(\n> +        \"INSERT INTO radreply ( username, attribute, op, value,\n> nasip) values ( ?, 'Framed-IP-Address', '=', ?, ? )\"\n> +    );\n> +    my $ip =  $package->Ips->first;\n+    # $sth->>execute( $package->login, $ip->ip, $ip->Listener->first->nas_ip );\n> + \n+    $radius_dbh->>commit;\n> +    # NOTICE: This is a bit inconsistent\n> +    # if whole payment failed we will have radius account without payment\n++>>>>>>>> Stashed changes\n>   \n>   \n>      return $package;\n\n\n\n> Why updated upstream block is so small?\n\n> ++<<<<<<< Updated upstream\n>  +       # NOTICE: This is a bit inconsistent\n>  +       # if whole payment failed we will have radius account without payment\n>  +   };\n> ++||||||| merged common ancestors\n\n>  \n> I suppose it should start from to line line:\n\n>      +       $radius_dbh->begin_work;\n>      ...\n>     +    # if whole payment failed we will have radius account without payment\n\n\n\n\n\n\n\n-- \nBest regards,\nEugen Konkov\n\n"}]}