FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add 'squash_option (never, always, default_on, default_off)' in projects · Issue #1744 · python-gitlab/python-gitlab · GitHub

Repository navigation

Add 'squash_option (never, always, default_on, default_off)' in projects #1744

Description

Description of the problem, including code/CLI snippet

The "squash_option" gitlab project setting is not available in python object project like other merge options.

Expected Behavior

project = gitlab.projects.get(id)

print('\tMerge method:', project.merge_method)
print('\tRemove source branch after merge:', project.remove_source_branch_after_merge)
print('\tSquash commit when merging:', project.squash_option)
print('\tOnly allow merge if pipeline secceeds:', project.only_allow_merge_if_pipeline_succeeds)
print('\tOnly allow merge if all discussions are resolved:', project.only_allow_merge_if_all_discussions_are_resolved)

Actual Behavior

project = gitlab.projects.get(id)

print('\tMerge method:', project.merge_method)
print('\tRemove source branch after merge:', project.remove_source_branch_after_merge)
print('\tSquash commit when merging:', '???')
print('\tOnly allow merge if pipeline secceeds:', project.only_allow_merge_if_pipeline_succeeds)
print('\tOnly allow merge if all discussions are resolved:', project.only_allow_merge_if_all_discussions_are_resolved)

Specifications

  • python-gitlab version: 2.10.1
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): gitlab enterprise edition 13.11.1

Activity

  1. JohnVillalovos commented on Dec 13, 2021

    Member

    What kind of error do you get when you try to access project.squash_options ?

  2. svart-riddare commented on Dec 13, 2021

    Author

    Simply that the attribute does not exist :

    Traceback (most recent call last):
      File "...\AppData\Local\Programs\Python\Python39\lib\site-packages\gitlab\base.py", line 85, in __getattr__
        return self.__dict__["_updated_attrs"][name]
    KeyError: 'squash_option'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "...\AppData\Local\Programs\Python\Python39\lib\site-packages\gitlab\base.py", line 88, in __getattr__
        value = self.__dict__["_attrs"][name]
    KeyError: 'squash_option'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "...\AppData\Local\Programs\Python\Python39\lib\site-packages\gitlab\base.py", line 108, in __getattr__
        return self.__dict__["_parent_attrs"][name]
    KeyError: 'squash_option'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "....py", line 38, in <module>
        print('\tSquash commit when merging:', project.squash_option)
      File "...\AppData\Local\Programs\Python\Python39\lib\site-packages\gitlab\base.py", line 110, in __getattr__
        raise AttributeError(name)
    AttributeError: squash_option
    
  3. JohnVillalovos commented on Dec 13, 2021

    Member

    Have you tested this against https://gitlab.com ?

    I just did it and it worked. My theory is that your version of Gitlab is too old.

    Search for the string squash_option here:

    https://gitlab.com/gitlab-org/gitlab/-/blob/master/CHANGELOG.md

    It appears it was added in Gitlab 14.1.0.

  4. JohnVillalovos commented on Dec 13, 2021

    Member

    Though we still need to add it to the list of known attributes so it can be used in the CLI.

  5. svart-riddare commented on Dec 13, 2021

    Author

    You are right, I have this option in the gitlab GUI but it was added in the Gitlab API in 14.1.0 as you pointed out. Thank you for your time !

  6. added 2 commits that reference this issue on Dec 14, 2021
    c3d0176
    a246ce8
  7. locked as resolved and limited conversation to collaborators on Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL