@@ -111,6 +111,33 @@ def parse_args():
111
111
return parser .parse_args ()
112
112
113
113
114
+ def diff_source_control (diff_from , diff_to ):
115
+ for source in ['coreos-assembler.container-config-git' , 'coreos-assembler.container-image-git' ]:
116
+ config_from = diff_from .meta [source ]
117
+ config_to = diff_to .meta [source ]
118
+ config_shared_history = True
119
+ for item in ['origin' , 'branch' , 'dirty' ]:
120
+ if config_from [item ] != config_to [item ]:
121
+ config_shared_history = False
122
+ break
123
+ if not config_shared_history :
124
+ # If they weren't from the same repo/branch, etc then
125
+ # there's not really any way to compare them easily
126
+ # so just output the details gory details and move on.
127
+ print (f"from: { config_from } " )
128
+ print (f"to: { config_to } " )
129
+ else :
130
+ print (f"{ config_from ['origin' ]} : { config_from ['commit' ][:7 ]} ..{ config_to ['commit' ][:7 ]} " )
131
+ # If the git repo is on github (which our repos are) let's print a link
132
+ # where a user can click (or share) and view the changes from one commit
133
+ # to another.
134
+ if 'github.com' in config_from ['origin' ]:
135
+ # Also pull off `.git` if it is on the end of the URL since the
136
+ # compare API won't work if `.git` is in there.
137
+ origin_url = f"{ config_from ['origin' ]} " .removesuffix ('.git' )
138
+ print (f" --> { origin_url } /compare/{ config_from ['commit' ][:7 ]} ...{ config_to ['commit' ][:7 ]} " )
139
+
140
+
114
141
def diff_rpms (diff_from , diff_to ):
115
142
commit_from = diff_from .meta ['ostree-commit' ]
116
143
commit_to = diff_to .meta ['ostree-commit' ]
@@ -303,6 +330,8 @@ def cache_dir(dir):
303
330
# unfortunately, this has to come at the end to resolve functions
304
331
DIFFERS = [
305
332
Differ ("rpms" , "Diff RPMs" , needs_ostree = OSTreeImport .PARTIAL , function = diff_rpms ),
333
+ Differ ("source-control" , "Diff config and COSA input commits" ,
334
+ needs_ostree = OSTreeImport .NO , function = diff_source_control ),
306
335
Differ ("ostree-ls" , "Diff OSTree contents using 'ostree diff'" ,
307
336
needs_ostree = OSTreeImport .FULL , function = diff_ostree_ls ),
308
337
Differ ("ostree" , "Diff OSTree contents using 'git diff'" ,
0 commit comments