Page MenuHomeSoftware Heritage

Simplify algos.snapshot.snapshot_resolve_alias.
ClosedPublic

Authored by vlorentz on Nov 5 2020, 11:00 AM.

Details

Summary
  1. rename branch_info to last_branch
  2. exclude the last_branch from 'branches', so that: a) it never needs to contain a None value, so we don't need a cast b) no need for slicing

Diff Detail

Event Timeline

Build is green

Patch application report for D4413 (id=15635)

Rebasing onto 943e440a9f...

Current branch diff-target is up to date.
Changes applied before test
commit 6163a6513ff396de17a486c55ee6e157459f910d
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Nov 5 11:00:03 2020 +0100

    Simplify algos.snapshot.snapshot_resolve_alias.
    
    1. rename branch_info to last_branch
    2. exclude the last_branch from 'branches', so that:
       a) it never needs to contain a None value, so we don't need a cast
       b) no need for slicing

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1039/ for more details.

  • rebase on top of D4414
  • fix a bug I introduced in the untested case

Build is green

Patch application report for D4413 (id=15637)

Could not rebase; Attempt merge onto 943e440a9f...

Updating 943e440a..8ae9b689
Fast-forward
 swh/storage/algos/snapshot.py            | 22 +++++++++++-----------
 swh/storage/tests/algos/test_snapshot.py | 23 +++++++++++++++++++----
 2 files changed, 30 insertions(+), 15 deletions(-)
Changes applied before test
commit 8ae9b6891e7c2849f0da7fdb3db39bfd4c0d08e7
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Nov 5 11:00:03 2020 +0100

    Simplify algos.snapshot.snapshot_resolve_alias.
    
    1. rename branch_info to last_branch
    2. exclude the last_branch from 'branches', so that:
       a) it never needs to contain a None value, so we don't need a cast
       b) no need for slicing

commit b00a21c7d084bd6df4bfa607a9b22dd6ec040b1f
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Nov 5 11:28:10 2020 +0100

    Add test for snapshot_resolve_alias with a missing branch.

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1041/ for more details.

Build is green

Patch application report for D4413 (id=15639)

Could not rebase; Attempt merge onto 943e440a9f...

Updating 943e440a..b650a829
Fast-forward
 swh/storage/algos/snapshot.py            | 22 +++++++++++-----------
 swh/storage/tests/algos/test_snapshot.py | 21 ++++++++++++++++++---
 2 files changed, 29 insertions(+), 14 deletions(-)
Changes applied before test
commit b650a829e257186db5dfad2d27241edbe58858d8
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Nov 5 11:00:03 2020 +0100

    Simplify algos.snapshot.snapshot_resolve_alias.
    
    1. rename branch_info to last_branch
    2. exclude the last_branch from 'branches', so that:
       a) it never needs to contain a None value, so we don't need a cast
       b) no need for slicing

commit ae4724edf45aca4d039a4d47d8b9b443fbb7b455
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Nov 5 11:28:10 2020 +0100

    Add test for snapshot_resolve_alias with a missing branch.

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1043/ for more details.

anlambert added inline comments.
swh/storage/algos/snapshot.py
216–217

You can remove these instructions as the while iteration will stop when last_branch is None

This revision is now accepted and ready to land.Nov 5 2020, 11:55 AM

flip the diffs again

swh/storage/algos/snapshot.py
216–217

good catch!

Build is green

Patch application report for D4413 (id=15640)

Rebasing onto 943e440a9f...

Current branch diff-target is up to date.
Changes applied before test
commit 02d730401ff87ed26d1beab27781ab3aa3968e94
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Nov 5 11:00:03 2020 +0100

    Simplify algos.snapshot.snapshot_resolve_alias.
    
    1. rename branch_info to last_branch
    2. exclude the last_branch from 'branches', so that:
       a) it never needs to contain a None value, so we don't need a cast
       b) no need for slicing

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1044/ for more details.

This revision was landed with ongoing or failed builds.Nov 5 2020, 12:07 PM
This revision was automatically updated to reflect the committed changes.

Build is green

Patch application report for D4413 (id=15642)

Rebasing onto 943e440a9f...

Current branch diff-target is up to date.
Changes applied before test
commit 1826b2b97d703e33f4a1d3c4393d8b51ffcaed19
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Thu Nov 5 11:00:03 2020 +0100

    Simplify algos.snapshot.snapshot_resolve_alias.
    
    1. rename branch_info to last_branch
    2. exclude the last_branch from 'branches', so that:
       a) it never needs to contain a None value, so we don't need a cast
       b) no need for slicing

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1046/ for more details.

Build is green

Patch application report for D4413 (id=15643)

Rebasing onto fa868346c6...

First, rewinding head to replay your work on top of it...
Fast-forwarded diff-target to base-revision-1047-D4413.
Changes applied before test

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1047/ for more details.

Build is green

Patch application report for D4413 (id=15645)

Rebasing onto fa868346c6...

First, rewinding head to replay your work on top of it...
Fast-forwarded diff-target to base-revision-1049-D4413.
Changes applied before test

See https://jenkins.softwareheritage.org/job/DSTO/job/tests-on-diff/1049/ for more details.