Example #1
0
 def _resolve_conflict(self, existing, proposed):
   if proposed == existing:
     return existing
   elif existing.force and proposed.force:
     raise TaskError('Cannot force %s#%s to both rev %s and %s' % (
       proposed.org, proposed.name, existing.rev, proposed.rev
     ))
   elif existing.force:
     self.context.log.debug('Ignoring rev %s for %s#%s already forced to %s' % (
       proposed.rev, proposed.org, proposed.name, existing.rev
     ))
     return existing
   elif proposed.force:
     self.context.log.debug('Forcing %s#%s from %s to %s' % (
       proposed.org, proposed.name, existing.rev, proposed.rev
     ))
     return proposed
   else:
     try:
       if Revision.lenient(proposed.rev) > Revision.lenient(existing.rev):
         self.context.log.debug('Upgrading %s#%s from rev %s  to %s' % (
           proposed.org, proposed.name, existing.rev, proposed.rev,
         ))
         return proposed
       else:
         return existing
     except Revision.BadRevision as e:
       raise TaskError('Failed to parse jar revision', e)
Example #2
0
 def _resolve_conflict(self, existing, proposed):
     if proposed == existing:
         return existing
     elif existing.force and proposed.force:
         raise TaskError(
             'Cannot force %s#%s to both rev %s and %s' %
             (proposed.org, proposed.name, existing.rev, proposed.rev))
     elif existing.force:
         self.context.log.debug(
             'Ignoring rev %s for %s#%s already forced to %s' %
             (proposed.rev, proposed.org, proposed.name, existing.rev))
         return existing
     elif proposed.force:
         self.context.log.debug(
             'Forcing %s#%s from %s to %s' %
             (proposed.org, proposed.name, existing.rev, proposed.rev))
         return proposed
     else:
         try:
             if Revision.lenient(proposed.rev) > Revision.lenient(
                     existing.rev):
                 self.context.log.debug(
                     'Upgrading %s#%s from rev %s  to %s' % (
                         proposed.org,
                         proposed.name,
                         existing.rev,
                         proposed.rev,
                     ))
                 return proposed
             else:
                 return existing
         except Revision.BadRevision as e:
             raise TaskError('Failed to parse jar revision', e)
Example #3
0
  def test(self):
    self.assertComponents(Revision.lenient('1.2.3'), 1, 2, 3)
    self.assertComponents(Revision.lenient('1.2.3-SNAPSHOT-eabc'), 1, 2, 3, 'SNAPSHOT', 'eabc')
    self.assertComponents(Revision.lenient('1.2.3-SNAPSHOT4'), 1, 2, 3, 'SNAPSHOT', 4)

    self.assertTrue(Revision.lenient('a') < Revision.lenient('b'))
    self.assertTrue(Revision.lenient('1') < Revision.lenient('2'))
    self.assertTrue(Revision.lenient('1') < Revision.lenient('a'))

    self.assertEqual(Revision.lenient('1.2.3'), Revision.lenient('1.2.3'))
    self.assertTrue(Revision.lenient('1.2.3') < Revision.lenient('1.2.3-SNAPSHOT'))
    self.assertTrue(Revision.lenient('1.2.3-SNAPSHOT') < Revision.lenient('1.2.3-SNAPSHOT-abc'))
    self.assertTrue(Revision.lenient('1.2.3-SNAPSHOT-abc') < Revision.lenient('1.2.3-SNAPSHOT-bcd'))
    self.assertTrue(
      Revision.lenient('1.2.3-SNAPSHOT-abc6') < Revision.lenient('1.2.3-SNAPSHOT-abc10'))
Example #4
0
    def test(self):
        self.assertComponents(Revision.lenient('1.2.3'), 1, 2, 3)
        self.assertComponents(Revision.lenient('1.2.3-SNAPSHOT-eabc'), 1, 2, 3,
                              'SNAPSHOT', 'eabc')
        self.assertComponents(Revision.lenient('1.2.3-SNAPSHOT4'), 1, 2, 3,
                              'SNAPSHOT', 4)

        self.assertTrue(Revision.lenient('a') < Revision.lenient('b'))
        self.assertTrue(Revision.lenient('1') < Revision.lenient('2'))
        self.assertTrue(Revision.lenient('1') < Revision.lenient('a'))

        self.assertEqual(Revision.lenient('1.2.3'), Revision.lenient('1.2.3'))
        self.assertTrue(
            Revision.lenient('1.2.3') < Revision.lenient('1.2.3-SNAPSHOT'))
        self.assertTrue(
            Revision.lenient('1.2.3-SNAPSHOT') < Revision.lenient(
                '1.2.3-SNAPSHOT-abc'))
        self.assertTrue(
            Revision.lenient('1.2.3-SNAPSHOT-abc') < Revision.lenient(
                '1.2.3-SNAPSHOT-bcd'))
        self.assertTrue(
            Revision.lenient('1.2.3-SNAPSHOT-abc6') < Revision.lenient(
                '1.2.3-SNAPSHOT-abc10'))