Skip to content

Commit 8b10be0

Browse files
committed
revision: track pull request head SHA (bug 2005795)
- add Revision.pull_head_sha and Revision.pull_head_sha fields - add migrations - store SHAs when landing job is created
1 parent 1a3ffa2 commit 8b10be0

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

src/lando/api/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ class Form(forms.Form):
284284
}
285285
revision = Revision.objects.create(
286286
pull_number=pull_request.number,
287+
pull_head_sha=pull_request.head_sha,
288+
pull_base_sha=pull_request.base_sha,
287289
patches=pull_request.patch,
288290
patch_data=patch_data,
289291
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 5.2.8 on 2025-12-12 20:26
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("main", "0040_landingjob_is_pull_request_job"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="revision",
15+
name="pull_base_sha",
16+
field=models.CharField(blank=True, max_length=40, null=True),
17+
),
18+
migrations.AddField(
19+
model_name="revision",
20+
name="pull_head_sha",
21+
field=models.CharField(blank=True, max_length=40, null=True),
22+
),
23+
]

src/lando/main/models/revision.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ class Revision(BaseModel):
5050
# GitHub pull request number, if this is a pull request.
5151
pull_number = models.IntegerField(blank=True, null=True)
5252

53+
# GitHub pull request head and base SHAs, if this is a pull request.
54+
pull_head_sha = models.CharField(max_length=40, blank=True, null=True)
55+
pull_base_sha = models.CharField(max_length=40, blank=True, null=True)
56+
5357
# The generated patch with Mercurial metadata format.
5458
# This patch is generated by combining a diff and patch metadata.
5559
patch = models.TextField(blank=True, default="")

0 commit comments

Comments
 (0)