<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sébastien Alix</title>
    <description>The latest articles on DEV Community by Sébastien Alix (@sebalix).</description>
    <link>https://dev.to/sebalix</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F905156%2F73e91d1c-f075-4f56-b846-c15c71b5cb12.png</url>
      <title>DEV Community: Sébastien Alix</title>
      <link>https://dev.to/sebalix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sebalix"/>
    <language>en</language>
    <item>
      <title>oca-port: new OCA tool to help with modules migration</title>
      <dc:creator>Sébastien Alix</dc:creator>
      <pubDate>Mon, 15 Aug 2022 12:44:00 +0000</pubDate>
      <link>https://dev.to/camptocamp-odoo/oca-port-new-oca-tool-to-help-with-modules-migration-1aa</link>
      <guid>https://dev.to/camptocamp-odoo/oca-port-new-oca-tool-to-help-with-modules-migration-1aa</guid>
      <description>&lt;p&gt;The OCA (&lt;a href="https://odoo-community.org/"&gt;Odoo Community Association&lt;/a&gt;) has a new tool: &lt;a href="https://github.com/OCA/oca-port"&gt;OCA port&lt;/a&gt;. It helps forward porting and back porting changes on modules from one branch to another, making module maintenance and migration easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Story
&lt;/h2&gt;

&lt;p&gt;It all started with the migration of an Odoo project composed of roughly ~350 OCA modules from 13.0 to 14.0 back in 2021. As usual with big migrations on active projects, new fixes and improvements were added from time to time even after the migration process began,  making already migrated modules on 14.0 outdated.&lt;/p&gt;

&lt;p&gt;To handle this migration we needed to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;migrate OCA modules from 13.0 to 14.0 (as usual),&lt;/li&gt;
&lt;li&gt;port all fixes and features done in 13.0 on the already migrated 14.0 modules&lt;/li&gt;
&lt;li&gt;(even more important) make it easy &amp;amp; comfortable for the developer&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's how oca-port was born!&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick example
&lt;/h2&gt;

&lt;p&gt;Go to a local copy of a repository. Let’s say you want to check if the whole module can be migrated or if some changes need to be ported to the targeted version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;path/to/OCA/stock-logistics-workflow
&lt;span class="nv"&gt;$ &lt;/span&gt;oca-port 14.0 15.0 stock_split_picking
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Resulting in this kind of report:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stock_split_picking already exists on 15.0, checking PRs to port...
1 pull request(s) related to 'stock_split_picking' to port from origin/14.0 to origin/15.0

1) PR #935 (https://github.com/OCA/stock-logistics-workflow/pull/935) [14.0][FW] stock_split_picking: Port PR from 13.0 to 14.0:
    By sonhd91, merged at 2021-12-20T08:21:17Z
    =&amp;gt; Not ported: stock_split_picking
    =&amp;gt; 2 commit(s) not (fully) ported
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To process the migration (or the port of missing changes), you pass the fork of the repository on which you have write access (this is the name of your git remote, be sure to add it first):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git remote add camptocamp git@github.com:camptocamp/stock-logistics-workflow.git
&lt;span class="nv"&gt;$ &lt;/span&gt;oca-port 14.0 15.0 stock_split_picking &lt;span class="nt"&gt;--fork&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;camptocamp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same report will be displayed but this time with a user prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[...same report than above...]

- Port PR #935 (https://github.com/OCA/stock-logistics-workflow/pull/935) [14.0][FW] stock_split_picking: Port PR from 13.0 to 14.0...
    Port it? [y/N]:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's port these changes by answering 'yes':&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Port PR #935 (https://github.com/OCA/stock-logistics-workflow/pull/935) [14.0][FW] stock_split_picking: Port PR from 13.0 to 14.0...
    Port it? [y/N]: y
    Create branch oca-port-pr-935-from-14.0-to-15.0 from origin/14.0...
        Apply ba5840f8 [FIX] stock_split_picking: README...
        Apply 2aeeffcf [IMP] stock_split_picking: allow splitting ppickings waiting for other operations...
    🎉 Last PR processed! 🎉
    Push branch 'oca-port-pr-935-from-14.0-to-15.0' to remote 'camptocamp'? [y/N]: y
    Create a draft PR from 'oca-port-pr-935-from-14.0-to-15.0' to '15.0' against OCA/stock-logistics-workflow? [y/N]: y
        PR created =&amp;gt; https://github.com/OCA/stock-logistics-workflow/pull/1058
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Roadmap
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Blacklist modules and pull requests that shouldn’t be migrated and share this with other contributors by saving these data in a file part of the repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improve its usage as a Python package and generate the output as JSON or CSV (this will help to get a report of things that still need to be ported for a bunch of modules for instance, and estimate the work)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Visit &lt;a href="https://github.com/OCA/oca-port"&gt;https://github.com/OCA/oca-port&lt;/a&gt; for more details and options!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Contributors of this post:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sébastien Alix&lt;/li&gt;
&lt;li&gt;Simone Orsi&lt;/li&gt;
&lt;li&gt;Damien Crier&lt;/li&gt;
&lt;li&gt;Gilles Cherix&lt;/li&gt;
&lt;li&gt;Denis Leemann&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>odoo</category>
      <category>oca</category>
      <category>github</category>
      <category>git</category>
    </item>
  </channel>
</rss>
