- string_list = string.split('/')
-
- if len(string_list) == 1:
- patch_name = None
- git_id = string_list[0]
-
- if git_id == 'HEAD':
- return git.get_head()
- if git_id == 'base':
- return read_string(crt_series.get_base_file())
-
- for path in [os.path.join(git.base_dir, 'refs', 'heads'),
- os.path.join(git.base_dir, 'refs', 'tags')]:
- id_file = os.path.join(path, git_id)
- if os.path.isfile(id_file):
- return read_string(id_file)
-
- # maybe GIT knows more about this id
- if not strict:
- return git_id
- elif len(string_list) == 2:
- patch_name = string_list[0]
- if patch_name == '':
- patch_name = crt_series.get_current()
- git_id = string_list[1]