Bug 242238

Summary: [webkitpy] runtime error in function _fill from local/git.py
Product: WebKit Reporter: Diego Pino <dpino>
Component: New BugsAssignee: Diego Pino <dpino>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Diego Pino 2022-07-01 02:44:15 PDT
I got the following error while building WebKitGTK/WPE:

```
FAILED: Source/JavaScriptCore/CMakeFiles/JavaScriptCore-build-revision /home/dpino/playwright/browser_patches/webkit/checkout/WebKitBuild/GTK/Release/Source/JavaScriptCore/CMakeFiles/JavaScriptCore-build-revision 
cd /home/dpino/playwright/browser_patches/webkit/checkout && /usr/bin/python3.6 /home/dpino/playwright/browser_patches/webkit/checkout/Tools/glib/apply-build-revision-to-files.py /home/dpino/playwright/browser_patches/webkit/checkout/WebKitBuild/GTK/Release/Source/JavaScriptCore/javascriptcoregtk-4.0.pc
Traceback (most recent call last):
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/glib/apply-build-revision-to-files.py", line 68, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/glib/apply-build-revision-to-files.py", line 41, in main
    build_revision = get_build_revision()
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/glib/apply-build-revision-to-files.py", line 32, in get_build_revision
    return str(repository.find("HEAD", include_log=False))
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py", line 842, in find
    return self.commit(hash=output.stdout.rstrip(), include_log=include_log, include_identifier=include_identifier)
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py", line 662, in commit
    cached_identifier = self.cache.to_identifier(hash=hash, branch=branch) if self.cache else None
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py", line 294, in to_identifier
    self.populate(branch=branch)
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py", line 188, in populate
    self._fill(branch)
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py", line 80, in _fill
    branch_point = int(self._hash_to_identifiers[self._ordered_commits[branch][0]].split('@')[0])
  File "/home/dpino/playwright/browser_patches/webkit/checkout/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/nested_fuzzy_dict.py", line 53, in __getitem__
    raise KeyError(keyname)
KeyError: 'e6896ffd9b1a4b6deae32a0098a870ef68f8bddf'

```

I can reproduce the error simply by running the following command:

```
$ python3 Tools/glib/apply-build-revision-to-files.py
```

I think this error was unearthed by 252012@main, which is now using local/git.py.

I also noticed the error happens only if default_branch() returns something different than main. For instance, in my repository checkout the following commands returns:

```
$ git rev-parse --symbolic-full-name refs/remotes/origin/HEAD
refs/remotes/origin/master
```

In a different repository checkout where the command above return "refs/remotes/origin/main" I cannot reproduce the error.
Comment 1 Diego Pino 2022-07-01 02:52:06 PDT
Pull request: https://github.com/webkit/webkit/pull/1986
Comment 2 Radar WebKit Bug Importer 2022-07-08 02:45:17 PDT
<rdar://problem/96659502>
Comment 3 Diego Pino 2022-07-18 19:56:18 PDT

*** This bug has been marked as a duplicate of bug 242094 ***