Run "p4 change -o" to grab a change specification template. This does not use "p4 -G", as it is nice to keep the submission template in original order, since a human might edit it. Remove lines in the Files section that show changes to files outside the
(self, changelist=None)
| 2007 | return 0 |
| 2008 | |
| 2009 | def prepareSubmitTemplate(self, changelist=None): |
| 2010 | """Run "p4 change -o" to grab a change specification template. |
| 2011 | |
| 2012 | This does not use "p4 -G", as it is nice to keep the submission |
| 2013 | template in original order, since a human might edit it. |
| 2014 | |
| 2015 | Remove lines in the Files section that show changes to files |
| 2016 | outside the depot path we're committing into. |
| 2017 | """ |
| 2018 | |
| 2019 | upstream, settings = findUpstreamBranchPoint() |
| 2020 | |
| 2021 | template = """\ |
| 2022 | # A Perforce Change Specification. |
| 2023 | # |
| 2024 | # Change: The change number. 'new' on a new changelist. |
| 2025 | # Date: The date this specification was last modified. |
| 2026 | # Client: The client on which the changelist was created. Read-only. |
| 2027 | # User: The user who created the changelist. |
| 2028 | # Status: Either 'pending' or 'submitted'. Read-only. |
| 2029 | # Type: Either 'public' or 'restricted'. Default is 'public'. |
| 2030 | # Description: Comments about the changelist. Required. |
| 2031 | # Jobs: What opened jobs are to be closed by this changelist. |
| 2032 | # You may delete jobs from this list. (New changelists only.) |
| 2033 | # Files: What opened files from the default changelist are to be added |
| 2034 | # to this changelist. You may delete files from this list. |
| 2035 | # (New changelists only.) |
| 2036 | """ |
| 2037 | files_list = [] |
| 2038 | inFilesSection = False |
| 2039 | change_entry = None |
| 2040 | args = ['change', '-o'] |
| 2041 | if changelist: |
| 2042 | args.append(str(changelist)) |
| 2043 | for entry in p4CmdList(args): |
| 2044 | if 'code' not in entry: |
| 2045 | continue |
| 2046 | if entry['code'] == 'stat': |
| 2047 | change_entry = entry |
| 2048 | break |
| 2049 | if not change_entry: |
| 2050 | die('Failed to decode output of p4 change -o') |
| 2051 | for key, value in change_entry.items(): |
| 2052 | if key.startswith('File'): |
| 2053 | if 'depot-paths' in settings: |
| 2054 | if not [p for p in settings['depot-paths'] |
| 2055 | if p4PathStartsWith(value, p)]: |
| 2056 | continue |
| 2057 | else: |
| 2058 | if not p4PathStartsWith(value, self.depotPath): |
| 2059 | continue |
| 2060 | files_list.append(value) |
| 2061 | continue |
| 2062 | # Output in the order expected by prepareLogMessage |
| 2063 | for key in ['Change', 'Client', 'User', 'Status', 'Description', 'Jobs']: |
| 2064 | if key not in change_entry: |
| 2065 | continue |
| 2066 | template += '\n' |
no test coverage detected