Page MenuHomeSoftware Heritage

change mapping status from boolean to enum
ClosedPublic

Authored by TG1999 on Mar 1 2021, 11:09 AM.

Details

Summary

Currently boolean is used for checking mapping status of a row, instead of boolean type use named class which have 3 types mapped, unmapped and ignore

Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>

Diff Detail

Repository
rDMFCD ClearlyDefined metadata fetcher
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D5165 (id=18474)

Rebasing onto 89092343ee...

Current branch diff-target is up to date.
Changes applied before test
commit bb5cbd0b6d25a1d88b1304f33697f87f19d3ffbb
Author: Tushar Goel <tushar.goel.dav@gmail.com>
Date:   Mon Mar 1 15:38:14 2021 +0530

    change mapping status from boolean to enum
    
    Currently boolean is used for checking mapping status of a row, instead of boolean type use named class which have 3 types mapped, unmapped and ignore
    
    Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>

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

Add case for partial mapping

Build is green

Patch application report for D5165 (id=18477)

Rebasing onto 89092343ee...

Current branch diff-target is up to date.
Changes applied before test
commit 4a651b73c259cc92bbaaa698107a50fd080225ad
Author: Tushar Goel <tushar.goel.dav@gmail.com>
Date:   Mon Mar 1 16:11:19 2021 +0530

    change mapping status from boolean to enum
    
    Currently boolean is used for checking mapping status of a row, instead of boolean type use named class which have 3 types mapped, unmapped and ignore
    
    Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>

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

vlorentz requested changes to this revision.Mar 1 2021, 2:27 PM

Good idea, I like it.

A few comments:

swh/clearlydefined/mapping_utils.py
261–262

when does this happen?

swh/clearlydefined/orchestrator.py
103–104

It does not return a MappingStatus

112–113

don't need the pass

This revision now requires changes to proceed.Mar 1 2021, 2:27 PM
TG1999 added inline comments.
swh/clearlydefined/mapping_utils.py
261–262

Some time revision contains tags like 0.4.0, so I don't want code to throw error on these cases, so I am checking first is it a valid hexadecimal, before mapping it with revision

Good idea, I like it.

A few comments:

swh/clearlydefined/mapping_utils.py
261–262

Meh. is_hex is not going to be good enough; eg. a branch named beef would pass.

Instead, check it is hexadecimal *and* the right length (a regexp would probably be faster than the current implementation of is_hex, btw)

swh/clearlydefined/mapping_utils.py
261–262

Can you suggest me a regexp for this?

swh/clearlydefined/mapping_utils.py
261–262

I could but that's no fun. How would you do it?

Build has FAILED

Patch application report for D5165 (id=18517)

Rebasing onto 89092343ee...

Current branch diff-target is up to date.
Changes applied before test
commit fd948ce7cbf00b820d2a2f0556bc4c9771a34589
Author: Tushar Goel <tushar.goel.dav@gmail.com>
Date:   Tue Mar 2 15:06:20 2021 +0530

    Change Mapping Status From Boolean To Enum
    
    Currently boolean is used for checking mapping status of a row, instead of boolean type use named class which have 3 types mapped, unmapped and ignore
    
    Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>

Link to build: https://jenkins.softwareheritage.org/job/DMFCD/job/tests-on-diff/119/
See console output for more information: https://jenkins.softwareheritage.org/job/DMFCD/job/tests-on-diff/119/console

swh/clearlydefined/mapping_utils.py
63–64
This revision is now accepted and ready to land.Mar 2 2021, 11:27 AM

change function name from is_hex to is_sha1

Build has FAILED

Patch application report for D5165 (id=18530)

Rebasing onto 89092343ee...

Current branch diff-target is up to date.
Changes applied before test
commit b8711b141781aaba5ee2d96a86c48c6989d66c07
Author: Tushar Goel <tushar.goel.dav@gmail.com>
Date:   Tue Mar 2 19:32:41 2021 +0530

    Change Mapping Status From Boolean To Enum
    
    Currently boolean is used for checking mapping status of a row, instead of boolean type use named class which have 3 types mapped, unmapped and ignore
    
    Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>

Link to build: https://jenkins.softwareheritage.org/job/DMFCD/job/tests-on-diff/120/
See console output for more information: https://jenkins.softwareheritage.org/job/DMFCD/job/tests-on-diff/120/console

This revision was landed with ongoing or failed builds.Mar 2 2021, 3:05 PM
This revision was automatically updated to reflect the committed changes.