Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-1203

Macro script content corrupted after automatic merge of Extension Manager

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 9.5-rc-1, 8.4.6
    • 8.4.4
    • Diff
    • None
    • Unit
    • N/A
    • N/A

    Description

      I upgraded the RN app on xwiki.org and one macro was failing. I discovered that EM had done an automatic merge and duplicated a line.

      Context:

      • RN app v1.0 was installed
      • Later on RN XAR was imported to a newer version
      • I upgraded to v1.4

      Content from v1.0 extension:

      {{velocity}}
      ## For final release notes, aggregate all changes from milestones and rcs.
      ## Use the page name to extract the version. The page has to be named using the short version syntax, e.g. "8.3M1"
      #set ($shortVersion = $doc.documentReference.parent.name)
      #set ($position = $shortVersion.indexOf('M'))
      #if ($position > -1)
        #set ($prefix = $shortVersion.substring(0, $position))
        #set ($suffix = $shortVersion.substring($mathtool.add($position, 1)))
        #set ($versionsParameter = "${prefix}-milestone-${suffix}")
      #else
        #set ($position = $shortVersion.indexOf('RC'))
        #if ($position > -1)
          #set ($prefix = $shortVersion.substring(0, $position))
          #set ($suffix = $shortVersion.substring($mathtool.add($position, 2)))
          #set ($versionsParameter = "${prefix}-rc-${suffix}")
        #else
          #set ($versionsParameter =  "${shortVersion}%")
        #end
      #end
      == For Users ==
      
      {{changes displayer="simple" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="user" containsScreenshots="true"/}}
      
      === Miscellaneous ===
      
      {{changes displayer="list" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="user" containsScreenshots="false"/}}
      
      == For Admins ==
      
      {{changes displayer="simple" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="administrator" containsScreenshots="true"/}}
      
      === Miscellaneous ===
      
      {{changes displayer="list" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="administrator" containsScreenshots="false"/}}
      
      == For Developers ==
      
      {{changes displayer="simple" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="developer" importance="Medium,High"/}}
      
      === Miscellaneous ===
      
      {{changes displayer="list" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="Developer,developer" importance="Low"/}}
      {{/velocity}}
      

      Content on xwiki.org before upgrading to v1.4

      {{include reference="ReleaseNotes.Code.ChangesVelocityMacros"/}}
      
      {{velocity}}
      ## For final release notes, aggregate all changes from milestones and rcs.
      ## Use the page name to extract the version. The page has to be named using the short version syntax, e.g. "8.3M1"
      #set ($shortVersion = $doc.documentReference.parent.name)
      #set ($position = $shortVersion.indexOf('M'))
      #if ($position > -1)
        #set ($prefix = $shortVersion.substring(0, $position))
        #set ($suffix = $shortVersion.substring($mathtool.add($position, 1)))
        #set ($versionsParameter = "${prefix}-milestone-${suffix}")
      #else
        #set ($position = $shortVersion.indexOf('RC'))
        #if ($position > -1)
          #set ($prefix = $shortVersion.substring(0, $position))
          #set ($suffix = $shortVersion.substring($mathtool.add($position, 2)))
          #set ($versionsParameter = "${prefix}-rc-${suffix}")
        #else
          #set ($versionsParameter =  "${shortVersion},${shortVersion}-milestone%,${shortVersion}-rc%")
        #end
      #end
      ## Extract product + version + released info from xobject
      #set ($topSpace = $doc.documentReference.extractFirstReference('SPACE').getName())
      #set ($product = $!doc.getValue('product'))
      #set ($version = $!doc.getValue('version'))
      #set ($released = $!doc.getValue('released'))
      == For Users ==
      #if ("$!request.action" == 'useradd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasAdmin &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="useradd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="user"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add User Change"/>
        </span>
      </form>
      {{/html}}
      #end
      
      {{changes displayer="simple" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="user" containsScreenshots="true"/}}
      
      === Miscellaneous ===
      
      {{changes displayer="list" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="user" containsScreenshots="false"/}}
      
      == For Admins ==
      #if ("$!request.action" == 'adminadd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasAdmin &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="adminadd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="administrator"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add Admin Change"/>
        </span>
      </form>
      {{/html}}
      #end
      
      {{changes displayer="simple" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="administrator" containsScreenshots="true"/}}
      
      === Miscellaneous ===
      
      {{changes displayer="list" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="administrator" containsScreenshots="false"/}}
      
      == For Developers ==
      #if ("$!request.action" == 'devadd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasAdmin &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="devadd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="developer"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add Developer Change"/>
        </span>
      </form>
      {{/html}}
      #end
      
      {{changes displayer="simple" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="developer" importance="Medium,High"/}}
      
      === Miscellaneous ===
      
      {{changes displayer="list" displayEditLink="true" products="XWiki" versions="$versionsParameter" audience="Developer,developer" importance="Low"/}}
      {{/velocity}}
      

      Content of v1.4 of the RN app:

      {{include reference="ReleaseNotes.Code.ChangesVelocityMacros"/}}
      
      {{velocity}}
      ## For final release notes, aggregate all changes from milestones and rcs.
      ## Use the page name to extract the version. The page has to be named using the short version syntax, e.g. "8.3M1"
      #set ($shortVersion = $doc.documentReference.parent.name)
      #set ($position = $shortVersion.indexOf('M'))
      #if ($position > -1)
        #set ($prefix = $shortVersion.substring(0, $position))
        #set ($suffix = $shortVersion.substring($mathtool.add($position, 1)))
        #set ($versionsParameter = "${prefix}-milestone-${suffix}")
      #else
        #set ($position = $shortVersion.indexOf('RC'))
        #if ($position > -1)
          #set ($prefix = $shortVersion.substring(0, $position))
          #set ($suffix = $shortVersion.substring($mathtool.add($position, 2)))
          #set ($versionsParameter = "${prefix}-rc-${suffix}")
        #else
          #set ($versionsParameter =  "${shortVersion},${shortVersion}-milestone%,${shortVersion}-rc%")
        #end
      #end
      ## Extract product + version + released info from xobject
      #set ($topSpace = $doc.documentReference.extractFirstReference('SPACE').getName())
      #set ($product = $!doc.getValue('product'))
      #set ($version = $!doc.getValue('version'))
      #set ($released = $!doc.getValue('released'))
      == For Users ==
      #if ("$!request.action" == 'useradd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasEdit &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="useradd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="user"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add User Change"/>
        </span>
      </form>
      {{/html}}
      #end
      {{/velocity}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="user" containsScreenshots="true" contextVariable="userChanges"/}}
      {{/velocity}}
      
      {{displayChanges displayer="simple" displayEditLink="true" contextVariable="userChanges"/}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="user" containsScreenshots="false" contextVariable="userMiscChanges"/}}
      {{/velocity}}
      
      {{velocity}}
      #if ($userMiscChanges.size() > 0)
        === Miscellaneous ===
      
        {{displayChanges displayer="list" displayEditLink="true" contextVariable="userMiscChanges"/}}
      #end
      
      == For Admins ==
      #if ("$!request.action" == 'adminadd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasEdit &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="adminadd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="administrator"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add Admin Change"/>
        </span>
      </form>
      {{/html}}
      #end
      {{/velocity}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="administrator" containsScreenshots="true" contextVariable="adminChanges"/}}
      {{/velocity}}
      
      {{displayChanges displayer="simple" displayEditLink="true" contextVariable="adminChanges"/}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="administrator" containsScreenshots="false" contextVariable="adminMiscChanges"/}}
      {{/velocity}}
      
      {{velocity}}
      #if ($adminMiscChanges.size() > 0)
        === Miscellaneous ===
      
        {{displayChanges displayer="list" displayEditLink="true" contextVariable="adminMiscChanges"/}}
      #end
      
      == For Developers ==
      #if ("$!request.action" == 'devadd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasEdit &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="devadd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="developer"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add Developer Change"/>
        </span>
      </form>
      {{/html}}
      #end
      {{/velocity}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="developer" importance="Medium,High" contextVariable="devChanges"/}}
      {{/velocity}}
      
      {{displayChanges displayer="simple" displayEditLink="true" contextVariable="devChanges"/}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="Developer,developer" importance="Low" contextVariable="devMiscChanges"/}}
      {{/velocity}}
      
      {{velocity}}
      #if ($devMiscChanges.size() > 0)
        === Miscellaneous ===
      
        {{displayChanges displayer="list" displayEditLink="true" contextVariable="devMiscChanges"/}}
      #end
      {{/velocity}}
      

      Content after upgrade:

      {{include reference="ReleaseNotes.Code.ChangesVelocityMacros"/}}
      
      {{velocity}}
      ## For final release notes, aggregate all changes from milestones and rcs.
      ## Use the page name to extract the version. The page has to be named using the short version syntax, e.g. "8.3M1"
      #set ($shortVersion = $doc.documentReference.parent.name)
      #set ($position = $shortVersion.indexOf('M'))
      #if ($position > -1)
        #set ($prefix = $shortVersion.substring(0, $position))
        #set ($suffix = $shortVersion.substring($mathtool.add($position, 1)))
        #set ($versionsParameter = "${prefix}-milestone-${suffix}")
      #else
        #set ($position = $shortVersion.indexOf('RC'))
        #if ($position > -1)
          #set ($prefix = $shortVersion.substring(0, $position))
          #set ($suffix = $shortVersion.substring($mathtool.add($position, 2)))
          #set ($versionsParameter = "${prefix}-rc-${suffix}")
        #else
          #set ($versionsParameter =  "${shortVersion},${shortVersion}-milestone%,${shortVersion}-rc%")
        #end
      #end
      ## Extract product + version + released info from xobject
      #set ($topSpace = $doc.documentReference.extractFirstReference('SPACE').getName())
      #set ($product = $!doc.getValue('product'))
      #set ($version = $!doc.getValue('version'))
      #set ($released = $!doc.getValue('released'))
      == For Users ==
      #if ("$!request.action" == 'useradd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasEdit &&$ $released != '1')
      #if ($hasAdmin &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="useradd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="user"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add User Change"/>
        </span>
      </form>
      {{/html}}
      #end
      {{/velocity}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="user" containsScreenshots="true" contextVariable="userChanges"/}}
      {{/velocity}}
      
      {{displayChanges displayer="simple" displayEditLink="true" contextVariable="userChanges"/}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="user" containsScreenshots="false" contextVariable="userMiscChanges"/}}
      {{/velocity}}
      
      {{velocity}}
      #if ($userMiscChanges.size() > 0)
        === Miscellaneous ===
      
        {{displayChanges displayer="list" displayEditLink="true" contextVariable="userMiscChanges"/}}
      #end
      
      == For Admins ==
      #if ("$!request.action" == 'adminadd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasEdit &&$ $released != '1')
      #if ($hasAdmin &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="adminadd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="administrator"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add Admin Change"/>
        </span>
      </form>
      {{/html}}
      #end
      {{/velocity}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="administrator" containsScreenshots="true" contextVariable="adminChanges"/}}
      {{/velocity}}
      
      {{displayChanges displayer="simple" displayEditLink="true" contextVariable="adminChanges"/}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="administrator" containsScreenshots="false" contextVariable="adminMiscChanges"/}}
      {{/velocity}}
      
      {{velocity}}
      #if ($adminMiscChanges.size() > 0)
        === Miscellaneous ===
      
        {{displayChanges displayer="list" displayEditLink="true" contextVariable="adminMiscChanges"/}}
      #end
      
      == For Developers ==
      #if ("$!request.action" == 'devadd')
        #handleAddAction($product, $version, "${request.queryString}&xredirect=$doc.getURL('view')")
      #end
      #if ($hasEdit &&$ $released != '1')
      #if ($hasAdmin &&$ $released != '1')
      {{html clean='false'}}
      <form>
        <input type="hidden" name="action" value="devadd"/>
        <input type="hidden" name="template" value="${topSpace}.Code.ChangesTemplate"/>
        <input type="hidden" name="product" value="$product"/>
        <input type="hidden" name="version" value="$version"/>
        <input type="hidden" name="audience" value="developer"/>
        <span class="buttonwrapper">
          <input class="button" type="submit" value="Add Developer Change"/>
        </span>
      </form>
      {{/html}}
      #end
      {{/velocity}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="developer" importance="Medium,High" contextVariable="devChanges"/}}
      {{/velocity}}
      
      {{displayChanges displayer="simple" displayEditLink="true" contextVariable="devChanges"/}}
      
      {{velocity}}
      {{getChanges products="$product" versions="$versionsParameter" audience="Developer,developer" importance="Low" contextVariable="devMiscChanges"/}}
      {{/velocity}}
      
      {{velocity}}
      #if ($devMiscChanges.size() > 0)
        === Miscellaneous ===
      
        {{displayChanges displayer="list" displayEditLink="true" contextVariable="devMiscChanges"/}}
      #end
      {{/velocity}}
      

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: