Merge ~racb/usd-importer:commit-graph-v2 into usd-importer:master
- Git
- lp:~racb/usd-importer
- commit-graph-v2
- Merge into master
| Status: | Superseded |
|---|---|
| Proposed branch: | ~racb/usd-importer:commit-graph-v2 |
| Merge into: | usd-importer:master |
| Diff against target: |
690 lines (+103/-255) 4 files modified
gitubuntu/importer.py (+96/-240) gitubuntu/importlocal.py (+0/-1) gitubuntu/parent_overrides.txt (+4/-4) man/man1/git-ubuntu-import.1 (+3/-10) |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Server Team CI bot | continuous-integration | 2017-10-27 | Needs Fixing on 2017-10-27 |
| Robie Basak | Pending | ||
|
Review via email:
|
|||
This proposal supersedes a proposal from 2017-10-04.
This proposal has been superseded by a proposal from 2017-10-27.
Commit Message
Description of the Change
Commit graph change (hard reset of devel and pocket pointers instead of embedding them into merge commits in the commit graph). This MP includes my changes to also reset the devel head pointers as well as the pocket pointers.
| Server Team CI bot (server-team-bot) wrote : Posted in a previous version of this proposal | # |
| Server Team CI bot (server-team-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:e18dd529d2d
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Style Check
SUCCESS: Unit Tests
SUCCESS: Integration Tests
IN_PROGRESS: Declarative: Post Actions
Click here to trigger a rebuild:
https:/
| Server Team CI bot (server-team-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:454a1657849
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Style Check
SUCCESS: Unit Tests
SUCCESS: Integration Tests
IN_PROGRESS: Declarative: Post Actions
Click here to trigger a rebuild:
https:/
FAILED: Continuous integration, rev:a25d00d3f46
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Style Check
SUCCESS: Unit Tests
FAILED: Integration Tests
Click here to trigger a rebuild:
https:/
Unmerged commits
- a25d00d... by Robie Basak on 2017-10-26
-
Also reset devel heads
We have decided to reset the devel heads instead of generating merge
commits for them. - a159e3b... by Robie Basak on 2017-10-27
-
import: drop --fixup-devel
We no longer need this option, so simplify the code by dropping it.
This also drops the ability to specify spi=None to
_update_devel_branches via update_ devel_branches and
update_applied_ devel_branches. This makes the alternate code path in
_update_devel_branches unnecessary also, so we can drop that. Instead, leave an assertion in _update_
devel_branches to ensure that
there is no caller that does call it with spi=None. - 34c689f... by Nish Aravamudan on 2017-10-04
-
import: drop publishing parent functionality
Preview Diff
| 1 | diff --git a/gitubuntu/importer.py b/gitubuntu/importer.py |
| 2 | index f438739..0087cf8 100644 |
| 3 | --- a/gitubuntu/importer.py |
| 4 | +++ b/gitubuntu/importer.py |
| 5 | @@ -137,7 +137,6 @@ def main( |
| 6 | no_clean, |
| 7 | no_fetch, |
| 8 | no_push, |
| 9 | - fixup_devel, |
| 10 | active_series_only, |
| 11 | skip_orig, |
| 12 | skip_applied, |
| 13 | @@ -161,7 +160,6 @@ def main( |
| 14 | @no_fetch: if True, do not fetch the target repository before |
| 15 | importing |
| 16 | @no_push: if True, do not push to the target repository |
| 17 | - @fixup_devel: if True, attempt to fixup the devel branches |
| 18 | @active_series_only: if True, only import active series |
| 19 | @skip_orig: if True, do not attempt to use gbp to import orig |
| 20 | tarballs |
| 21 | @@ -332,7 +330,6 @@ def main( |
| 22 | ubuntu_sinfo=ubuntu_sinfo, |
| 23 | active_series_only=active_series_only, |
| 24 | workdir=workdir, |
| 25 | - fixup_devel=fixup_devel, |
| 26 | skip_orig=skip_orig, |
| 27 | allow_applied_failures=allow_applied_failures, |
| 28 | ) |
| 29 | @@ -354,7 +351,6 @@ def main( |
| 30 | ubuntu_sinfo=ubuntu_sinfo, |
| 31 | active_series_only=active_series_only, |
| 32 | workdir=workdir, |
| 33 | - fixup_devel=fixup_devel, |
| 34 | skip_orig=skip_orig, |
| 35 | allow_applied_failures=allow_applied_failures, |
| 36 | ) |
| 37 | @@ -420,7 +416,6 @@ def main( |
| 38 | def get_changelog_for_commit( |
| 39 | repo, |
| 40 | tree_hash, |
| 41 | - publish_parent_commit, |
| 42 | changelog_parent_commit, |
| 43 | ): |
| 44 | """Extract changes to debian/changelog in this publish |
| 45 | @@ -431,11 +426,7 @@ def get_changelog_for_commit( |
| 46 | if changelog_parent_commit is not None: |
| 47 | cmd = ['diff-tree', '-p', changelog_parent_commit, |
| 48 | tree_hash, '--', 'debian/changelog'] |
| 49 | - raw_clog_entry, _ = repo.git_run(cmd, decode=False) |
| 50 | - elif publish_parent_commit is not None: |
| 51 | - cmd = ['diff-tree', '-p', publish_parent_commit, |
| 52 | - tree_hash, '--', 'debian/changelog'] |
| 53 | - raw_clog_entry, _ = repo.git_run(cmd, decode=False) |
| 54 | + raw_clog_entry = repo.git_run(cmd).stdout |
| 55 | |
| 56 | changelog_entry = b'' |
| 57 | changelog_entry_found = False |
| 58 | @@ -460,10 +451,14 @@ def get_changelog_for_commit( |
| 59 | changelog_entry_found = True |
| 60 | return changelog_entry |
| 61 | |
| 62 | -def _commit_import(repo, spi, tree_hash, namespace, |
| 63 | - publish_parent_commit, |
| 64 | - changelog_parent_commit, upload_parent_commit, |
| 65 | - unapplied_parent_commit |
| 66 | +def _commit_import( |
| 67 | + repo, |
| 68 | + spi, |
| 69 | + tree_hash, |
| 70 | + namespace, |
| 71 | + changelog_parent_commit, |
| 72 | + upload_parent_commit, |
| 73 | + unapplied_parent_commit, |
| 74 | ): |
| 75 | """Commit a tree object into the repository with the specified |
| 76 | parents |
| 77 | @@ -476,7 +471,6 @@ def _commit_import(repo, spi, tree_hash, namespace, |
| 78 | Arguments: |
| 79 | spi - A SourcePackageInformation instance for this publish |
| 80 | tree_hash - SHA1 from git-dsc-commit --tree-only of this publish |
| 81 | - publish_parent_commit = SHA1 of publishing parent |
| 82 | changelog_parent_commit = SHA1 of changelog parent |
| 83 | upload_parent_commit = SHA1 of upload parent |
| 84 | unapplied_parent_commit = SHA1 of unapplied-patches import parent |
| 85 | @@ -502,7 +496,6 @@ def _commit_import(repo, spi, tree_hash, namespace, |
| 86 | changelog_entry = get_changelog_for_commit( |
| 87 | repo, |
| 88 | tree_hash, |
| 89 | - publish_parent_commit, |
| 90 | changelog_parent_commit |
| 91 | ) |
| 92 | msg = (b'Import %s version %b to %b\n\nImported using git-ubuntu import.' % |
| 93 | @@ -511,8 +504,7 @@ def _commit_import(repo, spi, tree_hash, namespace, |
| 94 | |
| 95 | parents = [] |
| 96 | |
| 97 | - if publish_parent_commit is None and \ |
| 98 | - changelog_parent_commit is None and \ |
| 99 | + if changelog_parent_commit is None and \ |
| 100 | upload_parent_commit is None and \ |
| 101 | unapplied_parent_commit is None and \ |
| 102 | target_head_name in repo.local_branch_names: |
| 103 | @@ -521,9 +513,6 @@ def _commit_import(repo, spi, tree_hash, namespace, |
| 104 | else: |
| 105 | msg += b'\n' |
| 106 | |
| 107 | - if publish_parent_commit is not None: |
| 108 | - parents.append(publish_parent_commit) |
| 109 | - msg += b'\nPublish parent: %b' % publish_parent_commit.encode() |
| 110 | if changelog_parent_commit is not None: |
| 111 | parents.append(changelog_parent_commit) |
| 112 | msg += b'\nChangelog parent: %b' % changelog_parent_commit.encode() |
| 113 | @@ -562,7 +551,6 @@ def commit_unapplied_patches_import( |
| 114 | spi, |
| 115 | import_tree_hash, |
| 116 | namespace, |
| 117 | - publish_parent_commit, |
| 118 | changelog_parent_commit, |
| 119 | upload_parent_commit, |
| 120 | ): |
| 121 | @@ -571,7 +559,6 @@ def commit_unapplied_patches_import( |
| 122 | spi, |
| 123 | import_tree_hash, |
| 124 | namespace, |
| 125 | - publish_parent_commit, |
| 126 | changelog_parent_commit, |
| 127 | upload_parent_commit, |
| 128 | # unapplied trees do not have a distinct unapplied parent |
| 129 | @@ -583,7 +570,6 @@ def commit_applied_patches_import( |
| 130 | spi, |
| 131 | import_tree_hash, |
| 132 | namespace, |
| 133 | - publish_parent_commit, |
| 134 | changelog_parent_commit, |
| 135 | unapplied_parent_commit |
| 136 | ): |
| 137 | @@ -592,7 +578,6 @@ def commit_applied_patches_import( |
| 138 | spi, |
| 139 | import_tree_hash, |
| 140 | namespace, |
| 141 | - publish_parent_commit, |
| 142 | changelog_parent_commit, |
| 143 | # uploads will be unapplied trees currently, so applied trees |
| 144 | # can not have them as direct parents |
| 145 | @@ -830,16 +815,12 @@ def parse_parentfile(parentfile, pkgname): |
| 146 | The parent overrides file specifies parent-child relationship(s), |
| 147 | where the importer may not be able to determine them automatically. |
| 148 | The format of the file is: |
| 149 | - <pkgname> <child version> <publish parent version> <changelog parent version> |
| 150 | + <pkgname> <child version> <changelog parent version> |
| 151 | with one override per line. |
| 152 | |
| 153 | <child version> is the published version to which this override |
| 154 | applies. |
| 155 | |
| 156 | - The <publish parent version> is the prior version published in the |
| 157 | - same series/pocket, or the immediately preceding series/pocket, if |
| 158 | - this is the first publish in a series/pocket. |
| 159 | - |
| 160 | The <changelog parent version> is the prior version in the |
| 161 | child publish's debian/changelog. |
| 162 | |
| 163 | @@ -856,7 +837,7 @@ def parse_parentfile(parentfile, pkgname): |
| 164 | if line.startswith('#'): |
| 165 | continue |
| 166 | m = re.match( |
| 167 | - r'(?P<pkgname>\S*)\s*(?P<childversion>\S*)\s*(?P<parent1version>\S*)\s*(?P<parent2version>\S*)', |
| 168 | + r'(?P<pkgname>\S*)\s*(?P<childversion>\S*)\s*(?P<parent2version>\S*)', |
| 169 | line |
| 170 | ) |
| 171 | if m is None: |
| 172 | @@ -864,61 +845,15 @@ def parse_parentfile(parentfile, pkgname): |
| 173 | if m.group('pkgname') != pkgname: |
| 174 | continue |
| 175 | _PARENT_OVERRIDES[m.group('childversion')] = { |
| 176 | - 'publish_parent':m.group('parent1version'), |
| 177 | - 'changelog_parent':m.group('parent2version') |
| 178 | - } |
| 179 | + 'changelog_parent': m.group('parent2version') |
| 180 | + } |
| 181 | except FileNotFoundError: |
| 182 | pass |
| 183 | |
| 184 | def override_parents(repo, spi, namespace): |
| 185 | - unapplied_publish_parent_commit = None |
| 186 | unapplied_changelog_parent_commit = None |
| 187 | - applied_publish_parent_commit = None |
| 188 | applied_changelog_parent_commit = None |
| 189 | |
| 190 | - unapplied_publish_parent_tag = repo.get_import_tag( |
| 191 | - _PARENT_OVERRIDES[spi.version]['publish_parent'], |
| 192 | - namespace |
| 193 | - ) |
| 194 | - applied_publish_parent_tag = repo.get_applied_tag( |
| 195 | - _PARENT_OVERRIDES[spi.version]['publish_parent'], |
| 196 | - namespace |
| 197 | - ) |
| 198 | - if unapplied_publish_parent_tag is not None: |
| 199 | - # sanity check that version from d/changelog of the |
| 200 | - # tagged commit matches ours |
| 201 | - parent_publish_version, _ = \ |
| 202 | - repo.get_changelog_versions_from_treeish( |
| 203 | - str(unapplied_publish_parent_tag.peel().id), |
| 204 | - ) |
| 205 | - if parent_publish_version != _PARENT_OVERRIDES[spi.version]['publish_parent']: |
| 206 | - logging.error('Found a tag corresponding to publish parent ' |
| 207 | - 'override version %s, but d/changelog version (%s) ' |
| 208 | - 'differs. Will orphan commit.', |
| 209 | - _PARENT_OVERRIDES[spi.version]['publish_parent'], |
| 210 | - parent_publish_version |
| 211 | - ) |
| 212 | - else: |
| 213 | - unapplied_publish_parent_commit = str(unapplied_publish_parent_tag.peel().id) |
| 214 | - if applied_publish_parent_tag is not None: |
| 215 | - applied_publish_parent_commit = str(applied_publish_parent_tag.peel().id) |
| 216 | - logging.debug('Overriding publish parent (tag) to %s', |
| 217 | - repo.tag_to_pretty_name(unapplied_publish_parent_tag) |
| 218 | - ) |
| 219 | - else: |
| 220 | - if _PARENT_OVERRIDES[spi.version]['publish_parent'] == '-': |
| 221 | - logging.debug('Not setting publish parent as ' |
| 222 | - 'specified in override file.' |
| 223 | - ) |
| 224 | - else: |
| 225 | - raise ParentOverrideError( |
| 226 | - "Specified publish parent override (%s) for version (%s) " |
| 227 | - "not found in tags. Unable to proceed." % ( |
| 228 | - _PARENT_OVERRIDES[spi.version]['publish_parent'], |
| 229 | - spi.version |
| 230 | - ) |
| 231 | - ) |
| 232 | - |
| 233 | unapplied_changelog_parent_tag = repo.get_import_tag( |
| 234 | _PARENT_OVERRIDES[spi.version]['changelog_parent'], |
| 235 | namespace |
| 236 | @@ -964,9 +899,7 @@ def override_parents(repo, spi, namespace): |
| 237 | ) |
| 238 | ) |
| 239 | return ( |
| 240 | - unapplied_publish_parent_commit, |
| 241 | unapplied_changelog_parent_commit, |
| 242 | - applied_publish_parent_commit, |
| 243 | applied_changelog_parent_commit, |
| 244 | ) |
| 245 | |
| 246 | @@ -975,77 +908,34 @@ def _update_devel_branches( |
| 247 | namespace, |
| 248 | pkgname, |
| 249 | ubuntu_sinfo, |
| 250 | - spi=None, |
| 251 | + spi, |
| 252 | ): |
| 253 | - if spi: |
| 254 | - # we do not maintain -devel pointers for debian |
| 255 | - if str(spi.distribution.name.lower()) != "ubuntu": |
| 256 | - return |
| 257 | - for devel_head in ( |
| 258 | - '%s/ubuntu/%s-devel' % (namespace, spi.series.name.lower()), |
| 259 | - '%s/ubuntu/devel' % namespace |
| 260 | - ): |
| 261 | - try: |
| 262 | - devel_head_hash = repo.head_to_commit(devel_head) |
| 263 | - devel_head_version, _ = repo.get_changelog_versions_from_treeish(devel_head_hash) |
| 264 | - except AttributeError: |
| 265 | - devel_head_version = None |
| 266 | - if version_compare(spi.version, devel_head_version) <= 0: |
| 267 | - return |
| 268 | - logging.debug("Updating %s to %s" % (devel_head, |
| 269 | - spi.head_name(namespace))) |
| 270 | - repo.merge_commit_to_devel_head( |
| 271 | - namespace, |
| 272 | - devel_head, |
| 273 | - repo.head_to_commit(spi.head_name(namespace)), |
| 274 | - environment_spi=spi, |
| 275 | - ) |
| 276 | - else: |
| 277 | - ubuntu_head_versions = repo.get_heads_and_versions( |
| 278 | - 'ubuntu', |
| 279 | - namespace, |
| 280 | + # spi previously had a default argument value of None, but the |
| 281 | + # functionality has since been dropped. Let's ensure that no caller |
| 282 | + # depending on this functionality remains. |
| 283 | + assert spi |
| 284 | + |
| 285 | + # we do not maintain -devel pointers for debian |
| 286 | + if str(spi.distribution.name.lower()) != "ubuntu": |
| 287 | + return |
| 288 | + for devel_head in ( |
| 289 | + '%s/ubuntu/%s-devel' % (namespace, spi.series.name.lower()), |
| 290 | + '%s/ubuntu/devel' % namespace |
| 291 | + ): |
| 292 | + logging.debug("Updating %s to %s" % (devel_head, |
| 293 | + spi.head_name(namespace))) |
| 294 | + repo.update_head_to_commit( |
| 295 | + devel_head, |
| 296 | + repo.head_to_commit(spi.head_name(namespace)), |
| 297 | ) |
| 298 | - devel_hash = None |
| 299 | - devel_name = None |
| 300 | - for rel in ubuntu_sinfo.active_series_name_list: |
| 301 | - series_devel_hash = None |
| 302 | - series_devel_name = None |
| 303 | - series_devel_version = None |
| 304 | - # Find highest version publish in these pockets |
| 305 | - for suff in ("-proposed", "-updates", "-security", ""): |
| 306 | - name = "%s/ubuntu/%s%s" % (namespace, rel, suff) |
| 307 | - if name in ubuntu_head_versions and version_compare( |
| 308 | - ubuntu_head_versions[name]['version'], |
| 309 | - series_devel_version |
| 310 | - ) > 0: |
| 311 | - series_devel_name = name |
| 312 | - series_devel_version = ubuntu_head_versions[name]['version'] |
| 313 | - series_devel_hash = str(ubuntu_head_versions[name]['head'].peel().id) |
| 314 | - if series_devel_hash: |
| 315 | - if not devel_hash: |
| 316 | - devel_hash = series_devel_hash |
| 317 | - devel_name = series_devel_name |
| 318 | - logging.debug("Updating %s/ubuntu/%s-devel branch to '%s' (%s)", |
| 319 | - namespace, rel, series_devel_name, series_devel_hash) |
| 320 | - repo.merge_commit_to_devel_head(namespace, |
| 321 | - "%s/ubuntu/%s-devel" % (namespace, rel), series_devel_hash) |
| 322 | - if devel_hash is None: |
| 323 | - logging.warn("Package '%s' does not appear to have been published " |
| 324 | - "in Ubuntu. No %s/ubuntu/devel branch created.", |
| 325 | - pkgname, namespace) |
| 326 | - else: |
| 327 | - logging.debug("Setting %s/ubuntu/devel branch to '%s' (%s)", |
| 328 | - namespace, devel_name, devel_hash) |
| 329 | - repo.merge_commit_to_devel_head( |
| 330 | - namespace, "%s/ubuntu/devel" % namespace, devel_hash |
| 331 | - ) |
| 332 | + |
| 333 | |
| 334 | def update_devel_branches( |
| 335 | repo, |
| 336 | namespace, |
| 337 | pkgname, |
| 338 | ubuntu_sinfo, |
| 339 | - spi=None, |
| 340 | + spi, |
| 341 | ): |
| 342 | _update_devel_branches( |
| 343 | repo=repo, |
| 344 | @@ -1060,7 +950,7 @@ def update_applied_devel_branches( |
| 345 | namespace, |
| 346 | pkgname, |
| 347 | ubuntu_sinfo, |
| 348 | - spi=None, |
| 349 | + spi, |
| 350 | ): |
| 351 | _update_devel_branches( |
| 352 | repo=repo, |
| 353 | @@ -1154,7 +1044,6 @@ def import_unapplied_spi(repo, spi, namespace, skip_orig, ubuntu_sinfo): |
| 354 | |
| 355 | logging.debug('Tip version is %s', unapplied_tip_version) |
| 356 | |
| 357 | - unapplied_publish_parent_commit = None |
| 358 | unapplied_changelog_parent_commit = None |
| 359 | upload_parent_commit = None |
| 360 | unapplied_parent_commit = None |
| 361 | @@ -1167,30 +1056,20 @@ def import_unapplied_spi(repo, spi, namespace, skip_orig, ubuntu_sinfo): |
| 362 | |
| 363 | try: |
| 364 | ( |
| 365 | - unapplied_publish_parent_commit, |
| 366 | unapplied_changelog_parent_commit, |
| 367 | - _, |
| 368 | _ |
| 369 | ) = override_parents(repo, spi, namespace) |
| 370 | except ParentOverrideError as e: |
| 371 | logging.error("%s" % e) |
| 372 | - return 1 |
| 373 | + return |
| 374 | else: |
| 375 | - # Get parent from publishing history (which is the last |
| 376 | - # published version in the corresponding series) |
| 377 | - try: |
| 378 | - unapplied_publish_parent_commit = str(unapplied_tip_head.peel().id) |
| 379 | - except AttributeError: |
| 380 | - try: |
| 381 | - unapplied_publish_parent_head = repo.get_head_by_name(spi.parent_head_name(namespace)) |
| 382 | - unapplied_publish_parent_commit = str(unapplied_publish_parent_head.peel().id) |
| 383 | - except AttributeError: |
| 384 | - pass |
| 385 | - |
| 386 | if version_compare(str(spi.version), unapplied_tip_version) <= 0: |
| 387 | - logging.warn('Version to import (%s) is not after %s tip (%s)', |
| 388 | - spi.version, pretty_head_name, unapplied_tip_version |
| 389 | - ) |
| 390 | + logging.warn( |
| 391 | + "Version to import (%s) is not after %s tip (%s)", |
| 392 | + spi.version, |
| 393 | + pretty_head_name, |
| 394 | + unapplied_tip_version, |
| 395 | + ) |
| 396 | |
| 397 | # Walk changelog backwards until we find an imported version |
| 398 | for version in import_tree_versions: |
| 399 | @@ -1207,60 +1086,51 @@ def import_unapplied_spi(repo, spi, namespace, skip_orig, ubuntu_sinfo): |
| 400 | # tree's debian/changelog, as it wasn't used |
| 401 | if (version not in _PARENT_OVERRIDES and |
| 402 | parent_changelog_version != version |
| 403 | - ): |
| 404 | - logging.error('Found a tag corresponding to ' |
| 405 | - 'parent version %s, but d/changelog ' |
| 406 | - 'version (%s) differs. Will ' |
| 407 | - 'orphan commit.' % ( |
| 408 | - version, |
| 409 | - parent_changelog_version |
| 410 | - ) |
| 411 | - ) |
| 412 | + ): |
| 413 | + logging.error( |
| 414 | + "Found a tag corresponding to parent version " |
| 415 | + "%s, but d/changelog version (%s) differs. Will " |
| 416 | + "orphan commit.", |
| 417 | + version, |
| 418 | + parent_changelog_version, |
| 419 | + ) |
| 420 | else: |
| 421 | unapplied_changelog_parent_commit = str(unapplied_changelog_parent_tag.peel().id) |
| 422 | - logging.debug('Changelog parent (tag) is %s', |
| 423 | + logging.debug("Changelog parent (tag) is %s", |
| 424 | repo.tag_to_pretty_name(unapplied_changelog_parent_tag) |
| 425 | - ) |
| 426 | + ) |
| 427 | break |
| 428 | |
| 429 | - # If the two parents are tree-identical, then favor publication |
| 430 | - # history. This deals with copy-forwards between series and with |
| 431 | - # syncs. |
| 432 | - if repo.treeishs_identical(unapplied_publish_parent_commit, unapplied_changelog_parent_commit): |
| 433 | - unapplied_changelog_parent_commit = None |
| 434 | - |
| 435 | # check if the version to import has already been uploaded to |
| 436 | # this head -- we leverage the above code to perform a 'dry-run' |
| 437 | - # of the import tree, to obtain the (up to) two parents |
| 438 | + # of the import tree, to obtain the changelog parent |
| 439 | upload_tag = repo.get_upload_tag(spi.version, namespace) |
| 440 | import_tag = repo.get_import_tag(spi.version, namespace) |
| 441 | - if upload_tag and not import_tag: |
| 442 | + if import_tag: |
| 443 | + if str(import_tag.peel().tree.id) != unapplied_import_tree_hash: |
| 444 | + logging.error( |
| 445 | + "Found import tag %s, but the corresponding tree " |
| 446 | + "does not match the published version. Will orphan commit.", |
| 447 | + repo.tag_to_pretty_name(import_tag), |
| 448 | + ) |
| 449 | + unapplied_changelog_parent_commit = None |
| 450 | + else: |
| 451 | + repo.update_head_to_commit( |
| 452 | + spi.head_name(namespace), |
| 453 | + str(import_tag.peel().id), |
| 454 | + ) |
| 455 | + return |
| 456 | + elif upload_tag: |
| 457 | if str(upload_tag.peel().tree.id) != unapplied_import_tree_hash: |
| 458 | - logging.warn('Found upload tag %s, ' |
| 459 | - 'but the corresponding tree ' |
| 460 | - 'does not match the published ' |
| 461 | - 'version. Will import %s as ' |
| 462 | - 'normal, ignoring the upload tag.', |
| 463 | - repo.tag_to_pretty_name(upload_tag), |
| 464 | - spi.version |
| 465 | - ) |
| 466 | + logging.warn( |
| 467 | + "Found upload tag %s, but the corresponding tree " |
| 468 | + "does not match the published version. Will import %s as " |
| 469 | + "normal, ignoring the upload tag.", |
| 470 | + repo.tag_to_pretty_name(upload_tag), |
| 471 | + spi.version, |
| 472 | + ) |
| 473 | else: |
| 474 | upload_parent_commit = str(upload_tag.peel().id) |
| 475 | - if unapplied_publish_parent_commit is not None: |
| 476 | - try: |
| 477 | - repo.git_run( |
| 478 | - [ |
| 479 | - 'merge-base', |
| 480 | - '--is-ancestor', |
| 481 | - unapplied_publish_parent_commit, |
| 482 | - upload_parent_commit, |
| 483 | - ], |
| 484 | - verbose_on_failure=False, |
| 485 | - ) |
| 486 | - unapplied_publish_parent_commit = None |
| 487 | - except CalledProcessError as e: |
| 488 | - if e.returncode != 1: |
| 489 | - raise |
| 490 | |
| 491 | if unapplied_changelog_parent_commit is not None: |
| 492 | try: |
| 493 | @@ -1283,10 +1153,9 @@ def import_unapplied_spi(repo, spi, namespace, skip_orig, ubuntu_sinfo): |
| 494 | spi, |
| 495 | unapplied_import_tree_hash, |
| 496 | namespace, |
| 497 | - unapplied_publish_parent_commit, |
| 498 | unapplied_changelog_parent_commit, |
| 499 | upload_parent_commit, |
| 500 | - ) |
| 501 | + ) |
| 502 | |
| 503 | update_devel_branches( |
| 504 | repo=repo, |
| 505 | @@ -1346,7 +1215,6 @@ def import_applied_spi( |
| 506 | |
| 507 | logging.debug('Tip version is %s', applied_tip_version) |
| 508 | |
| 509 | - applied_publish_parent_commit = None |
| 510 | applied_changelog_parent_commit = None |
| 511 | |
| 512 | if spi.version in _PARENT_OVERRIDES: |
| 513 | @@ -1356,8 +1224,6 @@ def import_applied_spi( |
| 514 | |
| 515 | ( |
| 516 | _, |
| 517 | - _, |
| 518 | - applied_publish_parent_commit, |
| 519 | applied_changelog_parent_commit, |
| 520 | ) = override_parents( |
| 521 | repo, |
| 522 | @@ -1365,17 +1231,6 @@ def import_applied_spi( |
| 523 | namespace, |
| 524 | ) |
| 525 | else: |
| 526 | - # Get parent from publishing history (which is the last |
| 527 | - # published version in the corresponding series) |
| 528 | - try: |
| 529 | - applied_publish_parent_commit = str(applied_tip_head.peel().id) |
| 530 | - except AttributeError: |
| 531 | - try: |
| 532 | - applied_publish_parent_head = repo.get_head_by_name(spi.applied_parent_head_name(namespace)) |
| 533 | - applied_publish_parent_head_commit = str(applied_publish_parent_head.peel().id) |
| 534 | - except AttributeError: |
| 535 | - pass |
| 536 | - |
| 537 | if version_compare(str(spi.version), applied_tip_version) <= 0: |
| 538 | logging.warn('Version to import (%s) is not after %s tip (%s)', |
| 539 | spi.version, pretty_head_name, applied_tip_version |
| 540 | @@ -1412,11 +1267,26 @@ def import_applied_spi( |
| 541 | ) |
| 542 | break |
| 543 | |
| 544 | - # If the two parents are tree-identical, then favor publication |
| 545 | - # history. This deals with copy-forwards between series and with |
| 546 | - # syncs. |
| 547 | - if repo.treeishs_identical(applied_publish_parent_commit, applied_changelog_parent_commit): |
| 548 | - applied_changelog_parent_commit = None |
| 549 | + applied_tag = repo.get_applied_tag(version, namespace) |
| 550 | + if applied_tag: |
| 551 | + # XXX: What should be checked here? The result of pushing all |
| 552 | + # the patches? How to do it most non-destructively? (Might be |
| 553 | + # able to use our new helper to get treeish after running a |
| 554 | + # command, in this case, `quilt push -a`) |
| 555 | + # if str(applied_tag.peel().tree.id) != applied_import_tree_hash: |
| 556 | + # logging.error( |
| 557 | + # "Found patches-applied import tag %s, but the " |
| 558 | + # "corresponding tree does not match the published " |
| 559 | + # "version. Will orphan commit.", |
| 560 | + # repo.tag_to_pretty_name(applied_tag), |
| 561 | + # ) |
| 562 | + # applied_changelog_parent_commit = None |
| 563 | + #else: |
| 564 | + repo.update_head_to_commit( |
| 565 | + spi.applied_head_name(namespace), |
| 566 | + str(applied_tag.peel().id), |
| 567 | + ) |
| 568 | + return |
| 569 | |
| 570 | # Assume no patches to apply |
| 571 | applied_import_tree_hash = unapplied_import_tree_hash |
| 572 | @@ -1461,7 +1331,6 @@ def import_applied_spi( |
| 573 | spi, |
| 574 | applied_import_tree_hash, |
| 575 | namespace, |
| 576 | - applied_publish_parent_commit, |
| 577 | applied_changelog_parent_commit, |
| 578 | unapplied_parent_commit, |
| 579 | ) |
| 580 | @@ -1485,7 +1354,6 @@ def import_publishes( |
| 581 | ubuntu_sinfo, |
| 582 | active_series_only, |
| 583 | workdir, |
| 584 | - fixup_devel, |
| 585 | skip_orig, |
| 586 | allow_applied_failures, |
| 587 | ): |
| 588 | @@ -1526,15 +1394,6 @@ def import_publishes( |
| 589 | namespace=_namespace, |
| 590 | ubuntu_sinfo=ubuntu_sinfo, |
| 591 | ) |
| 592 | - # Do not push upstream |
| 593 | - if fixup_devel and distname == "ubuntu": |
| 594 | - update_devel_branches( |
| 595 | - repo=repo, |
| 596 | - namespace=namespace, |
| 597 | - pkgname=pkgname, |
| 598 | - ubuntu_sinfo=ubuntu_sinfo, |
| 599 | - spi=None, |
| 600 | - ) |
| 601 | except NoPublicationHistoryException: |
| 602 | logging.warning("No publication history found for %s in %s.", |
| 603 | pkgname, distname |
| 604 | @@ -1596,8 +1455,6 @@ def parse_args(subparsers=None, base_subparsers=None): |
| 605 | 'Will create the local repository if needed.', |
| 606 | default=argparse.SUPPRESS |
| 607 | ) |
| 608 | - parser.add_argument('--fixup-devel', action='store_true', |
| 609 | - help=argparse.SUPPRESS) |
| 610 | parser.add_argument('--active-series-only', action='store_true', |
| 611 | help='Do an import of only active Ubuntu series ' |
| 612 | 'history, implies --no-push.') |
| 613 | @@ -1646,7 +1503,6 @@ def cli_main(args): |
| 614 | no_clean=no_clean, |
| 615 | no_fetch=args.no_fetch, |
| 616 | no_push=no_push, |
| 617 | - fixup_devel=args.fixup_devel, |
| 618 | active_series_only=args.active_series_only, |
| 619 | skip_orig=args.skip_orig, |
| 620 | skip_applied=args.skip_applied, |
| 621 | diff --git a/gitubuntu/importlocal.py b/gitubuntu/importlocal.py |
| 622 | index 16f3a6b..13f8690 100644 |
| 623 | --- a/gitubuntu/importlocal.py |
| 624 | +++ b/gitubuntu/importlocal.py |
| 625 | @@ -209,7 +209,6 @@ def main( |
| 626 | changelog_entry = get_changelog_for_commit( |
| 627 | repo=repo, |
| 628 | tree_hash=unapplied_import_tree_hash, |
| 629 | - publish_parent_commit=None, |
| 630 | changelog_parent_commit=unapplied_changelog_parent_commit, |
| 631 | ) |
| 632 | |
| 633 | diff --git a/gitubuntu/parent_overrides.txt b/gitubuntu/parent_overrides.txt |
| 634 | index 9393c8d..6045bfc 100644 |
| 635 | --- a/gitubuntu/parent_overrides.txt |
| 636 | +++ b/gitubuntu/parent_overrides.txt |
| 637 | @@ -1,4 +1,4 @@ |
| 638 | -# pkgname child-version publish-parent-version changelog-parent-version |
| 639 | -clamav 0.91.2-3ubuntu2.1~feisty1 0.92~dfsg-2~feisty1 0.91.2-3ubuntu2.1 |
| 640 | -memcached 1.1.12-1 1.4.2-1 - |
| 641 | -golang-golang-x-net-dev 1:0.0+git20150817.66f0418-1 0.0+git20151007.b846920+dfsg-1 0.0+git20150226.3d87fd6-3 |
| 642 | +# pkgname child-version changelog-parent-version |
| 643 | +clamav 0.91.2-3ubuntu2.1~feisty1 0.91.2-3ubuntu2.1 |
| 644 | +memcached 1.1.12-1 - |
| 645 | +golang-golang-x-net-dev 1:0.0+git20150817.66f0418-1 0.0+git20150226.3d87fd6-3 |
| 646 | diff --git a/man/man1/git-ubuntu-import.1 b/man/man1/git-ubuntu-import.1 |
| 647 | index c73f7ce..afe5ad2 100644 |
| 648 | --- a/man/man1/git-ubuntu-import.1 |
| 649 | +++ b/man/man1/git-ubuntu-import.1 |
| 650 | @@ -33,9 +33,6 @@ Import the orig tarballs for <publish> using "gbp import-orig |
| 651 | --pristine-tar", unless they have already been imported and the imported |
| 652 | tarballs are identical. |
| 653 | .PP |
| 654 | -Find a <publish parent>: the most recent patches-unapplied import to the |
| 655 | -same series and pocket\&. |
| 656 | -.PP |
| 657 | Find a <changelog parent>: the most recent changelog entry with a |
| 658 | corresponding patches-unapplied import\&. |
| 659 | .PP |
| 660 | @@ -43,8 +40,7 @@ Find a <upload parent>: a upload-tag in the repository for the same |
| 661 | version as <publish> with git-tree-identical contents as <publish>\&. |
| 662 | .PP |
| 663 | Commit the git tree corresponding to a patches-unapplied extraction of |
| 664 | -<publish> using all of <publish parent>, <changelog parent> and <upload |
| 665 | -parent> as parents\&. |
| 666 | +<publish> using <changelog parent> and <upload parent> as parents\&. |
| 667 | .PP |
| 668 | If this is the first patches-unapplied import of a given version, create |
| 669 | a tag in refs/tags/import/ pointing to the new commit\&. |
| 670 | @@ -62,9 +58,6 @@ For each <publish> in <distribution> since the most recent |
| 671 | patches-applied import in the local repository\&: |
| 672 | .RS 4 |
| 673 | .PP |
| 674 | -Find a <publish parent>: the most recent patches-applied import to the |
| 675 | -same series and pocket\&. |
| 676 | -.PP |
| 677 | Find a <changelog parent>: the most recent changelog entry with a |
| 678 | corresponding patches-applied import\&. |
| 679 | .PP |
| 680 | @@ -72,8 +65,8 @@ Find a <unapplied parent>: the corresponding patches-unapplied import of |
| 681 | <publish>'s version\&. |
| 682 | .PP |
| 683 | Commit each git tree corresponding to the application of the next quilt |
| 684 | -patch in <publish> using all of <publish parent>, <changelog parent> and |
| 685 | -<unapplied parent> as parent\&. |
| 686 | +patch in <publish> using <changelog parent> and <unapplied parent> as |
| 687 | +parents\&. |
| 688 | As each quilt patch is applied, the <unapplied parent> becomes the |
| 689 | result of the immediately prior patch's application\&. |
| 690 | .PP |

FAILED: Continuous integration, rev:e18dd529d2d 7cb7a0d789ddbef e2fe6b1b0b74d1 /jenkins. ubuntu. com/server/ job/git- ubuntu- ci/161/
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Style Check
SUCCESS: Unit Tests
FAILED: Integration Tests
Click here to trigger a rebuild: /jenkins. ubuntu. com/server/ job/git- ubuntu- ci/161/ rebuild
https:/