⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271455 in webkit


Ignore:
Timestamp:
Jan 13, 2021, 2:33:10 PM (6 years ago)
Author:
Jonathan Bedard
Message:

[webkitscmpy] Handle single commit touching multiple branches
https://bugs.webkit.org/show_bug.cgi?id=220601
<rdar://problem/73165609>

Reviewed by Stephanie Lewis.

In WebKit's history, there are a few cases of commits that touch multiple branches (like
https://trac.webkit.org/changeset/92419/webkit). These types of commits are not correct,
but we need to handle them if they are in the history of a branch.

  • Scripts/libraries/webkitscmpy/setup.py: Bump version.
  • Scripts/libraries/webkitscmpy/webkitscmpy/init.py: Ditto.
  • Scripts/libraries/webkitscmpy/webkitscmpy/local/svn.py:

(Svn._cache_revisions): Branches only intersect trunk when two sequential commits are from trunk.
(Svn.commit): Support case where no commit time can be found.

  • Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py:

(Svn._cache_revisions): Branches only intersect trunk when two sequential commits are from trunk.
(Svn.commit): Support case where no commit time can be found.

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r271450 r271455  
     12021-01-13  Jonathan Bedard  <jbedard@apple.com>
     2
     3        [webkitscmpy] Handle single commit touching multiple branches
     4        https://bugs.webkit.org/show_bug.cgi?id=220601
     5        <rdar://problem/73165609>
     6
     7        Reviewed by Stephanie Lewis.
     8
     9        In WebKit's history, there are a few cases of commits that touch multiple branches (like
     10        https://trac.webkit.org/changeset/92419/webkit). These types of commits are not correct,
     11        but we need to handle them if they are in the history of a branch.
     12
     13        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
     14        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
     15        * Scripts/libraries/webkitscmpy/webkitscmpy/local/svn.py:
     16        (Svn._cache_revisions): Branches only intersect trunk when two sequential commits are from trunk.
     17        (Svn.commit): Support case where no commit time can be found.
     18        * Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py:
     19        (Svn._cache_revisions): Branches only intersect trunk when two sequential commits are from trunk.
     20        (Svn.commit): Support case where no commit time can be found.
     21
    1222021-01-13  Aakash Jain  <aakash_jain@apple.com>
    223
  • trunk/Tools/Scripts/libraries/webkitscmpy/setup.py

    r271340 r271455  
    3131setup(
    3232    name='webkitscmpy',
    33     version='0.8.0',
     33    version='0.8.1',
    3434    description='Library designed to interact with git and svn repositories.',
    3535    long_description=readme(),
  • trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py

    r271340 r271455  
    4747    )
    4848
    49 version = Version(0, 8, 0)
     49version = Version(0, 8, 1)
    5050
    5151AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
  • trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/svn.py

    r271340 r271455  
    165165                raise self.Exception("Failed to construct branch history for '{}'".format(branch))
    166166
     167            was_last_on_default = False
    167168            line = log.stdout.readline()
    168169            while line:
     
    180181                    if not is_default_branch:
    181182                        if revision in self._metadata_cache[self.default_branch]:
    182                             self._metadata_cache[branch].insert(pos, revision)
    183                             break
     183                            if was_last_on_default:
     184                                break
     185                            was_last_on_default = True
     186                        else:
     187                            was_last_on_default = False
    184188                    self._metadata_cache[branch].insert(pos, revision)
    185189                line = log.stdout.readline()
     
    327331                branch = self._branch_for(revision)
    328332
    329         date = info['Last Changed Date'].split(' (')[0]
    330         tz_diff = date.split(' ')[-1]
    331         date = datetime.strptime(date[:-len(tz_diff)], '%Y-%m-%d %H:%M:%S ')
    332         date += timedelta(
    333             hours=int(tz_diff[1:3]),
    334             minutes=int(tz_diff[3:5]),
    335         ) * (1 if tz_diff[0] == '-' else -1)
     333        date = info['Last Changed Date'].split(' (')[0] if info.get('Last Changed Date') else None
     334        if date:
     335            tz_diff = date.split(' ')[-1]
     336            date = datetime.strptime(date[:-len(tz_diff)], '%Y-%m-%d %H:%M:%S ')
     337            date += timedelta(
     338                hours=int(tz_diff[1:3]),
     339                minutes=int(tz_diff[3:5]),
     340            ) * (1 if tz_diff[0] == '-' else -1)
    336341
    337342        if not identifier:
     
    377382            identifier=identifier,
    378383            branch_point=branch_point,
    379             timestamp=int(calendar.timegm(date.timetuple())),
     384            timestamp=int(calendar.timegm(date.timetuple())) if date else None,
    380385            author=author,
    381386            message=message,
  • trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/svn.py

    r270447 r271455  
    233233                raise self.Exception("Failed to construct branch history for '{}'".format(branch))
    234234
     235            was_last_on_default = False
    235236            for line in response.iter_lines():
    236237                match = self.HISTORY_RE.match(line)
     
    249250                if not is_default_branch:
    250251                    if revision in self._metadata_cache[self.default_branch]:
    251                         self._metadata_cache[branch].insert(pos, revision)
    252                         break
     252                        if was_last_on_default:
     253                            break
     254                        was_last_on_default = True
     255                    else:
     256                        was_last_on_default = False
    253257                self._metadata_cache[branch].insert(pos, revision)
    254258
     
    387391                branch = self._branch_for(revision)
    388392
    389         date = datetime.strptime(info['Last Changed Date'], '%Y-%m-%d %H:%M:%S')
     393        date = datetime.strptime(info['Last Changed Date'], '%Y-%m-%d %H:%M:%S') if info.get('Last Changed Date') else None
    390394
    391395        if not identifier:
     
    434438            identifier=identifier,
    435439            branch_point=branch_point,
    436             timestamp=int(calendar.timegm(date.timetuple())),
     440            timestamp=int(calendar.timegm(date.timetuple())) if date else None,
    437441            author=author,
    438442            message=message,
Note: See TracChangeset for help on using the changeset viewer.