From patchwork Wed Jan 12 13:46:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 525FDC433EF for ; Wed, 12 Jan 2022 13:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353688AbiALNrZ (ORCPT ); Wed, 12 Jan 2022 08:47:25 -0500 Received: from mail-dm6nam11on2052.outbound.protection.outlook.com ([40.107.223.52]:31597 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353687AbiALNrM (ORCPT ); Wed, 12 Jan 2022 08:47:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dPdzmsEeWYsikWPq0hRg9bqB4sfvhiAZfEGInqAIQAjuvhBPkykCi0m+F+27JS1ezlfjhHr/OJLfrVztodRepNmlXIMJ4/eotFNkok6XhiSYDXTvgfwQ5MsWa5AvpXn9fMHtcRP11ZqrrZB5pb/EWHEoC5Wpk9JPRu6BTF3gfMFoyod4RwldSAUxyxhC0MeYQzqpAI+eYBo4cKqiz/B+PXlzXqhdRh5oJLAwYU7l+yp3tgJYe3lCDkZWTl9+6Fo9Yz2FHR79RtunqQ2uQkp0S/2J7Or01Ay+4TkkjB7lXP+Az7x4VpYi08B6mnFi/rribSf5efw5Pua+Erf2V6Cdaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ktgOPrNAjMadJWXLBQaIX49y0/qM+/A/NaD6OcQQ6mM=; b=T851cX9fZ3TfFBfooJNmn2BnkjkyeKoY/9oMM9dZE3oU9qu2ijLrQZxNi0kdQ8WnzeMah1j6ocZWFeG+HdldFGGYG7JLRS461a1QiGjUAzsAP8klTgjVkx8+60ocp27k0fihj9GJCYUWsK0WZNhDYIRnmZ+eVrofsWohW3CpiCJjBBOiWlhSl4JZo2EBa5uApJcexf0m7is+9ETlctnTVyPH0XbGyf+HTZ6LLujnX0Gah6T/10I+WhuWTjrZDmdWuGiWaBty+NIxc2qTXl+PD01U7MaECCNTpTamqmyZjW2HTcvG+Jn0mJ0ABqiNdQ1M/zmOnV+JNVhrGOTC0FFIxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ktgOPrNAjMadJWXLBQaIX49y0/qM+/A/NaD6OcQQ6mM=; b=iaGaObwEi6Ok2l+s9pKWMlug8Wnk1pBaEA9ECqO1WmiXz+/Kr/5l+zh2N7L4HyBQBwGc3PMnihVzsBoMfYki1zQSjnGuoOAUGm28dRtzPhtL90GA+/cFr0ofr9hlX9eQJc1U9apXYoK+f+Dfp+qbxpBxCYLc7oW89rLtW/SLOzHgsXvPkuXPk4kDdnc1vJ7KNY4jxSEJXiNGUL8oHkhiUNCtdQ2rLSl6pKf5RiQiwzrKMm/F/5GBl2fyKA3I8hVbCtUAXPfF/JErXgpGsEEZ1GqDbhu/4uMgSi0oUogpAc2IiE/n20zVeWRdoTo4cPVbsSGU1uI4RuDbEvrmEc1zHg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by CH2PR12MB4136.namprd12.prod.outlook.com (2603:10b6:610:a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Wed, 12 Jan 2022 13:47:10 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:10 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 01/20] git-p4: add blank lines between functions and class definitions Date: Wed, 12 Jan 2022 13:46:16 +0000 Message-Id: <20220112134635.177877-2-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff744fc3-8c35-4fc6-a3c5-08d9d5d207d4 X-MS-TrafficTypeDiagnostic: CH2PR12MB4136:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:218; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xL3EIeKXQSyjzbcHNb/BaV63yjW3cGRd1MG0SMoxWT5A+y3C+ywFeJvfkZYCFKoYBg3ZLjZ8+VVamQRumjmjcUrRTGiDJG9d7ZZ/5cdvGVFhEb0u/o6uYO23T8F1kA9qu9HYUdkM1MIAJPtNLvBWP5SWF9ZtarD4lApUqywA5U/reYmU7pccDXqH7IHAiWEmw3krc7X2gJb7ZZw+fZk+6QyR2TWxuA+5i40/F1oRHTOq507iNZ0xAfDNHLtwPQruIOGT6ill7ntl+jo09UvXiixqPokeR81gb+Elli2gvUjhBwKiMN0S+VZlQUvSHePISoY/xaqyoRRftRyzNqcGLRx/Hj0Eg4g60d8oTxuP7hEbXudIyRZPm7ncavRVa835qbaQWKxEaMVSJFODOz6ZrtSH8+eektG/X1eQ4GQUOsuYzz1rrfaW/z1dMNESLwsx12lvqBnCH72kwsHcZeY8tNamqAFAOaaFvBBT6O/IA7sYyRXaVimiBbv/8IEEfqY+1OZ4KTbjR3+oXXk3cM3io6ePR5itQ3C1qmZRkV2AxZGBPhzE5uOZl264cdUZAlswg5MX0Qi14uBdIim9NfsqUVxeBAVnB/69Gj6+pfQS+y6lTaj52e2wspap5sTFaUvFmNhSnCS8Tw/dRwrwv1abTQ0qNKRmGVwiHUYuyUm6RItUIPT42wOcnJeVb7sMThJVm1CqdY+M/uGv0g+qxBprEF8jxCwnfW3HLh413U934C02Ewm0/0Mi/3fB9ONdIp/JrxQO6DyccNvPWoXIinwRoCbP47j89S3PQlC+w9pbFIV00u/TUDV/k0One6J2Dud9 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(508600001)(966005)(26005)(110136005)(8676002)(6486002)(2616005)(30864003)(38100700002)(86362001)(7416002)(36756003)(54906003)(5660300002)(8936002)(6512007)(4326008)(52116002)(2906002)(1076003)(66476007)(6506007)(66556008)(186003)(38350700002)(316002)(107886003)(83380400001)(66946007)(55236004)(334744004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AmnytSvU6fvoEKyslKHrtKyEyfHBhbrTmD7r01w5ZkwrOu46LVrdg5PjpPT42xyc7FzeAuqx3Y7RBStXxgFQ+Scy98rECs/4vK7IC/2/SRTqsnCqXS/3abx6Y2BU+enGguiCNtnOAR1I0fQ07Ny9yjEeFp3qQ7ZeTbCCyMGe9rbdO8UsaIXT8ojdp41Gtq4AdXaNiC2+L4R8IKkfpjjsL8XVicJZPZR89vMCjcQWvp9Oc8dMBd+SRjY9TMXGzKAyJt0NbhYp/gk2jZAdKfrMw7tVwQKwqPhH3QvE1JnjBvb8TAvu4g0HwC1egfMXnSfMQCcAPo1yQ1jLapkSluwnkVL13WJN9lwQdZCxSWxaiOoyVaTzZYGNmOG7QlQehmDVJMdHP6fOhhYW+evy+GW/VIhjN3ILGqN4SDTKm9bhlR89IWyOYD6GaUuU3gqAn8iAHm4XMeb2HYGQhsBoNciQ6xGgsPtDG07dh8QuclEwyfv66ADotMx3XvHN31ImeAafnrmJv1xCz/NAz928G8AnpkwgSCxyEAD99vt5TeI7N7NojsDwX6Vv2Pm4WQ1RObW3HlO0NAHg+Tm02mphQbVkJHabonjD1p8dQYsQICP7D8mKZCrRN2EB4Ntb7t/Ow+rTkvemUmSzEHCw0rY32NbDS02PgddPKZWxRx3TUl/fZ2KDEKyVhhYfFXOZhGi0yDbp+juVC0ARD4ms+9LdQSWbEK68DV0xA+9OAG31UIxRALiaq69aJTvwT6s5nIcv52lhbGm9f2EVq7EDFrEc5QPsF9Tjpe25VzI4i63Vd0Azy2ktcLIdC1swnZtvvPyeDH6ISDWsQffhV+bUhZPo+LnM5p5RrTmjrnDgktktASIGBK/MA9fy2qyrRgsY+sFgvBYzi1fNn2fJKdJjfJx9zryj8yrEWyQB1CaYzy/FJsZW076if8351ByMjUL523jlllGbb0E78RCneJQNy4gBY1ZovD97Ze7LBOigQK3Ke5TOd/Ol9XpaDTVhPpEzZCq8Bwe4yGfzgxiPFMY9qF5SuJuILjoo7i2n/x/2JbAhVNdqsPzgTzLpoezxfhEHN5LQdA21OguvggGMWF6Y6e6ehFgKAGV9A/bNSwDH0jjjzQXqvKouh+LooJ/krxxkAlB19tsPjkEa1J5ed7Xb+RP2Ht1WIePYR8VF0NsS9nGO3YqG8ukTZAmwB571X/IsWFGhW4kiUFTczf/PUF8P1ryKdV+EqmNmaQwJCzCGX2HoIx5uIkevwJo2Bfl9Bo0cAQfY88lqfWptOz6nH1Qa4uucUFzftEvdXZblKwlJITfPYSJGIfwNC25AFzgDUtjfnhwFrIpgr//oT5EkbDihWlIm+DtHwy6OmFBLccZ1Upm27L85RyuwgPOk3405Vmm/7AC+exaankDIRSJrtnjwCzFjQ/7ZfxpllDetvmlAHdVV+QjkYfdyBWyYLzvZoZNolEn44bQzu3JfIRWv+KnkwcM0fupUVC9QaoGS85Wt2cUqVuwsLmE/vXpRW98b6G/yrVsWiltX2lUL0g14XOcPYgASiRSiKINyZifjgfc2Jh35E5ZA6ygpcIsLhFjhp+jzUsTxQEsuNUSqOMSiaAOStSxib9a4SaPm9Zw4MwcR2uQxkhOnbOo= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff744fc3-8c35-4fc6-a3c5-08d9d5d207d4 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:10.4140 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7JUUydqwlVQUtoOSAvYpoycxE6hOxR0x3IqHW/NU/2wLICn0orp+xzg32jlBbrKLb8EDRELVixzG+A+A+I3FgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4136 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In the PEP8 style guidelines, top-level functions and class definitions should be separated by two blank lines. Methods should be surrounded by a single blank line. This guideline is described here in the "Blank Lines" section: https://www.python.org/dev/peps/pep-0008/#blank-lines Signed-off-by: Joel Holdsworth --- git-p4.py | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/git-p4.py b/git-p4.py index cb37545455..e6cc0f18a7 100755 --- a/git-p4.py +++ b/git-p4.py @@ -59,6 +59,7 @@ re_ko_keywords = re.compile(br'\$(Id|Header)(:[^$\n]+)?\$') re_k_keywords = re.compile(br'\$(Id|Header|Author|Date|DateTime|Change|File|Revision)(:[^$\n]+)?\$') + def format_size_human_readable(num): """ Returns a number of units (typically bytes) formatted as a human-readable string. @@ -71,6 +72,7 @@ def format_size_human_readable(num): return "{:3.1f} {}B".format(num, unit) return "{:.1f} YiB".format(num) + def p4_build_cmd(cmd): """Build a suitable p4 command line. @@ -121,6 +123,7 @@ def p4_build_cmd(cmd): return real_cmd + def git_dir(path): """ Return TRUE if the given path is a git directory (/path/to/dir/.git). This won't automatically add ".git" to a directory. @@ -131,6 +134,7 @@ def git_dir(path): else: return d + def chdir(path, is_client_path=False): """Do chdir to the given path, and set the PWD environment variable for use by P4. It does not look at getcwd() output. @@ -153,6 +157,7 @@ def chdir(path, is_client_path=False): path = os.getcwd() os.environ['PWD'] = path + def calcDiskFree(): """Return free space in bytes on the disk of the given dirname.""" if platform.system() == 'Windows': @@ -163,6 +168,7 @@ def calcDiskFree(): st = os.statvfs(os.getcwd()) return st.f_bavail * st.f_frsize + def die(msg): """ Terminate execution. Make sure that any running child processes have been wait()ed for before calling this. @@ -173,6 +179,7 @@ def die(msg): sys.stderr.write(msg + "\n") sys.exit(1) + def prompt(prompt_text): """ Prompt the user to choose one of the choices @@ -191,21 +198,25 @@ def prompt(prompt_text): if response in choices: return response + # We need different encoding/decoding strategies for text data being passed # around in pipes depending on python version if bytes is not str: # For python3, always encode and decode as appropriate def decode_text_stream(s): return s.decode() if isinstance(s, bytes) else s + def encode_text_stream(s): return s.encode() if isinstance(s, str) else s else: # For python2.7, pass read strings as-is, but also allow writing unicode def decode_text_stream(s): return s + def encode_text_stream(s): return s.encode('utf_8') if isinstance(s, unicode) else s + def decode_path(path): """Decode a given string (bytes or otherwise) using configured path encoding options """ @@ -221,6 +232,7 @@ def decode_path(path): print('Path with non-ASCII characters detected. Used {} to decode: {}'.format(encoding, path)) return path + def run_git_hook(cmd, param=[]): """Execute a hook if the hook exists.""" if verbose: @@ -256,6 +268,7 @@ def run_git_hook(cmd, param=[]): return run_hook_command(hook_file, param) == 0 + def run_hook_command(cmd, param): """Executes a git hook command cmd = the command line file to be executed. This can be @@ -302,12 +315,14 @@ def write_pipe(c, stdin): return val + def p4_write_pipe(c, stdin): real_cmd = p4_build_cmd(c) if bytes is not str and isinstance(stdin, str): stdin = encode_text_stream(stdin) return write_pipe(real_cmd, stdin) + def read_pipe_full(c): """ Read output from command. Returns a tuple of the return status, stdout text and stderr @@ -321,6 +336,7 @@ def read_pipe_full(c): (out, err) = p.communicate() return (p.returncode, out, decode_text_stream(err)) + def read_pipe(c, ignore_error=False, raw=False): """ Read output from command. Returns the output text on success. On failure, terminates execution, unless @@ -338,6 +354,7 @@ def read_pipe(c, ignore_error=False, raw=False): out = decode_text_stream(out) return out + def read_pipe_text(c): """ Read output from a command with trailing whitespace stripped. On error, returns None. @@ -348,10 +365,12 @@ def read_pipe_text(c): else: return decode_text_stream(out).rstrip() + def p4_read_pipe(c, ignore_error=False, raw=False): real_cmd = p4_build_cmd(c) return read_pipe(real_cmd, ignore_error, raw=raw) + def read_pipe_lines(c, raw=False): if verbose: sys.stderr.write('Reading pipe: %s\n' % str(c)) @@ -366,11 +385,13 @@ def read_pipe_lines(c, raw=False): die('Command failed: %s' % str(c)) return lines + def p4_read_pipe_lines(c): """Specifically invoke p4 on the command supplied. """ real_cmd = p4_build_cmd(c) return read_pipe_lines(real_cmd) + def p4_has_command(cmd): """Ask p4 for help on this command. If it returns an error, the command does not exist in this version of p4.""" @@ -380,6 +401,7 @@ def p4_has_command(cmd): p.communicate() return p.returncode == 0 + def p4_has_move_command(): """See if the move command exists, that it supports -k, and that it has not been administratively disabled. The arguments @@ -400,6 +422,7 @@ def p4_has_move_command(): # assume it failed because @... was invalid changelist return True + def system(cmd, ignore_error=False): expand = not isinstance(cmd, list) if verbose: @@ -410,6 +433,7 @@ def system(cmd, ignore_error=False): return retcode + def p4_system(cmd): """Specifically invoke p4 as the system command. """ real_cmd = p4_build_cmd(cmd) @@ -418,9 +442,11 @@ def p4_system(cmd): if retcode: raise CalledProcessError(retcode, real_cmd) + def die_bad_access(s): die("failure accessing depot: {0}".format(s.rstrip())) + def p4_check_access(min_expiration=1): """ Check if we can access Perforce - account still logged in """ @@ -466,7 +492,10 @@ def p4_check_access(min_expiration=1): else: die_bad_access("unknown error code {0}".format(code)) + _p4_version_string = None + + def p4_version_string(): """Read the version string, showing just the last line, which hopefully is the interesting version bit. @@ -482,12 +511,15 @@ def p4_version_string(): _p4_version_string = a[-1].rstrip() return _p4_version_string + def p4_integrate(src, dest): p4_system(["integrate", "-Dt", wildcard_encode(src), wildcard_encode(dest)]) + def p4_sync(f, *options): p4_system(["sync"] + list(options) + [wildcard_encode(f)]) + def p4_add(f): # forcibly add file names with wildcards if wildcard_present(f): @@ -495,29 +527,37 @@ def p4_add(f): else: p4_system(["add", f]) + def p4_delete(f): p4_system(["delete", wildcard_encode(f)]) + def p4_edit(f, *options): p4_system(["edit"] + list(options) + [wildcard_encode(f)]) + def p4_revert(f): p4_system(["revert", wildcard_encode(f)]) + def p4_reopen(type, f): p4_system(["reopen", "-t", type, wildcard_encode(f)]) + def p4_reopen_in_change(changelist, files): cmd = ["reopen", "-c", str(changelist)] + files p4_system(cmd) + def p4_move(src, dest): p4_system(["move", "-k", wildcard_encode(src), wildcard_encode(dest)]) + def p4_last_change(): results = p4CmdList(["changes", "-m", "1"], skip_info=True) return int(results[0]['change']) + def p4_describe(change, shelved=False): """Make sure it returns a valid result by checking for the presence of field "time". Return a dict of the @@ -546,6 +586,7 @@ def p4_describe(change, shelved=False): return d + # # Canonicalize the p4 type and return a tuple of the # base type, plus any modifiers. See "p4 help filetypes" @@ -581,6 +622,7 @@ def split_p4_type(p4type): mods = s[1] return (base, mods) + # # return the raw p4 type of a file (text, text+ko, etc) # @@ -588,6 +630,7 @@ def p4_type(f): results = p4CmdList(["fstat", "-T", "headType", wildcard_encode(f)]) return results[0]['headType'] + # # Given a type base and modifier, return a regexp matching # the keywords that can be expanded in the file @@ -603,6 +646,7 @@ def p4_keywords_regexp_for_type(base, type_mods): else: return None + # # Given a file, return a regexp matching the possible # RCS keywords that will be expanded, or None for files @@ -615,6 +659,7 @@ def p4_keywords_regexp_for_file(file): (type_base, type_mods) = split_p4_type(p4_type(file)) return p4_keywords_regexp_for_type(type_base, type_mods) + def setP4ExecBit(file, mode): # Reopens an already open file and changes the execute bit to match # the execute bit setting in the passed in mode. @@ -630,6 +675,7 @@ def setP4ExecBit(file, mode): p4_reopen(p4Type, file) + def getP4OpenedType(file): # Returns the perforce file type for the given file. @@ -640,6 +686,7 @@ def getP4OpenedType(file): else: die("Could not determine file type for %s (result: '%s')" % (file, result)) + # Return the set of all p4 labels def getP4Labels(depotPaths): labels = set() @@ -652,6 +699,7 @@ def getP4Labels(depotPaths): return labels + # Return the set of all git tags def getGitTags(): gitTags = set() @@ -660,8 +708,10 @@ def getGitTags(): gitTags.add(tag) return gitTags + _diff_tree_pattern = None + def parseDiffTreeEntry(entry): """Parses a single diff tree entry into its component elements. @@ -699,41 +749,52 @@ def parseDiffTreeEntry(entry): } return None + def isModeExec(mode): # Returns True if the given git mode represents an executable file, # otherwise False. return mode[-3:] == "755" + class P4Exception(Exception): """ Base class for exceptions from the p4 client """ + def __init__(self, exit_code): self.p4ExitCode = exit_code + class P4ServerException(P4Exception): """ Base class for exceptions where we get some kind of marshalled up result from the server """ + def __init__(self, exit_code, p4_result): super(P4ServerException, self).__init__(exit_code) self.p4_result = p4_result self.code = p4_result[0]['code'] self.data = p4_result[0]['data'] + class P4RequestSizeException(P4ServerException): """ One of the maxresults or maxscanrows errors """ + def __init__(self, exit_code, p4_result, limit): super(P4RequestSizeException, self).__init__(exit_code, p4_result) self.limit = limit + class P4CommandException(P4Exception): """ Something went wrong calling p4 which means we have to give up """ + def __init__(self, msg): self.msg = msg def __str__(self): return self.msg + def isModeExecChanged(src_mode, dst_mode): return isModeExec(src_mode) != isModeExec(dst_mode) + def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False, errors_as_exceptions=False): @@ -819,6 +880,7 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False, return result + def p4Cmd(cmd): list = p4CmdList(cmd) result = {} @@ -826,6 +888,7 @@ def p4Cmd(cmd): result.update(entry) return result; + def p4Where(depotPath): if not depotPath.endswith("/"): depotPath += "/" @@ -862,20 +925,25 @@ def p4Where(depotPath): clientPath = clientPath[:-3] return clientPath + def currentGitBranch(): return read_pipe_text(["git", "symbolic-ref", "--short", "-q", "HEAD"]) + def isValidGitDir(path): return git_dir(path) != None + def parseRevision(ref): return read_pipe("git rev-parse %s" % ref).strip() + def branchExists(ref): rev = read_pipe(["git", "rev-parse", "-q", "--verify", ref], ignore_error=True) return len(rev) > 0 + def extractLogMessageFromGitCommit(commit): logMessage = "" @@ -890,6 +958,7 @@ def extractLogMessageFromGitCommit(commit): logMessage += log return logMessage + def extractSettingsGitLog(log): values = {} for line in log.split("\n"): @@ -915,19 +984,24 @@ def extractSettingsGitLog(log): values['depot-paths'] = paths.split(',') return values + def gitBranchExists(branch): proc = subprocess.Popen(["git", "rev-parse", branch], stderr=subprocess.PIPE, stdout=subprocess.PIPE); return proc.wait() == 0; + def gitUpdateRef(ref, newvalue): subprocess.check_call(["git", "update-ref", ref, newvalue]) + def gitDeleteRef(ref): subprocess.check_call(["git", "update-ref", "-d", ref]) + _gitConfig = {} + def gitConfig(key, typeSpecifier=None): if key not in _gitConfig: cmd = [ "git", "config" ] @@ -938,6 +1012,7 @@ def gitConfig(key, typeSpecifier=None): _gitConfig[key] = s.strip() return _gitConfig[key] + def gitConfigBool(key): """Return a bool, using git config --bool. It is True only if the variable is set to true, and False if set to false or not present @@ -947,6 +1022,7 @@ def gitConfigBool(key): _gitConfig[key] = gitConfig(key, '--bool') == "true" return _gitConfig[key] + def gitConfigInt(key): if key not in _gitConfig: cmd = [ "git", "config", "--int", key ] @@ -958,6 +1034,7 @@ def gitConfigInt(key): _gitConfig[key] = None return _gitConfig[key] + def gitConfigList(key): if key not in _gitConfig: s = read_pipe(["git", "config", "--get-all", key], ignore_error=True) @@ -966,6 +1043,7 @@ def gitConfigList(key): _gitConfig[key] = [] return _gitConfig[key] + def p4BranchesInGit(branchesAreInRemotes=True): """Find all the branches whose names start with "p4/", looking in remotes or heads as specified by the argument. Return @@ -998,6 +1076,7 @@ def p4BranchesInGit(branchesAreInRemotes=True): return branches + def branch_exists(branch): """Make sure that the given ref name really exists.""" @@ -1010,6 +1089,7 @@ def branch_exists(branch): # expect exactly one line of output: the branch name return out.rstrip() == branch + def findUpstreamBranchPoint(head = "HEAD"): branches = p4BranchesInGit() # map from depot-path to branch name @@ -1037,6 +1117,7 @@ def findUpstreamBranchPoint(head = "HEAD"): return ["", settings] + def createOrUpdateBranchesFromOrigin(localRefPrefix = "refs/remotes/p4/", silent=True): if not silent: print("Creating/updating branch(es) in %s based on origin branch(es)" @@ -1084,6 +1165,7 @@ def createOrUpdateBranchesFromOrigin(localRefPrefix = "refs/remotes/p4/", silent if update: system("git update-ref %s %s" % (remoteHead, originHead)) + def originP4BranchesExist(): return gitBranchExists("origin") or gitBranchExists("origin/p4") or gitBranchExists("origin/p4/master") @@ -1097,12 +1179,14 @@ def p4ParseNumericChangeRange(parts): return (changeStart, changeEnd) + def chooseBlockSize(blockSize): if blockSize: return blockSize else: return defaultBlockSize + def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize): assert depotPaths @@ -1180,6 +1264,7 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize): changes = sorted(changes) return changes + def p4PathStartsWith(path, prefix): # This method tries to remedy a potential mixed-case issue: # @@ -1192,6 +1277,7 @@ def p4PathStartsWith(path, prefix): return path.lower().startswith(prefix.lower()) return path.startswith(prefix) + def getClientSpec(): """Look at the p4 client spec, create a View() object that contains all the mappings, and return it.""" @@ -1222,6 +1308,7 @@ def getClientSpec(): return view + def getClientRoot(): """Grab the client directory.""" @@ -1235,6 +1322,7 @@ def getClientRoot(): return entry["Root"] + # # P4 wildcards are not allowed in filenames. P4 complains # if you simply add them, but you can force it with "-f", in @@ -1252,6 +1340,7 @@ def wildcard_decode(path): .replace("%25", "%") return path + def wildcard_encode(path): # do % first to avoid double-encoding the %s introduced here path = path.replace("%", "%25") \ @@ -1260,10 +1349,12 @@ def wildcard_encode(path): .replace("@", "%40") return path + def wildcard_present(path): m = re.search("[*#@%]", path) return m is not None + class LargeFileSystem(object): """Base class for large file system support.""" @@ -1345,6 +1436,7 @@ def processContent(self, git_mode, relPath, contents): sys.stderr.write("%s moved to large file system (%s)\n" % (relPath, localLargeFile)) return (git_mode, contents) + class MockLFS(LargeFileSystem): """Mock large file system for testing.""" @@ -1368,6 +1460,7 @@ def pushFile(self, localLargeFile): os.makedirs(remotePath) shutil.copyfile(localLargeFile, os.path.join(remotePath, os.path.basename(localLargeFile))) + class GitLFS(LargeFileSystem): """Git LFS as backend for the git-p4 large file system. See https://git-lfs.github.com/ for details.""" @@ -1456,6 +1549,7 @@ def processContent(self, git_mode, relPath, contents): else: return LargeFileSystem.processContent(self, git_mode, relPath, contents) + class Command: delete_actions = ( "delete", "move/delete", "purge" ) add_actions = ( "add", "branch", "move/add" ) @@ -1471,6 +1565,7 @@ def ensure_value(self, attr, value): setattr(self, attr, value) return getattr(self, attr) + class P4UserMap: def __init__(self): self.userMapFromPerforceServer = False @@ -1541,6 +1636,7 @@ def loadUserMapFromCache(self): except IOError: self.getUserMapFromPerforceServer() + class P4Submit(Command, P4UserMap): conflict_behavior_choices = ("ask", "skip", "quit") @@ -2545,6 +2641,7 @@ def run(self, args): return True + class View(object): """Represent a p4 view ("p4 help views"), and map files in a repo according to the view.""" @@ -2652,11 +2749,13 @@ def map_in_client(self, depot_path): die( "Error: %s is not found in client spec path" % depot_path ) return "" + def cloneExcludeCallback(option, opt_str, value, parser): # prepend "/" because the first "/" was consumed as part of the option itself. # ("-//depot/A/..." becomes "/depot/A/..." after option parsing) parser.values.cloneExclude += ["/" + re.sub(r"\.\.\.$", "", value)] + class P4Sync(Command, P4UserMap): def __init__(self): @@ -2885,7 +2984,6 @@ def encodeWithUTF8(self, path): # output one file from the P4 stream # - helper for streamP4Files - def streamOneP4File(self, file, contents): file_path = file['depotFile'] relPath = self.stripRepoPath(decode_path(file_path), self.branchPrefixes) @@ -3692,7 +3790,6 @@ def importHeadRevision(self, revision): print("IO error details: {}".format(err)) print(self.gitError.read()) - def importRevisions(self, args, branch_arg_given): changes = [] @@ -4016,6 +4113,7 @@ def run(self, args): return True + class P4Rebase(Command): def __init__(self): Command.__init__(self) @@ -4052,6 +4150,7 @@ def rebase(self): system("git diff-tree --stat --summary -M %s HEAD --" % oldHead) return True + class P4Clone(P4Sync): def __init__(self): P4Sync.__init__(self) @@ -4130,6 +4229,7 @@ def run(self, args): return True + class P4Unshelve(Command): def __init__(self): Command.__init__(self) @@ -4245,6 +4345,7 @@ def run(self, args): return True + class P4Branches(Command): def __init__(self): Command.__init__(self) @@ -4273,6 +4374,7 @@ def run(self, args): print("%s <= %s (%s)" % (branch, ",".join(settings["depot-paths"]), settings["change"])) return True + class HelpFormatter(optparse.IndentedHelpFormatter): def __init__(self): optparse.IndentedHelpFormatter.__init__(self) @@ -4283,6 +4385,7 @@ def format_description(self, description): else: return "" + def printUsage(commands): print("usage: %s [options]" % sys.argv[0]) print("") @@ -4291,6 +4394,7 @@ def printUsage(commands): print("Try %s --help for command specific help." % sys.argv[0]) print("") + commands = { "submit" : P4Submit, "commit" : P4Submit, @@ -4301,6 +4405,7 @@ def printUsage(commands): "unshelve" : P4Unshelve, } + def main(): if len(sys.argv[1:]) == 0: printUsage(commands.keys()) From patchwork Wed Jan 12 13:46:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D10E3C433EF for ; Wed, 12 Jan 2022 13:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353709AbiALNra (ORCPT ); Wed, 12 Jan 2022 08:47:30 -0500 Received: from mail-dm6nam11on2052.outbound.protection.outlook.com ([40.107.223.52]:31597 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353685AbiALNrQ (ORCPT ); Wed, 12 Jan 2022 08:47:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OyPep8xmB5oxZyPu7jvrhLLgUthUNO7zTklQBTJMZHFyyiwBid8rm4yAuKmYemjrCffFkuVo6UAKqRGz+15JQ8LYYHJD9irUg8OwS9qLhZ63oJ8fC/HwOSMV0hwvxwkr7CFDUjqGg3BmhoIbju5TNKLf+oiI/XjrS6X+aBju35jTIGfpFBIeKYAX+qfOAd09BZgYLRfPUeYWjSbAsdNwDsb3nRkXfpQMdeO4AF/YUJhlMhheSpb6a1JONm/rQ7+RMd/5Lui3LoTxpjVWjPpl8PaHJ6KLJj8DPR/VOJHhYfxYRU4sIPN88vlTk4WNIavdwC/tnCZbk98C4qObv6pZPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2lQghhGYCPz6fsvShaLJRBzHARDeG4vx4suYKkcgrqk=; b=PAbffzrWU0kVHR0zLrKYijjJxs7gYLk0Wqf9t6y1Wo+FTX5O2v/yjsCn/TIN+s7FA01+QlltbHrxpEQjiCxl3NsQZmBzcE/H65pxvf/A7HZECuwfvqzYvzjSCzOEx8HANTBI3Id4K4lCpFTkKNixkC/gjX7WSrcSA1nCn3nYgZGrbE+kW5O0jkjnz9wOqZH6WSD59ag+iluivgOVHGQqZeXTXmW0HmdJjWX10qO3k0WCaccHdG1FBnhYkgs9TWtZS0+8xJ8Pc9MZTmXozVnP5sR1wg/UL1w+WkoXVq83ZJNeAAWQ2Gm/Weh5JXuhiY1QCb454PCcWteoYwzlvbO12A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2lQghhGYCPz6fsvShaLJRBzHARDeG4vx4suYKkcgrqk=; b=a2E42ZuuXwG5sFk8xSY8y8MACEvPRRtYCWblnp0bA8H2klzBc4PZOuu8ogia+P3qb1EEmxO05vuqwrMEaPGIe/azdk9XQyiomEcis41cIGJ8Q2KnxudU3RUIOowb0rCvfuJqVNW1lHqodTrFZVJO8GUSH/53w/aA34tdDsgMvrxNhqQT3CFmPzOxWEb7U5B4rRBvoB8vK8WlP+7er7KF4+lABzWojONa1EshjHqqdJAti0KpiJPpDigOOPaM/ONko7ECdnuBxogeZYphgNdTJnzODDnqpK/ROxKV+NzEWvEtn75VRhJY5effkl85cSA14/aQoV9sx00ZneExs0Wu9Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by CH2PR12MB4136.namprd12.prod.outlook.com (2603:10b6:610:a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Wed, 12 Jan 2022 13:47:12 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:12 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 02/20] git-p4: remove unneeded semicolons from statements Date: Wed, 12 Jan 2022 13:46:17 +0000 Message-Id: <20220112134635.177877-3-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 117fef4a-8564-4432-1358-08d9d5d20914 X-MS-TrafficTypeDiagnostic: CH2PR12MB4136:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1091; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vMCAWS9E7bpSgVE47d8h56YfkWeTu1yZkOJ62X8359rxgTii2Ul9cIC0oWTr1A5UM/KFg28QfNoYx6OWAEYmrY8RYrGY02ReXW7+nUpIoxwT6HXc5Xv6VIWEXGNMAcR9Y9/aaH5uaiHtUyYXvSQYHUSLoN2LDFLNsQF16J2Uxv2IJTGg3vHTiP9Exp+lM43R5w/YSlerZ2qr/oK4hq0WCoyPyfUtbdncCplXyBmT+vW4CPbjl7INjgh0BafJtehpYczHIWGH6PZGMJ+oqlsfPjLcTnEEB7gQzIzNE/mEFkAQUH9YLUnhuQdndaur/h3YuMz52P7+kIkmGpDHJFuNzKErQSbBMCi91pwWJ2uoU2gQ8ABCZyB1ywsn7KHJOnEsRui9NwB6d/XOxaUAnw54mlq0sNEPyU2sY+PV9+emZq3AdPHpNUxh4obUbuPlwyHKnvhqAFJtgGlWBJPjnIjogjz7+kvwOTc+G3jKZ7XgzsJ9mG6CAz8HXPo8wdlTqsDi1FMXtcrenvIx6yO7tiM0jaeF7l2xYa9WOUDYeEB+dxJYE5V/VKWkS38lWsXuvSEA7EiS30hUA6jiHCAjcovuZWUWSxkVpQXXdIT4umV5GF1NO2JW76XsmodR6ZMJmCvnX5L5Pp9HfprZIDxPIQMzyiugO19G44PQ1QSSgYNJh5spVtZNp34SyQ7leXtK/7euJCP8VPwl1bKRFPCLm08CCQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(508600001)(26005)(110136005)(8676002)(6486002)(2616005)(38100700002)(86362001)(7416002)(36756003)(54906003)(5660300002)(8936002)(6512007)(4326008)(52116002)(2906002)(1076003)(66476007)(6506007)(66556008)(186003)(38350700002)(316002)(107886003)(83380400001)(66946007)(55236004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pAhnsXHir0JH2douOnsfWU2so7bnq3vGhI49AytJB2Hf0ncg9qkBRO2HhY5thnCeb3IIXRSevBJdh3NnrDrnEptrPHa7d9hVV4htutlZzx525uYlTXKH3tTNrvw70vzsB0HqcPDut9KGvuBFsthhXdBpwx6EQ7v3lew6O6cQo5BUAR0cpLjn5PEyZaCMQ5TVH3yKfYwG2o+BtYN0ATnmbBZ3U4ZOY1yq1inBGYY1lSVR/2VYC3th2q46MDu16hTLxXTke+pFITW6Zh5WXIGyS2buJe/Dpv6t6iOAkAXSh905I7STjLgMqT+XvwkwBuZ7wmqKufSv7gSIibASrjQSCz1hBH9NK0NVOoUBXxaQUtqaS6fiCrKHgz0CYflG9Z2288iWtu5vJ3PTubJGbK76huZ3oWUbEE8z4mupkS03DoQS1QWTyb/6XVEctDg4euJvjE/VEPp6tEOdOJSMU/K/FEbvkfUGRNEId44fJH6MDZpKS1Gw/mNpnfPwKzf3bk7XV3KogZlr8xyG8usEdZ3XkuXKMf9CL7NaaGcqAKUZvDIEgxZQ8tt46/Kx8xyeg7371C+40BglC4tITYH8uWQqksJzUN+AUNGQULUhTmmbP/Ckmdu2ZEPuk0MLt94dNcBXl9F2EFN9oDRFMR8pRq/ugg5LPNgJLhU0LOgEUbaI7sI4HvD57F3PE6U0Myl7hCOVI6ks2FzUk8Zj077dD3kzBRwUr5Q+6/m3Fb9yPStnVij9wjU6xZaqYBNNyRs2IIwwe0C5RU7ec8aBhdb6zkC3TnlCt9FwxK0rc0IAq/gts5rPZaf/8TMWYsofHO6EhlMvEeEUHRVzUB8qmiBgRlytv7NCjUGfC6n+29zz7qCUZsgWN36LfdNhrmsvA2qOeROY3ZeUKYH3RfVl36q8fAFd368jDheYkVQhbm3OgF43aw8yRH4LyWORBPtc0WyguG4g2cXQY0RtVh4NRa4XcHdLn8qK3DTd4UbbunIWh3l6XKE0pOw8edEoLlpRr0+/PRaiKKDIivJ8wf0XWEDku1CD8Os2MQaQrfQFE3tcZM2a90nCrbedP34OYM3N463Cu3DpWz5P7yj61vDKr423yAR1FP7NAvgRfFndUjAplWuprUpWZ67Vn4BKreOujZdP/FEs/Xwn2qCh4Hf1oJr8ZjOnOqyg8Kkj1zKqefwKme5R9iZmitNYQ2DOmtzKCoEzrrqzemkqbEJjy4LjJi5Xtj147dwaxOTWYnrWxr7gc5PVsDFzDXTQ8bPXRgI2oZvFRijjAV0bpRw92dJfyYfsXXl3qM62wGop9MVZ10xVeS5En6gluKI6ke0zZInmleHw/6qT96nIIcB81zbF51sFezZ2JHz4xHxmrvmOeZGQoH7Dt2xfpp0a+J0w24YdKZUWAMmgBD1PTl4qwUyKKHB6N0p435s6rWFzr7a6y30PdpbA+wPuo/VUWp9/G6kNMYQ7jU0UQQmVvo7oUwK9fXm0w/aznDyOsSwUwgUPsm2YrmOt9jfULtG/BmbmfgkY8GKS5K8+RX247BZu5ZP7rFyMGv2ZL1QiMsheWKmxS6R4fqqMG39sAs2B/yalXuj9vvhnvpIo/IBpTPlexQbw05Llmt0r/kDLqrciD7Jsm0EtCbo/NAE= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 117fef4a-8564-4432-1358-08d9d5d20914 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:12.3825 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6Pc7QyLWK8ANQ7KNX+V+Yujz2by9UbcHPZQjbGhGH7eB5tW0NUYkwCMMIjEr8Gjvi8PKdPyj4N6QrHTbdWMnaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4136 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Python allows the usage of compound statements where multiple statements are written on a single line separared by semicolons. It is also possible to add a semicolon after a single statement, however this is generally considered to be untidy, and is unnecessary. Signed-off-by: Joel Holdsworth --- git-p4.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/git-p4.py b/git-p4.py index e6cc0f18a7..cdf64df2b5 100755 --- a/git-p4.py +++ b/git-p4.py @@ -886,7 +886,7 @@ def p4Cmd(cmd): result = {} for entry in list: result.update(entry) - return result; + return result def p4Where(depotPath): @@ -987,8 +987,8 @@ def extractSettingsGitLog(log): def gitBranchExists(branch): proc = subprocess.Popen(["git", "rev-parse", branch], - stderr=subprocess.PIPE, stdout=subprocess.PIPE); - return proc.wait() == 0; + stderr=subprocess.PIPE, stdout=subprocess.PIPE) + return proc.wait() == 0 def gitUpdateRef(ref, newvalue): @@ -3603,8 +3603,8 @@ def gitCommitByP4Change(self, ref, change): def importNewBranch(self, branch, maxChange): # make fast-import flush all changes to disk and update the refs using the checkpoint # command so that we can try to find the branch parent in the git history - self.gitStream.write("checkpoint\n\n"); - self.gitStream.flush(); + self.gitStream.write("checkpoint\n\n") + self.gitStream.flush() branchPrefix = self.depotPaths[0] + branch + "/" range = "@1,%s" % maxChange #print "prefix" + branchPrefix @@ -3680,12 +3680,12 @@ def importChanges(self, changes, origin_revision=0): fullBranch = self.projectName + branch if fullBranch not in self.p4BranchesInGit: if not self.silent: - print("\n Importing new branch %s" % fullBranch); + print("\n Importing new branch %s" % fullBranch) if self.importNewBranch(branch, change - 1): parent = "" self.p4BranchesInGit.append(fullBranch) if not self.silent: - print("\n Resuming with change %s" % change); + print("\n Resuming with change %s" % change) if self.verbose: print("parent determined through known branches: %s" % parent) @@ -3753,7 +3753,7 @@ def importHeadRevision(self, revision): % info['data']) if info['data'].find("must refer to client") >= 0: sys.stderr.write("This particular p4 error is misleading.\n") - sys.stderr.write("Perhaps the depot path was misspelled.\n"); + sys.stderr.write("Perhaps the depot path was misspelled.\n") sys.stderr.write("Depot path: %s\n" % " ".join(self.depotPaths)) sys.exit(1) if 'p4ExitCode' in info: @@ -3861,7 +3861,7 @@ def openStreams(self): self.importProcess = subprocess.Popen(["git", "fast-import"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE); + stderr=subprocess.PIPE) self.gitOutput = self.importProcess.stdout self.gitStream = self.importProcess.stdin self.gitError = self.importProcess.stderr @@ -4047,7 +4047,7 @@ def run(self, args): self.loadUserMapFromCache() self.labels = {} if self.detectLabels: - self.getLabels(); + self.getLabels() if self.detectBranches: ## FIXME - what's a P4 projectName ? @@ -4133,9 +4133,9 @@ def run(self, args): def rebase(self): if os.system("git update-index --refresh") != 0: - die("Some files in your working directory are modified and different than what is in your index. You can use git update-index to bring the index up to date or stash away all your changes with git stash."); + die("Some files in your working directory are modified and different than what is in your index. You can use git update-index to bring the index up to date or stash away all your changes with git stash.") if len(read_pipe("git diff-index HEAD --")) > 0: - die("You have uncommitted changes. Please commit them before rebasing or stash them away with git stash."); + die("You have uncommitted changes. Please commit them before rebasing or stash them away with git stash.") [upstream, settings] = findUpstreamBranchPoint() if len(upstream) == 0: @@ -4436,7 +4436,7 @@ def main(): formatter = HelpFormatter()) try: - (cmd, args) = parser.parse_args(sys.argv[2:], cmd); + (cmd, args) = parser.parse_args(sys.argv[2:], cmd) except: parser.print_help() raise @@ -4452,7 +4452,7 @@ def main(): if os.path.exists(cmd.gitdir): cdup = read_pipe("git rev-parse --show-cdup").strip() if len(cdup) > 0: - chdir(cdup); + chdir(cdup) if not isValidGitDir(cmd.gitdir): if isValidGitDir(cmd.gitdir + "/.git"): From patchwork Wed Jan 12 13:46:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4803FC433EF for ; Wed, 12 Jan 2022 13:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353712AbiALNrd (ORCPT ); Wed, 12 Jan 2022 08:47:33 -0500 Received: from mail-dm6nam11on2052.outbound.protection.outlook.com ([40.107.223.52]:31597 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353692AbiALNrS (ORCPT ); Wed, 12 Jan 2022 08:47:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B+8MUr4PATMIzophLNR4rlFEDWzccJtkthG6cJxGZ1QD9ebqUKEDqwof/uLchwJ9kjqecgqoOfCGWCX8IanpK1NAX5w/rYG6yLsD4k9SQhEux+OPd0KdDhK8tmrOsrq4KD64hptUMzqpd+Q8HHxLK1pvjAjw7y9cjmhzQLZHiMon8el4m4reRg6NJ+FcNNXkE8jcXbGZnePYk2O//4hNGP1wqJWl5pVTOc1GWVO8zEMArk/i+CXTe5xC4GyTLylBp79LyQtkIlTvinyW8Kd/3vtfHffOz+1HuMdTG+bi58HURQPUNpaUPzwXvqzL/YxoDQk54BBW/1AhX5940znxPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ifBCojCXDHgbNxeNyfSOL4Sp3EosjyB1Y071Ejs4SSg=; b=O2pYeyOt1NDBjUBJD8zA3ZckQwJPVD4k1/NbupYhS7FqsnhFZH+Iw7blV53lcQhu26z4/pRgBtdymE3/2hLyhCCIAyF3B0HqRBhJr0D6Sw99ERJqRiC37cFzuWKgIbMAIjTXZCrxDyqsm5GxHltOwKk9qKOfYd0s5bjdcoyvO9sxVDXNaL30dVOpvTp9M7uaz2+fDQR+FjqybZFiiX5sygaC90XpfLKmZqjJk+xYtwKi88Y4y4GOqEdu3fzWslUxzIEJJN0n8ggu7hwAC6vr0yL0Mv/F5QBMNl0tf31NtGBaUc5/7fZONnrhJcZbaKbcq3dJVojXs4XkboEoCjqXLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ifBCojCXDHgbNxeNyfSOL4Sp3EosjyB1Y071Ejs4SSg=; b=E8GSHRnZkigpLL1iEX51FpmQjo5XVG5S7w5Z+VxRRE+1hFrdS5Q6Ctf92COXP03aze4UZg0FN3L9s5MyU5OFygNjObW4/kKaMhbfFuLyGeaQGBBG2VSXcqzkHNUqsYEa1TcvibKoD6madFcUfYpFeg3drKGL2hYxgsi2dMsXt0uSBUzUpNJuvyhYaDUwN3PEPTm9AZr/9+84JW4HHok5DYmtswlZUdzqlJ6tumAM4YcMJ3Sj4UCqvlAfMk6i/fj10qDHTbbddSwYIyVjqWmk+XgaiyPEAoTmtpDzcxw4T7s5ax98ZucCMteeqzHBKI6oVewvkQ9jsqPROhfw15cY6g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by CH2PR12MB4136.namprd12.prod.outlook.com (2603:10b6:610:a4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Wed, 12 Jan 2022 13:47:14 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:14 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 03/20] git-p4: indent with 4-spaces Date: Wed, 12 Jan 2022 13:46:18 +0000 Message-Id: <20220112134635.177877-4-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6ed987bb-3da8-49e6-b90e-08d9d5d20a53 X-MS-TrafficTypeDiagnostic: CH2PR12MB4136:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:95; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dqLbZ4K/k8X+s/uJSsXYePGp+9P00jp+KOYbK9ZM6iY6WuqzMLg+BSDNdg8qiHl11vS2JrHUYPr4RwljAMW2rO87DXJclilpV1mG6AaE9Kr5dnaaf2kCOo+vjiEYSFLxyfkSa/fKTbjvCvmBSbw/eFD9ZGU3eUVwVO54hSqvnn8klgkgwFKBWMSoQcUQG6UMkNwl61fNUhwWb9vpZeLsD4QkYpWN0CcpGM7zN1IijbDqu8XuKRDtO4ePVbToXGUFx3pZd/uitjeIa1U8Q3Nveinqlr5vI/lUp6eLzc6MpBao1q8Ht1TMTMJol3LXgikEVPxf4TeIIN0AC4NbTxT/oSyKi8LAfICKvbItl0wOJe1BynjUE2L1Z1w63wVa0+aQWJa6fEHk4lxuZLps3zSBphpkuuTHt+h5GUBbgBKaaNJD2J9EhZkv9D75TOPJwm3aHnRGmDAAIbiIwamwZEgHp17Ru+g0OZPG5/19Elcve92Ob5H/GhZbtUlnDRTJzCqRxGQtU9NK4H4VckRkWvfZ7vTtOdQ0Z2uvll770SzCSUu/YhGH4s5V9xhXHLHc4UmWZp9itf+tbDOPjAxMLR3x87iBa/jRGX+mF6whmqReyyWjgnIvXtPldSnVtbqQp6zsPBTSrKz61UU0vfMU11IL1HpNfR/ZchQt4zkepu2Uz739ZP6jKKyEjz+O2ov+RD9TfiRadnvPpXAz86uNQ9uxZ2Qzi+A6rVbHyJOvx3Lw+nQTmKosZr+LOfmYIdiNn3WrzAMFKi40XUkjZZIBbib9NWi3rRauqrXi1FsccOJ8aZo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(508600001)(966005)(26005)(110136005)(8676002)(6486002)(2616005)(38100700002)(86362001)(7416002)(36756003)(54906003)(5660300002)(8936002)(6512007)(4326008)(52116002)(2906002)(1076003)(66476007)(6506007)(66556008)(186003)(38350700002)(316002)(107886003)(83380400001)(66946007)(55236004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sBYTZlrk8sxOld0+mkK9+tCJ4cGFRpPv9HdG+3ayq7gWOIawLfA1wwGXM4f37FYiT/5uf5l23vFYYn9UI8mN7DiacuL4SFNnLsLKtQRnGdP7V+oIEfPgiqyx0VW3k42kqGrhkYR/boueNQCoZtFkihUiNZ8vKeW75Ui4ptMOGSRGulVb7BNfc/2I9mvXJA0V/q0xHPbyOJB1/k6NJMi0Q6JOTQK837J4vjMVO/COYM6mRtAERJAZzJYQUvmW3Tpk2VQYlUsNo54Sh3NkanRc4mdtAJFVqP9z3aMaugxl+QF27sMF9gDcv16qb+P2ARol0P0e5zlGvdpGt7EbgGxxajw9Xtjv4SBfw82EeLyvDPtWFLjnWnUcebC0y/ZCboXBrrVNCqJROmNuWWJ+6YBUQShlx0XeHHWxRUAT2elyFxkZMVDCAGlLDHNmNoB8phGV5rux1B8krL2mkDaa7MzSzxrQWenkhuM0gkyO/2Lc6oY6f1/I+iqbsXjf1/8tsfSubnSazF8hFQd/e9j17TEFkhqh40EPzK7BWLNy87OTJQKrKqPg/kZe3VU+uPyHnHoTufsGt/ZqRFjC0ItoQkbGtSEUTHSk+MFeXgPSA7dP1Vl5CkuUNTHPaX3JrCoyL/o53w79sSL3pbLThse1OW/NzoKc1fyB6x/12co4tow86Kuin3luAjVRumqM51XoVZqQpV7hIitkX8Oi11zRo/289VspL/39MKcN5tAHg1Zj7k+pZDaz/tdINh3DSxF1/nJfmZAdmJYbSOS9PowDgorAqUKOghCm8SezJztKCcFAaQTH0/jBxkB8wz0GRF4XJ8njoG96nWWnnxXD+0oPY0vDDZnEO3AV20zCGcnJfDJyaNofhkN9zlTJC0Zsm5i2BTNj9JAOPp0zJmaKGZwOlroqZsXB0ydpzpC7Czq406SAoijQY1ohISmKBVII0PVLg7fI1ixRBQFNktF+0cdX+Oe1LUfXiZWU9W4FhkwAsvT9pcwG8oc6O33W/MRThJ9RR3qJdV7u+9TP7//SBaWo0uEkj1/LfiMwfn9M2GcCANlKPGTDOsI2ntD/JfUNXKCaxfmqduGiC6/kzrI5/u7CwexNzX3b+u30HRggszpzZ06caSZ7n6OpZuKl4RgFBmSmjE2QfMVtw5guGDV2KiGyvlqIyJ2l8zUoEgO6OFcm9177xryHGzNPBsUJFB01dd5exblaTK7wJkuoqDbw6+HvtjtbFodhveHU0pWj+uwiAH98llXAr+hGEVSyuYKV+2IjdXTkYx/zXHplJ4CopwFK5pvVm0UYgewKdCZf+2Do0RbIJh/L4VJZcInh+/IrvV+wZ6Ia+rdlH5loTIAgzU8Pco4y49zHttfffHYQcUfiI+Dq1C3rU/S3d58MIIlAjmmk3oqC+VtBJtqU36fYwKhpSGHH7xEpNH1uCnf8WUJDoQhW3dFqqNy16R/qc4UYycQ2hnKEuJyl0BsdxNplzbnFmqCvcLvLd5YTlek9QPkjUlXQxu6oWLKIt61YzUXOLwjccumLdlDZGAzwh8Yns3aLYiy8sNEiAAKPHM40lDn6zrm7WCqaIGeq2+iMR9Li9qeZ11UfzUZ1W5KvPIskV0yuIrGq2jJs35tB4q8AamvoTywY8Y8= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ed987bb-3da8-49e6-b90e-08d9d5d20a53 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:14.4305 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: K9BR4gGtfs6Ym1fHplf5U+iLO/lG9jpZbZ0n1ZzxzPh6z9VbjQX+fxbzZoeQDMY+NFJ8XP+lIfYk+JyQNLSvgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4136 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that all code should be indented in 4-space units. This guideline is described here: https://www.python.org/dev/peps/pep-0008/#indentation Previously git-p4 had multiple cases where code was indented with a non-multiple of 4-spaces. This patch fixes each of these. Signed-off-by: Joel Holdsworth --- git-p4.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/git-p4.py b/git-p4.py index cdf64df2b5..5fb3e09875 100755 --- a/git-p4.py +++ b/git-p4.py @@ -950,12 +950,12 @@ def extractLogMessageFromGitCommit(commit): ## fixme: title is first line of commit, not 1st paragraph. foundTitle = False for log in read_pipe_lines(["git", "cat-file", "commit", commit]): - if not foundTitle: - if len(log) == 1: - foundTitle = True - continue + if not foundTitle: + if len(log) == 1: + foundTitle = True + continue - logMessage += log + logMessage += log return logMessage @@ -1167,7 +1167,7 @@ def createOrUpdateBranchesFromOrigin(localRefPrefix = "refs/remotes/p4/", silent def originP4BranchesExist(): - return gitBranchExists("origin") or gitBranchExists("origin/p4") or gitBranchExists("origin/p4/master") + return gitBranchExists("origin") or gitBranchExists("origin/p4") or gitBranchExists("origin/p4/master") def p4ParseNumericChangeRange(parts): @@ -2188,7 +2188,7 @@ def applyCommit(self, id): submitTemplate = self.prepareLogMessage(template, logMessage, jobs) if self.preserveUser: - submitTemplate += "\n######## Actual user %s, modified after commit\n" % p4User + submitTemplate += "\n######## Actual user %s, modified after commit\n" % p4User if self.checkAuthorship and not self.p4UserIsMe(p4User): submitTemplate += "######## git author %s does not match your p4 account.\n" % gitEmail @@ -2637,7 +2637,7 @@ def run(self, args): # exit with error unless everything applied perfectly if len(commits) != len(applied): - sys.exit(1) + sys.exit(1) return True @@ -3472,7 +3472,7 @@ def guessProjectName(self): p = p[:-1] p = p[p.strip().rfind("/") + 1:] if not p.endswith("/"): - p += "/" + p += "/" return p def getBranchMapping(self): From patchwork Wed Jan 12 13:46:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCF50C433F5 for ; Wed, 12 Jan 2022 13:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353721AbiALNrj (ORCPT ); Wed, 12 Jan 2022 08:47:39 -0500 Received: from mail-dm6nam12on2054.outbound.protection.outlook.com ([40.107.243.54]:16488 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353691AbiALNrS (ORCPT ); Wed, 12 Jan 2022 08:47:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UlLXPeE3o/gl5x8I1sT0VJ16akE59bVEDUTj5boUujJXY1jJOZ27yZImNM91u2rVFSyK6C1VEZhniUy0fBYhAxi8psaIRKBf/wA9UgSoyXqCYxIPs3pC0DA7hl/dEPw8sXFoZACmQVnSTF621nqMeTb2ruDcg3k1uupV99nTzYWy/OmcOp+KJQcHfEE4ComZPb/MkNzgelB7tkS70bvdogpnhrlEfhiGzL8qAHSk6NzejcfkQh6hIWWGHUwvSNfBHHDfp1eKw83kdxZoBy6LssbkzSsoMCtBFzL+ZzoIrCfpVd0uJ5Y4mlNKZsahvsljdUtN5O1sKflvPPuEFeVl4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+mMYjSyquxfF8XWiPNx7fnSquZ/zjOy0cQGD7voEykU=; b=CTQZY59OzGa/NNVND5AbjWi9YOkJ4quv8mDXQnJdnpM0BUH+lurC5e6J+R0LKCzkuU7kp2MUiqgnPj2p96JYKaTRAn0gooi9vyAkt3wAZYCPqws/nfI+XYJLIdT++XL63nUAnQRG5HG2GN0A9vwgFHObsYO8lX+9twQdlzyCIioWFL5+uYXA4rw1WFpYd2rJGX/XIAftE3lBks/zuDbE9+ddKBUlGRSDG2dlo/qRXqdt3M2W92Axdivcz/jX1MFKcmuW01+2d9HfNk5CrlBZ2iBTdU5a0Bh+Fvj2WHJ86VJAXXQERlrnnlEBdZ4AJfqEvvh66NaWPwadvnxhwMUBJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+mMYjSyquxfF8XWiPNx7fnSquZ/zjOy0cQGD7voEykU=; b=dmppT0FJ6zzvhie0FISmz+FUVwSHpMFuMEcHpSzqu3vRr91Ww7wA5GKg8horZkSH0Cmmouvrcz+68jNRnPP7l5gRJuBKcmWbaajsaAKWPO3KKqhZq6CowM021qHluOml+SRDT+mNK/I4g8ngmgNYm3Ro+MMWRGavDZjSRDIJxWb1ZAJaKqKOCitaA39t8OrBz31A4gJccFQkAltByHlWqdR3sozOjgRjnNXblPeFf0QFK3AvnKLSMOBZ7WFXaKqm2I7E40wLGyePgH82sCmLre5JjMA9dS5RVdrYf+Bt3gfAGoEAqF684Mvn5iM+/hxXy5GJmo9YG28bZiTRnhI6hw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by CH2PR12MB4279.namprd12.prod.outlook.com (2603:10b6:610:af::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7; Wed, 12 Jan 2022 13:47:16 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:16 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 04/20] git-p4: improve consistency of docstring formatting Date: Wed, 12 Jan 2022 13:46:19 +0000 Message-Id: <20220112134635.177877-5-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 31e4ae10-4257-4c5e-6c77-08d9d5d20b87 X-MS-TrafficTypeDiagnostic: CH2PR12MB4279:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:608; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JcKyqfzhymAHzStDRvtLT/s6HDcie8zFnQ4cMPxu/GFUviWnX42xu6JDLyful/X1QSuTdb7MK3coJscJg/C62qacVHlRasmoldmW2hEyZ20tUbxSeazQYo2rZCQ3iSCmv4caMzdqYDiVkWhNWyXMdXKmoFeTGM3IfE3sLq4XxS9HZ4m7K7bJ7ym6sZp2htqD1uZcKlhS6+FP562yiVF4csqWcJK77MNQAGWw2BpnHRpRB/bzv184vHd5E53RqAcEXiEyav8r6Ez+dcdJ0RHEiWa+5StF2pxfagyGn/zPlRUJ5TiY6m6gPNJMsLrRWOBAXKv0aTeoBIOxcqT7uRmhGad/EpzH6k1B3EHJggDl9H3rMHnyumn07sVlpCreRmQgfJIi74dXsPps1v3d5ATqHgJ2+HzggtP62BkVazB6OQ/tXARtx60eWTrH0a/AB01mdxz8de829wZ1K1fhgiO8rjOxpptd8a93D44ILLupp+0kkZTWE9362zvEj7i9AaFl8GMouarxYVHQWp8/ZoXVG+41lu3ZjQX8f9DPLaRJYftNZxBmGBDP8KJP1gen2Li7fPhUdd2I9201Z6I92jgM34O0X4+9HJMKkHOzPZBJcI8DzG52mkvVE8pBMnlfds6pjrbqvi9Ld8sTkM6QgjdJJtYI7u+1W+MXLmeVlTpcSvAsmoYYmcpkO2nN7c/VFJSTbQdSKhq2sXU9ZhKMuGUBtlbMjEQ4Ut24XWRONPe3uRe8tyFQa27o6j2hs/ja78Hp+NYKHt7JZ2rfZvHMJSK5YWXk+TUWdXq/tFJ46EplWoVhOLOPCn9rm24taYkmOMVa X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(30864003)(1076003)(55236004)(7416002)(4326008)(38100700002)(38350700002)(508600001)(6506007)(86362001)(54906003)(6486002)(26005)(110136005)(6512007)(186003)(8676002)(2616005)(5660300002)(66476007)(83380400001)(8936002)(2906002)(66946007)(36756003)(66556008)(966005)(107886003)(316002)(52116002)(460985005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9IXBec02ezBIBbNrHn4mixCdxxy4rAgfJS3DL6WB3LZEUh7x3rAo22eU9sAi/6hKbQ2wYiXcr1gIKO3T1nHDGOpSe/RkGdglt9YDoRu6HlWn5ZCaunsS3CCXOcb3lj/7/clqQRVegKF1NXvai5lBfjMnXhGDr6Tm4GWp2DZeNFhC3EKcRKe0SrYlqm3rN2VRvfdBfDlNByrRKqJ2+fD9h3HRJi6iC0T6xynp1PqjNzAYsepl7QsNyvjgY3UM1f0+ObAQ1nIR6eHJosdyOKQHWwIdMz+Je/iF4Ca3bThByiUtV+U2tK0ALPxHADFU9UvWWLwVd6T+fm5X3ibfq23w4jYR7aHWsXnK/+Yz5AR0+KrORyLYonk8oA+QluRvfdTf8a2v84Xj9UcRmtBo1HazTFbwCemAGktiGFgwdJEK5IhnQtBxiO3erqtCpePeLIIJBxJOEQipJSpDF0021MlDZk5rB4wxef51N7LdvGITkK5+V28teQsB1BqVkUf+r7g5OO3OmfYm0+338ln8QuP8dFRtUW9xfnghx2dMsTt2d9ojA994DlcxtqZ8rRoJzljcRLAWkYnmyTJHMU6hyJQ2f6x9Y3ybsW/QwZPjQNjOnzWPorreaJwRsk2A7N0N40FuGQgGyNpmpSWkSl+RkXm0q52YiH5CW+4irF88+gttKITwQvgyAgPhlAv861YP4DztG0VIsmHOyF6Tu8nco4MPwhHjA2tGh9Ba2QkAZt16o69BZ/Bmw4K7QxEW5IyzJC1NPa32QF3tOHybvS/ebh2tWvEhJMVpqBuJ7Zu7WYYjSK/ClSMgxtUdE7EISqGCnahdXCZ/vBzoAMcg2AnDHWn9Z/QDkk78bVePyjwl/JbVK1SubZwPJb7YHqmWU24eZ7OBrRQVSzK/gzwHMrUvI7+GQJgbXy2hxQ18iNIY9bA4+edBbQokklpcezAtZF6A3RSf6L17r3KNiL2Ms5CsiAlBp/8bYrc4BrGF1KZcaRgcfEp0fC1YzaTKEQO8bNDQBVopna4p1brID7TNcshOSqmF6dCm2Tcb0I4ucmW/azawDjKH8gGvBOS9Lq99iasWfHk2ntVVuxIqd6yClRGIWiWDGlb1/zlOAO9U74ko4YUwcAv3EqU+QqZy96GRBKmcejAfozFzrFkU1Ztb3XuKGdrSHbcgEKKlPgla3fKOPG082GqOWM+c8ZPd6nObWCYujH+/lQQSzTmSYQLCU6Jbn+qivJEHMSIdBFecPRwGbgQRNWfNig3GPC5eyhcDmKjnIJ3hKu+L+QEuNvKHiIOyLyHaH1XAaEc/oFjDPggPyaIM4hdy52npFlKp8U076+BP/7DqYQIFzbg92ewcJlO+La+ix7d4T6IrPx5oJG/6cVfx+CcoZU7p2DT4FOw8n0Ot9nrO4w19anUtc15as7+AWQblDvzvnr8nwKchv5GnHG2CKNPhEqZkqpazLbKF1k27Cai96vsxNG4T83pdiTdbzU+DV42raFYOusXdnyLntwk7ut983p9Uq2sRKXoXK5GCq5sc0IWCuG5xHfep4Zh+n9gxiIZGYXjG1BkXuiiSHcW7XbmkpM8busH07KVmJaKKQiq8/4F6RdrizrLP+0OQT1ocHu70fNT+EoNj/RByJS8grE0= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 31e4ae10-4257-4c5e-6c77-08d9d5d20b87 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:16.4627 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pnzoQZS9imZxTD5Fw2PTdEA4iYfFOR/ioxoQtAnF2eT1N02qrd2zHZHgo9tcRTOpAGrlexnVCDaOwFFTrlQaoA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4279 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This patch attempts to improve the consistency of the docstrings by making the following changes: - Rewraps all docstrings to a 79-character column limit. - Adds a full stop at the end of every docstring. - Removes any spaces after the opening triple-quotes of all docstrings. - Sets the hanging indent of multi-line docstrings to 3-spaces. - Ensures that the closing triple-quotes of multi-line docstrings are always on a new line indented by a 3-space indent. Signed-off-by: Joel Holdsworth --- git-p4.py | 309 +++++++++++++++++++++++++++++------------------------- 1 file changed, 167 insertions(+), 142 deletions(-) diff --git a/git-p4.py b/git-p4.py index 5fb3e09875..93f4ec843f 100755 --- a/git-p4.py +++ b/git-p4.py @@ -61,9 +61,9 @@ def format_size_human_readable(num): - """ Returns a number of units (typically bytes) formatted as a human-readable - string. - """ + """Returns a number of units (typically bytes) formatted as a + human-readable string. + """ if num < 1024: return '{:d} B'.format(num) for unit in ["Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"]: @@ -76,10 +76,10 @@ def format_size_human_readable(num): def p4_build_cmd(cmd): """Build a suitable p4 command line. - This consolidates building and returning a p4 command line into one - location. It means that hooking into the environment, or other configuration - can be done more easily. - """ + This consolidates building and returning a p4 command line into one + location. It means that hooking into the environment, or other + configuration can be done more easily. + """ real_cmd = ["p4"] user = gitConfig("git-p4.user") @@ -125,9 +125,9 @@ def p4_build_cmd(cmd): def git_dir(path): - """ Return TRUE if the given path is a git directory (/path/to/dir/.git). - This won't automatically add ".git" to a directory. - """ + """Return TRUE if the given path is a git directory (/path/to/dir/.git). + This won't automatically add ".git" to a directory. + """ d = read_pipe(["git", "--git-dir", path, "rev-parse", "--git-dir"], True).strip() if not d or len(d) == 0: return None @@ -136,20 +136,18 @@ def git_dir(path): def chdir(path, is_client_path=False): - """Do chdir to the given path, and set the PWD environment - variable for use by P4. It does not look at getcwd() output. - Since we're not using the shell, it is necessary to set the - PWD environment variable explicitly. - - Normally, expand the path to force it to be absolute. This - addresses the use of relative path names inside P4 settings, - e.g. P4CONFIG=.p4config. P4 does not simply open the filename - as given; it looks for .p4config using PWD. - - If is_client_path, the path was handed to us directly by p4, - and may be a symbolic link. Do not call os.getcwd() in this - case, because it will cause p4 to think that PWD is not inside - the client path. + """Do chdir to the given path, and set the PWD environment variable for use + by P4. It does not look at getcwd() output. Since we're not using the + shell, it is necessary to set the PWD environment variable explicitly. + + Normally, expand the path to force it to be absolute. This addresses + the use of relative path names inside P4 settings, e.g. + P4CONFIG=.p4config. P4 does not simply open the filename as given; it + looks for .p4config using PWD. + + If is_client_path, the path was handed to us directly by p4, and may be + a symbolic link. Do not call os.getcwd() in this case, because it will + cause p4 to think that PWD is not inside the client path. """ os.chdir(path) @@ -170,9 +168,9 @@ def calcDiskFree(): def die(msg): - """ Terminate execution. Make sure that any running child processes have been wait()ed for before - calling this. - """ + """Terminate execution. Make sure that any running child processes have + been wait()ed for before calling this. + """ if verbose: raise Exception(msg) else: @@ -181,11 +179,11 @@ def die(msg): def prompt(prompt_text): - """ Prompt the user to choose one of the choices + """Prompt the user to choose one of the choices - Choices are identified in the prompt_text by square brackets around - a single letter option. - """ + Choices are identified in the prompt_text by square brackets around a + single letter option. + """ choices = set(m.group(1) for m in re.finditer(r"\[(.)\]", prompt_text)) while True: sys.stderr.flush() @@ -218,8 +216,10 @@ def encode_text_stream(s): def decode_path(path): - """Decode a given string (bytes or otherwise) using configured path encoding options - """ + """Decode a given string (bytes or otherwise) using configured path + encoding options. + """ + encoding = gitConfig('git-p4.pathEncoding') or 'utf_8' if bytes is not str: return path.decode(encoding, errors='replace') if isinstance(path, bytes) else path @@ -271,20 +271,20 @@ def run_git_hook(cmd, param=[]): def run_hook_command(cmd, param): """Executes a git hook command - cmd = the command line file to be executed. This can be - a file that is run by OS association. - param = a list of parameters to pass to the cmd command + cmd -- the command line file to be executed. This can be a file that + is run by OS association. + + param -- a list of parameters to pass to the cmd command - On windows, the extension is checked to see if it should - be run with the Git for Windows Bash shell. If there - is no file extension, the file is deemed a bash shell - and will be handed off to sh.exe. Otherwise, Windows - will be called with the shell to handle the file assocation. + On Windows, the extension is checked to see if it should be run with + the Git for Windows Bash shell. If there is no file extension, the file + is deemed a bash shell and will be handed off to sh.exe. Otherwise, + Windows will be called with the shell to handle the file assocation. For non Windows operating systems, the file is called as an executable. - """ + """ cli = [cmd] + param use_shell = False if platform.system() == 'Windows': @@ -324,10 +324,9 @@ def p4_write_pipe(c, stdin): def read_pipe_full(c): - """ Read output from command. Returns a tuple - of the return status, stdout text and stderr - text. - """ + """Read output from command. Returns a tuple of the return status, stdout + text and stderr text. + """ if verbose: sys.stderr.write('Reading pipe: %s\n' % str(c)) @@ -338,12 +337,12 @@ def read_pipe_full(c): def read_pipe(c, ignore_error=False, raw=False): - """ Read output from command. Returns the output text on - success. On failure, terminates execution, unless - ignore_error is True, when it returns an empty string. + """Read output from command. Returns the output text on success. On + failure, terminates execution, unless ignore_error is True, when it + returns an empty string. - If raw is True, do not attempt to decode output text. - """ + If raw is True, do not attempt to decode output text. + """ (retcode, out, err) = read_pipe_full(c) if retcode != 0: if ignore_error: @@ -356,9 +355,9 @@ def read_pipe(c, ignore_error=False, raw=False): def read_pipe_text(c): - """ Read output from a command with trailing whitespace stripped. - On error, returns None. - """ + """Read output from a command with trailing whitespace stripped. On error, + returns None. + """ (retcode, out, err) = read_pipe_full(c) if retcode != 0: return None @@ -387,14 +386,15 @@ def read_pipe_lines(c, raw=False): def p4_read_pipe_lines(c): - """Specifically invoke p4 on the command supplied. """ + """Specifically invoke p4 on the command supplied.""" real_cmd = p4_build_cmd(c) return read_pipe_lines(real_cmd) def p4_has_command(cmd): - """Ask p4 for help on this command. If it returns an error, the - command does not exist in this version of p4.""" + """Ask p4 for help on this command. If it returns an error, the command + does not exist in this version of p4. + """ real_cmd = p4_build_cmd(["help", cmd]) p = subprocess.Popen(real_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -403,10 +403,11 @@ def p4_has_command(cmd): def p4_has_move_command(): - """See if the move command exists, that it supports -k, and that - it has not been administratively disabled. The arguments - must be correct, but the filenames do not have to exist. Use - ones with wildcards so even if they exist, it will fail.""" + """See if the move command exists, that it supports -k, and that it has not + been administratively disabled. The arguments must be correct, but the + filenames do not have to exist. Use ones with wildcards so even if they + exist, it will fail. + """ if not p4_has_command("move"): return False @@ -435,7 +436,7 @@ def system(cmd, ignore_error=False): def p4_system(cmd): - """Specifically invoke p4 as the system command. """ + """Specifically invoke p4 as the system command.""" real_cmd = p4_build_cmd(cmd) expand = not isinstance(real_cmd, list) retcode = subprocess.call(real_cmd, shell=expand) @@ -448,8 +449,8 @@ def die_bad_access(s): def p4_check_access(min_expiration=1): - """ Check if we can access Perforce - account still logged in - """ + """Check if we can access Perforce - account still logged in.""" + results = p4CmdList(["login", "-s"]) if len(results) == 0: @@ -497,14 +498,14 @@ def p4_check_access(min_expiration=1): def p4_version_string(): - """Read the version string, showing just the last line, which - hopefully is the interesting version bit. + """Read the version string, showing just the last line, which hopefully is + the interesting version bit. $ p4 -V Perforce - The Fast Software Configuration Management System. Copyright 1995-2011 Perforce Software. All rights reserved. Rev. P4/NTX86/2011.1/393975 (2011/12/16). - """ + """ global _p4_version_string if not _p4_version_string: a = p4_read_pipe_lines(["-V"]) @@ -559,9 +560,11 @@ def p4_last_change(): def p4_describe(change, shelved=False): - """Make sure it returns a valid result by checking for - the presence of field "time". Return a dict of the - results.""" + """Make sure it returns a valid result by checking for the presence of + field "time". + + Return a dict of the results. + """ cmd = ["describe", "-s"] if shelved: @@ -715,21 +718,22 @@ def getGitTags(): def parseDiffTreeEntry(entry): """Parses a single diff tree entry into its component elements. - See git-diff-tree(1) manpage for details about the format of the diff - output. This method returns a dictionary with the following elements: - - src_mode - The mode of the source file - dst_mode - The mode of the destination file - src_sha1 - The sha1 for the source file - dst_sha1 - The sha1 fr the destination file - status - The one letter status of the diff (i.e. 'A', 'M', 'D', etc) - status_score - The score for the status (applicable for 'C' and 'R' - statuses). This is None if there is no score. - src - The path for the source file. - dst - The path for the destination file. This is only present for - copy or renames. If it is not present, this is None. - - If the pattern is not matched, None is returned.""" + See git-diff-tree(1) manpage for details about the format of the diff + output. This method returns a dictionary with the following elements: + + src_mode - The mode of the source file + dst_mode - The mode of the destination file + src_sha1 - The sha1 for the source file + dst_sha1 - The sha1 fr the destination file + status - The one letter status of the diff (i.e. 'A', 'M', 'D', etc) + status_score - The score for the status (applicable for 'C' and 'R' + statuses). This is None if there is no score. + src - The path for the source file. + dst - The path for the destination file. This is only present for + copy or renames. If it is not present, this is None. + + If the pattern is not matched, None is returned. + """ global _diff_tree_pattern if not _diff_tree_pattern: @@ -757,14 +761,16 @@ def isModeExec(mode): class P4Exception(Exception): - """ Base class for exceptions from the p4 client """ + """Base class for exceptions from the p4 client.""" def __init__(self, exit_code): self.p4ExitCode = exit_code class P4ServerException(P4Exception): - """ Base class for exceptions where we get some kind of marshalled up result from the server """ + """Base class for exceptions where we get some kind of marshalled up result + from the server. + """ def __init__(self, exit_code, p4_result): super(P4ServerException, self).__init__(exit_code) @@ -774,7 +780,7 @@ def __init__(self, exit_code, p4_result): class P4RequestSizeException(P4ServerException): - """ One of the maxresults or maxscanrows errors """ + """One of the maxresults or maxscanrows errors.""" def __init__(self, exit_code, p4_result, limit): super(P4RequestSizeException, self).__init__(exit_code, p4_result) @@ -782,7 +788,7 @@ def __init__(self, exit_code, p4_result, limit): class P4CommandException(P4Exception): - """ Something went wrong calling p4 which means we have to give up """ + """Something went wrong calling p4 which means we have to give up.""" def __init__(self, msg): self.msg = msg @@ -1016,7 +1022,8 @@ def gitConfig(key, typeSpecifier=None): def gitConfigBool(key): """Return a bool, using git config --bool. It is True only if the variable is set to true, and False if set to false or not present - in the config.""" + in the config. + """ if key not in _gitConfig: _gitConfig[key] = gitConfig(key, '--bool') == "true" @@ -1049,7 +1056,8 @@ def p4BranchesInGit(branchesAreInRemotes=True): in remotes or heads as specified by the argument. Return a dictionary of { branch: revision } for each one found. The branch names are the short names, without any - "p4/" prefix.""" + "p4/" prefix. + """ branches = {} @@ -1280,7 +1288,8 @@ def p4PathStartsWith(path, prefix): def getClientSpec(): """Look at the p4 client spec, create a View() object that contains - all the mappings, and return it.""" + all the mappings, and return it. + """ specList = p4CmdList("client -o") if len(specList) != 1: @@ -1363,13 +1372,15 @@ def __init__(self, writeToGitStream): self.writeToGitStream = writeToGitStream def generatePointer(self, cloneDestination, contentFile): - """Return the content of a pointer file that is stored in Git instead of - the actual content.""" + """Return the content of a pointer file that is stored in Git instead + of the actual content. + """ assert False, "Method 'generatePointer' required in " + self.__class__.__name__ def pushFile(self, localLargeFile): """Push the actual content which is not stored in the Git repository to - a server.""" + a server. + """ assert False, "Method 'pushFile' required in " + self.__class__.__name__ def hasLargeFileExtension(self, relPath): @@ -1417,7 +1428,8 @@ def isLargeFile(self, relPath): def processContent(self, git_mode, relPath, contents): """Processes the content of git fast import. This method decides if a file is stored in the large file system and handles all necessary - steps.""" + steps. + """ if self.exceedsLargeFileThreshold(relPath, contents) or self.hasLargeFileExtension(relPath): contentTempFile = self.generateTempFile(contents) (pointer_git_mode, contents, localLargeFile) = self.generatePointer(contentTempFile) @@ -1442,7 +1454,8 @@ class MockLFS(LargeFileSystem): def generatePointer(self, contentFile): """The pointer content is the original content prefixed with "pointer-". - The local filename of the large file storage is derived from the file content. + The local filename of the large file storage is derived from the + file content. """ with open(contentFile, 'r') as f: content = next(f) @@ -1452,8 +1465,8 @@ def generatePointer(self, contentFile): return (gitMode, pointerContents, localLargeFile) def pushFile(self, localLargeFile): - """The remote filename of the large file storage is the same as the local - one but in a different directory. + """The remote filename of the large file storage is the same as the + local one but in a different directory. """ remotePath = os.path.join(os.path.dirname(localLargeFile), '..', 'remote') if not os.path.exists(remotePath): @@ -1463,7 +1476,8 @@ def pushFile(self, localLargeFile): class GitLFS(LargeFileSystem): """Git LFS as backend for the git-p4 large file system. - See https://git-lfs.github.com/ for details.""" + See https://git-lfs.github.com/ for details. + """ def __init__(self, *args): LargeFileSystem.__init__(self, *args) @@ -1729,20 +1743,20 @@ def check(self): die("You have files opened with perforce! Close them before starting the sync.") def separate_jobs_from_description(self, message): - """Extract and return a possible Jobs field in the commit - message. It goes into a separate section in the p4 change - specification. + """Extract and return a possible Jobs field in the commit message. It + goes into a separate section in the p4 change specification. - A jobs line starts with "Jobs:" and looks like a new field - in a form. Values are white-space separated on the same - line or on following lines that start with a tab. + A jobs line starts with "Jobs:" and looks like a new field in a + form. Values are white-space separated on the same line or on + following lines that start with a tab. - This does not parse and extract the full git commit message - like a p4 form. It just sees the Jobs: line as a marker - to pass everything from then on directly into the p4 form, - but outside the description section. + This does not parse and extract the full git commit message like a + p4 form. It just sees the Jobs: line as a marker to pass everything + from then on directly into the p4 form, but outside the description + section. - Return a tuple (stripped log message, jobs string).""" + Return a tuple (stripped log message, jobs string). + """ m = re.search(r'^Jobs:', message, re.MULTILINE) if m is None: @@ -1753,9 +1767,10 @@ def separate_jobs_from_description(self, message): return (stripped_message, jobtext) def prepareLogMessage(self, template, message, jobs): - """Edits the template returned from "p4 change -o" to insert - the message in the Description field, and the jobs text in - the Jobs field.""" + """Edits the template returned from "p4 change -o" to insert the + message in the Description field, and the jobs text in the Jobs + field. + """ result = "" inDescriptionSection = False @@ -1880,11 +1895,13 @@ def canChangeChangelists(self): def prepareSubmitTemplate(self, changelist=None): """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 depot path we're committing into.""" + outside the depot path we're committing into. + """ [upstream, settings] = findUpstreamBranchPoint() @@ -1947,8 +1964,10 @@ def prepareSubmitTemplate(self, changelist=None): return template def edit_template(self, template_file): - """Invoke the editor to let the user change the submission - message. Return true if okay to continue with the submit.""" + """Invoke the editor to let the user change the submission message. + + Return true if okay to continue with the submit. + """ # if configured to skip the editing part, just submit if gitConfigBool("git-p4.skipSubmitEdit"): @@ -2643,8 +2662,9 @@ def run(self, args): class View(object): - """Represent a p4 view ("p4 help views"), and map files in a - repo according to the view.""" + """Represent a p4 view ("p4 help views"), and map files in a repo according + to the view. + """ def __init__(self, client_name): self.mappings = [] @@ -2653,9 +2673,10 @@ def __init__(self, client_name): self.client_spec_path_cache = {} def append(self, view_line): - """Parse a view line, splitting it into depot and client - sides. Append to self.mappings, preserving order. This - is only needed for tag creation.""" + """Parse a view line, splitting it into depot and client sides. Append + to self.mappings, preserving order. This is only needed for tag + creation. + """ # Split the view line into exactly two words. P4 enforces # structure on these lines that simplifies this quite a bit. @@ -2704,7 +2725,7 @@ def convert_client_path(self, clientFile): return clientFile[len(self.client_prefix):] def update_client_spec_path_cache(self, files): - """ Caching file paths by "p4 where" batch query """ + """Caching file paths by "p4 where" batch query.""" # List depot file paths exclude that already cached fileArgs = [f['path'] for f in files if decode_path(f['path']) not in self.client_spec_path_cache] @@ -2736,9 +2757,11 @@ def update_client_spec_path_cache(self, files): self.client_spec_path_cache[depotFile] = b'' def map_in_client(self, depot_path): - """Return the relative location in the client where this - depot file should live. Returns "" if the file should - not be mapped in the client.""" + """Return the relative location in the client where this depot file + should live. + + Returns "" if the file should not be mapped in the client. + """ if gitConfigBool("core.ignorecase"): depot_path = depot_path.lower() @@ -2889,10 +2912,10 @@ def extractJobsFromCommit(self, commit): return jobs def stripRepoPath(self, path, prefixes): - """When streaming files, this is called to map a p4 depot path - to where it should go in git. The prefixes are either - self.depotPaths, or self.branchPrefixes in the case of - branch detection.""" + """When streaming files, this is called to map a p4 depot path to where + it should go in git. The prefixes are either self.depotPaths, or + self.branchPrefixes in the case of branch detection. + """ if self.useClientSpec: # branch detection moves files up a level (the branch name) @@ -2921,8 +2944,9 @@ def stripRepoPath(self, path, prefixes): return path def splitFilesIntoBranches(self, commit): - """Look at each depotFile in the commit to figure out to what - branch it belongs.""" + """Look at each depotFile in the commit to figure out to what branch it + belongs. + """ if self.clientSpecDirs: files = self.extractFilesFromCommit(commit) @@ -3193,9 +3217,10 @@ def make_email(self, userid): return "%s " % userid def streamTag(self, gitStream, labelName, labelDetails, commit, epoch): - """ Stream a p4 tag. - commit is either a git commit, or a fast-import mark, ":" - """ + """Stream a p4 tag. + + Commit is either a git commit, or a fast-import mark, ":". + """ if verbose: print("writing tag %s for commit %s" % (labelName, commit)) @@ -4246,8 +4271,7 @@ def __init__(self): self.destbranch = "refs/remotes/p4-unshelved" def renameBranch(self, branch_name): - """ Rename the existing branch to branch_name.N - """ + """Rename the existing branch to branch_name.N .""" found = True for i in range(0,1000): @@ -4263,9 +4287,9 @@ def renameBranch(self, branch_name): sys.exit("gave up trying to rename existing branch {0}".format(sync.branch)) def findLastP4Revision(self, starting_point): - """ Look back from starting_point for the first commit created by git-p4 - to find the P4 commit we are based on, and the depot-paths. - """ + """Look back from starting_point for the first commit created by git-p4 + to find the P4 commit we are based on, and the depot-paths. + """ for parent in (range(65535)): log = extractLogMessageFromGitCommit("{0}~{1}".format(starting_point, parent)) @@ -4276,8 +4300,9 @@ def findLastP4Revision(self, starting_point): sys.exit("could not find git-p4 commits in {0}".format(self.origin)) def createShelveParent(self, change, branch_name, sync, origin): - """ Create a commit matching the parent of the shelved changelist 'change' - """ + """Create a commit matching the parent of the shelved changelist + 'change'. + """ parent_description = p4_describe(change, shelved=True) parent_description['desc'] = 'parent for shelved changelist {}\n'.format(change) files = sync.extractFilesFromCommit(parent_description, shelved=False, shelved_cl=change) From patchwork Wed Jan 12 13:46:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C8DFC433EF for ; Wed, 12 Jan 2022 13:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353687AbiALNrq (ORCPT ); Wed, 12 Jan 2022 08:47:46 -0500 Received: from mail-dm6nam08on2079.outbound.protection.outlook.com ([40.107.102.79]:20384 "EHLO NAM04-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353694AbiALNrU (ORCPT ); Wed, 12 Jan 2022 08:47:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ax7+QwajWx79wSRAxePXIM7uX28ymZrNJqM5cUcrG9UYENAZTIsgwPdSykaLnHZ2c+vNN+mmBWZLSuurhMl3JquxAv9URKyBTUx0bx7asDUxf0jioWn28Ns/Q/SBys5zeqW2M6VSFRjKteGuVWG4UTR3IPc/siUZcaDUxV/aGEfm7DMzt56ZBfQVb+jVVy+bSoDPVnrdTNG0ELP8Klq26V+43IG9qfJuSG1p44UlHmoK/GBIN91+bCEZjLz4jSfgD0pjsuYBmpZI2qGJTEwvGZ4lxwETjxuswFLj0tU56petpSuq7JSZi6azDCvazGOGuJBDflLC09wQyzvUfq7LsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tWjSEpl1imDfOQXWNnXjPs52X+2BjS3OVSoU84HI9eA=; b=KpTRR4Tp5rjuQrvY3uqghO7g81vSRbSeobh102zog91d9mHcrz9Ld7p3qJXv/aTT0p5ZCaOfhs/wKHzh53rZibd2zcfIVVsakJ69jXdW7wLxyViuc83AG/sB/ppDOXwuOeEaJcl2SrjeDIjg4vxKhfTHiZtGqep6oO0nQiV983pHtmQaNee+FSRTRTyd+Q5SSbQGt3Qyc/+mdwywJDpFnx/BX4E+2v+22q7qprA6bpJYuQk3um7aAkDreQwzOUXmSW0SOxn0rFMIpagHS1y7xq1miCoWkIeDYqO/KPcbFgUvDUSNjUTssc/FDzccPiO37soMys2T0qjmnu1K0uUKEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tWjSEpl1imDfOQXWNnXjPs52X+2BjS3OVSoU84HI9eA=; b=GJnA7nrNuFytiiXwV4cB6TLcGyOWVORrZ8APryCGs4olXTlX5bEsy55LSj0HMiXu8LZ+ivYdYy+prClHu7Hn+TS8Z4bHnNj9VLvExp8QTMVwN8moCVnikYRU2ai6q7NjfixmxfVViqN4PMAFfZDF83Ie3v1mTeVNFrhKUv6qUMNjAe2zFO4h3OcUt9cxb9zKo5SYrRvkV8elLbQpt49R3zpRpFsP/mfe9nrKieMecubsTnz9hp5vgfF3XdRj6Jg8HawpbwfakqWBHncN/tWPCZNvsNex0z5JE1FhVIGJ6zdF7ZFolxDClT0qC9fjsEauAnp5y5mFuKccT4ZN3DFDaA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by CH2PR12MB4279.namprd12.prod.outlook.com (2603:10b6:610:af::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7; Wed, 12 Jan 2022 13:47:18 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:18 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 05/20] git-p4: convert descriptive class and function comments into docstrings Date: Wed, 12 Jan 2022 13:46:20 +0000 Message-Id: <20220112134635.177877-6-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 00a66a9e-cfb7-4ce8-9bae-08d9d5d20cd0 X-MS-TrafficTypeDiagnostic: CH2PR12MB4279:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2657; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gqsJdfwQeGdEBJT3kMqJrG4ij8/j5ulgiKOCAhd8m6TAf8RJzT5EFmXi8vaBKhP5b7CO6HWICv1jJyqEkQ7XKGiqNcclD9d+Ox3boy0W5OYVaa7BTQNBBVZ7SunaQpSzhWBWZ14BTBhifA5il2oOzw5ntzI8xcuULyDGteeVyEUfIsWgEL5Nksu6Aw4FmPtPNQ5j8/ctpkNBnZVs3I4ySSVoxwSl2YpIRRL2CBaIBWX0V8Utl88yGXWueKuE2pFXcAA2so+1EKn23Qx5dKW3JSx8h7qG7Pdrab442IvaOpEu+PFpm/wEUKZHUTyi2dW+XbvcJtu4R75o+eutOY55B/OycR0YWOcPOrhVPN1w5PDYwdRWjx8vmbCbctpk0cMwGU1+ZCWvHx53kOk+27N+COwQUE2IvGuTHjWP+e9NGxqijSAR9CVUTlHUEX7uIF3QZDjal890GgOq1ar+bd4SiEHmwX0xUHwlm68BSgS8HUXK1/Beo9w+QWTGk4L92SrGUA7YHtEGggvEYDhLocM8GwtSW0DzMc5EXtF5AXgcJidhvvQL2DJB5mODLTPwOJ3bMqrAfVC8GxbpxD3IlBA5lFDedaejrj26oSl5pI6/6jHZFnEtFRQho95u0PzzVb8hCCvErfwOmzMuomA8+Ib8YROVpoBHy4PiXVYpGB2fd8krQZQpGDyILT9FbWjRqnFZrrfLYPDz7tk2yJrZLnn5Lw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(30864003)(1076003)(19627235002)(55236004)(7416002)(4326008)(38100700002)(38350700002)(508600001)(6506007)(86362001)(54906003)(6486002)(26005)(110136005)(6512007)(186003)(8676002)(2616005)(5660300002)(66476007)(83380400001)(8936002)(2906002)(66946007)(36756003)(6666004)(66556008)(107886003)(316002)(52116002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Bfp1sW2wGhvUHlVsmr0vUv3cWk25c06n0SX+wlPy8HKDD/XSMdZsfcOsKQTugheQTub5K8Kgu87zY3Rwrk1H9oycYrd3tlnEYfopJ7H31ERIomXij2h62oRbo7QuoszHrhndXqxIsCW5qbyjcXRshsWWiXbHIW6eDqEUFaHC+amVNvdrDsuXBtPxVcjtlioSYsXfy5CulZpWyzRxxsf0RVvx5vdIFAftdkKJyoAmKP5bsYeTCb7nMdmy5W5V/XyCRiPqUkHOss8cO36bD5mlffxxY8vHnrOBLkQkihSCLnak/rLeX3zgsLg2Ks5W2Jlklj0e0JzqYukNck0DXTPh7cAmRPO0oQIqQBU5aCXXaphJP/tY/ShSYxFZPaVYiplZH4vwN9PO8fw+st3+3dV1CuT5LegdOr5gK/vkqE9GYLkIYSZrHbbG+sVVa1RL9zqsx5w5tawaGQ8tIm9QRmkdRKkxI/olMg7avyS4CmpKG/HdgOguETxB2/9qCBI0gJ5IJQ3qNeaBa8ImiAyadfWkrpiOcYqGYDelZgNrirV5l7joaoUFB/EfHuUmTQNwpAyJUmJMsiUKVIQS8QfBKADLuUg5U/xDYbQz7rhT9h3yEFI9UA5I0Wuer4e4NgWVYMJPZaijIXZPDWn7aH6nGyJQN2gUB07pmiL0CySi7HLv7eeapMqX0Ep0iDofFEehnMzR1QQ4WelKBMsutxyTttdZFp6OwwChatI3S9OIPtcM4fcdKD1sUgRC5N8sBiBdZbHrO8VtaLsUykYl9qlud/FOB8ruFtPwlkmIPWfNkjHxJqU7pri2CJUnHO1KsLQYodMqQMwMnIY/VBT/bYfkdmgOTj2kTARcOC0lLv0IM7jeuAtYPgphVe2/f0aLkz8SH4rPChkvWASEX8/pHK0X2yOWq/OSsuJqQQZNm5zJuqZZyg9VVGhCK+JUImDROYGQa8ID8nNG1lF7TsXE1zBlEI1pEZ4kWTniV0i1nvnkKHxhVQIz/wbE2+UaUo5M+0xcxXbgLFjVbidVZK9UBW45AntEB8ImhVQlly8eD+BJcRLQdFMvQ3xUjt7vn4Kpg3ZzEWBJgayatkmkWJThDSBUjqXrfJnlFE5lsoXMcnJXeDDJn6NwvCTSF9zRYrYNRdR9xeH4Xsj9PcHZtxdK3gb02gIuiA+PTKLKGO7pwawwEmQx65rE+ANYgqReqxRHbZfhctq6chqUnG5cCQktE1iInUZXDndrXro6Vp5zrGON5EQVPd2Z5veO97WevusNGPSZMkqiQpdd0tqcoGYSysdFGuyPy3k2uLSgPEwumrgTAQUh5Y2mQ1BRA/bt9eUW/P3Nm56Q2HTW8C/PG24/V3rByCEAblmW+EjQn027S2WuGA5TsIYz93DY8bKcBzNzoxX2xN0nXkSAT3cNw9bojb0cn0P+YvO6bi+/LXxYOYacfsGfkl78nHgDs2vEkn9AiUXlbTh1dw6xpjxF4pkfaV4b/mnIzaJx0IbSK8IXCJo2kmNooEE33mioGORTb20j3VI1fwcruKjBosu582jTXnNwmOcjbVuquGEcyotjrcCPoJOQj9I/RzR5XTYwBvV7xf6ZAirT23Gdr878Mv6aupp6+WdVley6x+VIkmQO8Piy4vlb96w= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00a66a9e-cfb7-4ce8-9bae-08d9d5d20cd0 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:18.5419 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RquUoBwElnz8Sq0CCPR9IXT176NgvfNjEVxiN+EZz4OWvX8V8KfabAZTCP1q/ul0G9tiCv4QmwPdvpMBrWQ1Mg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4279 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Previously, a small number of functions, methods and classes were documented using comments. This patch improves consistency by converting these into docstrings similar to those that already exist in the script. Signed-off-by: Joel Holdsworth --- git-p4.py | 162 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 92 insertions(+), 70 deletions(-) diff --git a/git-p4.py b/git-p4.py index 93f4ec843f..0bd1ba00ba 100755 --- a/git-p4.py +++ b/git-p4.py @@ -522,7 +522,7 @@ def p4_sync(f, *options): def p4_add(f): - # forcibly add file names with wildcards + """Forcibly add file names with wildcards.""" if wildcard_present(f): p4_system(["add", "-f", f]) else: @@ -590,12 +590,10 @@ def p4_describe(change, shelved=False): return d -# -# Canonicalize the p4 type and return a tuple of the -# base type, plus any modifiers. See "p4 help filetypes" -# for a list and explanation. -# def split_p4_type(p4type): + """Canonicalize the p4 type and return a tuple of the base type, plus any + modifiers. See "p4 help filetypes" for a list and explanation. + """ p4_filetypes_historical = { "ctempobj": "binary+Sw", @@ -626,19 +624,18 @@ def split_p4_type(p4type): return (base, mods) -# -# return the raw p4 type of a file (text, text+ko, etc) -# def p4_type(f): + """Return the raw p4 type of a file (text, text+ko, etc).""" + results = p4CmdList(["fstat", "-T", "headType", wildcard_encode(f)]) return results[0]['headType'] -# -# Given a type base and modifier, return a regexp matching -# the keywords that can be expanded in the file -# def p4_keywords_regexp_for_type(base, type_mods): + """Given a type base and modifier, return a regexp matching the keywords + that can be expanded in the file. + """ + if base in ("text", "unicode", "binary"): if "ko" in type_mods: return re_ko_keywords @@ -650,12 +647,11 @@ def p4_keywords_regexp_for_type(base, type_mods): return None -# -# Given a file, return a regexp matching the possible -# RCS keywords that will be expanded, or None for files -# with kw expansion turned off. -# def p4_keywords_regexp_for_file(file): + """Given a file, return a regexp matching the possible RCS keywords that + will be expanded, or None for files with kw expansion turned off. + """ + if not os.path.exists(file): return None else: @@ -664,8 +660,9 @@ def p4_keywords_regexp_for_file(file): def setP4ExecBit(file, mode): - # Reopens an already open file and changes the execute bit to match - # the execute bit setting in the passed in mode. + """Reopens an already open file and changes the execute bit to match the + execute bit setting in the passed in mode. + """ p4Type = "+x" @@ -680,7 +677,7 @@ def setP4ExecBit(file, mode): def getP4OpenedType(file): - # Returns the perforce file type for the given file. + """Returns the perforce file type for the given file.""" result = p4_read_pipe(["opened", wildcard_encode(file)]) match = re.match(".*\((.+)\)( \*exclusive\*)?\r?$", result) @@ -690,8 +687,9 @@ def getP4OpenedType(file): die("Could not determine file type for %s (result: '%s')" % (file, result)) -# Return the set of all p4 labels def getP4Labels(depotPaths): + """Return the set of all p4 labels.""" + labels = set() if not isinstance(depotPaths, list): depotPaths = [depotPaths] @@ -703,8 +701,9 @@ def getP4Labels(depotPaths): return labels -# Return the set of all git tags def getGitTags(): + """Return the set of all git tags.""" + gitTags = set() for line in read_pipe_lines(["git", "tag"]): tag = line.strip() @@ -755,8 +754,9 @@ def parseDiffTreeEntry(entry): def isModeExec(mode): - # Returns True if the given git mode represents an executable file, - # otherwise False. + """Returns True if the given git mode represents an executable file, + otherwise False. + """ return mode[-3:] == "755" @@ -1274,13 +1274,14 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize): def p4PathStartsWith(path, prefix): - # This method tries to remedy a potential mixed-case issue: - # - # If UserA adds //depot/DirA/file1 - # and UserB adds //depot/dira/file2 - # - # we may or may not have a problem. If you have core.ignorecase=true, - # we treat DirA and dira as the same directory + """This method tries to remedy a potential mixed-case issue: + + If UserA adds //depot/DirA/file1 + and UserB adds //depot/dira/file2 + + we may or may not have a problem. If you have core.ignorecase=true, + we treat DirA and dira as the same directory. + """ if gitConfigBool("core.ignorecase"): return path.lower().startswith(prefix.lower()) return path.startswith(prefix) @@ -1332,13 +1333,15 @@ def getClientRoot(): return entry["Root"] -# -# P4 wildcards are not allowed in filenames. P4 complains -# if you simply add them, but you can force it with "-f", in -# which case it translates them into %xx encoding internally. -# def wildcard_decode(path): - # Search for and fix just these four characters. Do % last so + """Decode P4 wildcards into %xx encoding + + P4 wildcards are not allowed in filenames. P4 complains if you simply + add them, but you can force it with "-f", in which case it translates + them into %xx encoding internally. + """ + + # Search for and fix just these four characters. Do % last so # that fixing it does not inadvertently create new %-escapes. # Cannot have * in a filename in windows; untested as to # what p4 would do in such a case. @@ -1351,6 +1354,8 @@ def wildcard_decode(path): def wildcard_encode(path): + """Encode %xx coded wildcards into P4 coding.""" + # do % first to avoid double-encoding the %s introduced here path = path.replace("%", "%25") \ .replace("*", "%2A") \ @@ -1597,7 +1602,7 @@ def p4UserId(self): die("Could not find your p4 user id") def p4UserIsMe(self, p4User): - # return True if the given p4 user is actually me + """Return True if the given p4 user is actually me.""" me = self.p4UserId() if not p4User or p4User != me: return False @@ -1800,7 +1805,9 @@ def prepareLogMessage(self, template, message, jobs): return result def patchRCSKeywords(self, file, regexp): - # Attempt to zap the RCS keywords in a p4 controlled file matching the given regex + """Attempt to zap the RCS keywords in a p4 controlled file matching the + given regex. + """ (handle, outFileName) = tempfile.mkstemp(dir='.') try: with os.fdopen(handle, "wb") as outFile, open(file, "rb") as inFile: @@ -1818,7 +1825,9 @@ def patchRCSKeywords(self, file, regexp): print("Patched up RCS keywords in %s" % file) def p4UserForCommit(self,id): - # Return the tuple (perforce user,git email) for a given git commit id + """Return the tuple (perforce user,git email) for a given git commit + id. + """ self.getUserMapFromPerforceServer() gitEmail = read_pipe(["git", "log", "--max-count=1", "--format=%ae", id]) @@ -1829,7 +1838,7 @@ def p4UserForCommit(self,id): return (self.emails[gitEmail],gitEmail) def checkValidP4Users(self,commits): - # check if any git authors cannot be mapped to p4 users + """Check if any git authors cannot be mapped to p4 users.""" for id in commits: (user,email) = self.p4UserForCommit(id) if not user: @@ -1840,10 +1849,12 @@ def checkValidP4Users(self,commits): die("Error: %s\nSet git-p4.allowMissingP4Users to true to allow this." % msg) def lastP4Changelist(self): - # Get back the last changelist number submitted in this client spec. This - # then gets used to patch up the username in the change. If the same - # client spec is being used by multiple processes then this might go - # wrong. + """Get back the last changelist number submitted in this client spec. + + This then gets used to patch up the username in the change. If the + same client spec is being used by multiple processes then this might + go wrong. + """ results = p4CmdList("client -o") # find the current client client = None for r in results: @@ -1859,7 +1870,7 @@ def lastP4Changelist(self): die("Could not get changelist number for last submit - cannot patch up user details") def modifyChangelistUser(self, changelist, newUser): - # fixup the user field of a changelist after it has been submitted. + """Fixup the user field of a changelist after it has been submitted.""" changes = p4CmdList("change -o %s" % changelist) if len(changes) != 1: die("Bad output from p4 change modifying %s to user %s" % @@ -1882,8 +1893,9 @@ def modifyChangelistUser(self, changelist, newUser): die("Could not modify user field of changelist %s to %s" % (changelist, newUser)) def canChangeChangelists(self): - # check to see if we have p4 admin or super-user permissions, either of - # which are required to modify changelists. + """Check to see if we have p4 admin or super-user permissions, either + of which are required to modify changelists. + """ results = p4CmdList(["protects", self.depotPath]) for r in results: if 'perm' in r: @@ -2334,9 +2346,11 @@ def applyCommit(self, id): os.remove(fileName) return submitted - # Export git tags as p4 labels. Create a p4 label and then tag - # with that. def exportGitTags(self, gitTags): + """Export git tags as p4 labels. Create a p4 label and then tag with + that. + """ + validLabelRegexp = gitConfig("git-p4.labelExportRegexp") if len(validLabelRegexp) == 0: validLabelRegexp = defaultLabelRegexp @@ -2859,8 +2873,8 @@ def __init__(self): self.tz = "%+03d%02d" % (- time.timezone / 3600, ((- time.timezone % 3600) / 60)) self.labels = {} - # Force a checkpoint in fast-import and wait for it to finish def checkpoint(self): + """Force a checkpoint in fast-import and wait for it to finish.""" self.gitStream.write("checkpoint\n\n") self.gitStream.write("progress checkpoint\n\n") self.gitStream.flush() @@ -3006,9 +3020,9 @@ def encodeWithUTF8(self, path): print('Path with non-ASCII characters detected. Used %s to encode: %s ' % (encoding, path)) return path - # output one file from the P4 stream - # - helper for streamP4Files def streamOneP4File(self, file, contents): + """Output one file from the P4 stream - helper for streamP4Files.""" + file_path = file['depotFile'] relPath = self.stripRepoPath(decode_path(file_path), self.branchPrefixes) @@ -3100,8 +3114,8 @@ def streamOneP4Deletion(self, file): if self.largeFileSystem and self.largeFileSystem.isLargeFile(relPath): self.largeFileSystem.removeLargeFile(relPath) - # handle another chunk of streaming data def streamP4FilesCb(self, marshalled): + """Handle another chunk of streaming data.""" # catch p4 errors and complain err = None @@ -3165,8 +3179,9 @@ def streamP4FilesCb(self, marshalled): self.stream_have_file_info = True - # Stream directly from "p4 files" into "git fast-import" def streamP4Files(self, files): + """Stream directly from "p4 files" into "git fast-import.""" + filesForCommit = [] filesToRead = [] filesToDelete = [] @@ -3270,15 +3285,18 @@ def hasBranchPrefix(self, path): return hasPrefix def findShadowedFiles(self, files, change): - # Perforce allows you commit files and directories with the same name, - # so you could have files //depot/foo and //depot/foo/bar both checked - # in. A p4 sync of a repository in this state fails. Deleting one of - # the files recovers the repository. - # - # Git will not allow the broken state to exist and only the most recent - # of the conflicting names is left in the repository. When one of the - # conflicting files is deleted we need to re-add the other one to make - # sure the git repository recovers in the same way as perforce. + """Perforce allows you commit files and directories with the same name, + so you could have files //depot/foo and //depot/foo/bar both checked + in. A p4 sync of a repository in this state fails. Deleting one of + the files recovers the repository. + + Git will not allow the broken state to exist and only the most + recent of the conflicting names is left in the repository. When one + of the conflicting files is deleted we need to re-add the other one + to make sure the git repository recovers in the same way as + perforce. + """ + deleted = [f for f in files if f['action'] in self.delete_actions] to_check = set() for f in deleted: @@ -3395,8 +3413,11 @@ def commit(self, details, files, branch, parent = "", allow_empty=False): print("Tag %s does not match with change %s: file count is different." % (labelDetails["label"], change)) - # Build a dictionary of changelists and labels, for "detect-labels" option. def getLabels(self): + """Build a dictionary of changelists and labels, for "detect-labels" + option. + """ + self.labels = {} l = p4CmdList(["labels"] + ["%s..." % p for p in self.depotPaths]) @@ -3422,11 +3443,12 @@ def getLabels(self): if self.verbose: print("Label changes: %s" % self.labels.keys()) - # Import p4 labels as git tags. A direct mapping does not - # exist, so assume that if all the files are at the same revision - # then we can use that, or it's something more complicated we should - # just ignore. def importP4Labels(self, stream, p4Labels): + """Import p4 labels as git tags. A direct mapping does not exist, so + assume that if all the files are at the same revision then we can + use that, or it's something more complicated we should just ignore. + """ + if verbose: print("import p4 labels: " + ' '.join(p4Labels)) From patchwork Wed Jan 12 13:46:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13823C433EF for ; Wed, 12 Jan 2022 13:47:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353735AbiALNru (ORCPT ); Wed, 12 Jan 2022 08:47:50 -0500 Received: from mail-dm6nam12on2043.outbound.protection.outlook.com ([40.107.243.43]:52832 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353695AbiALNrW (ORCPT ); Wed, 12 Jan 2022 08:47:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YhyosaubuJIf1tBeiRTaP3AxlA/GF3nqDRBCsEbkek7H/otie/b07JDmi8f8YR32MX2O/fLo0h1W67v/jBk9VQtPJXUsiYVHjiwZs0UZTkAffmXcN9cFU4QAgOl4Ya8SacwGRFwQfVSgwAUEs3/y+WbrJ0iblMmeg0xoY0R30pLgUtYnIV2bZ04YHtAaRVeWQPzHuCucb0p+jRr6mJiD4WbOYus5J80y1C7uWMAdhgyKlEHzQSATC8Nb2qn9/17gnmy8E5796YCjUS/8fWHu9XhHrxFxPkVcJW6qpOC97eftH+tAIaUJf080MMIfIOOwT4RJ+dkQs6UwOnefcqr9+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GkRlc2ZoKpEbXaKRId3KYl35DXEpVt0xi11ZA/TOGoU=; b=iCe6jx9mXdbgtIGAqovu1FirIUcsjvozFWwG/Nt4vV/qjPb06sZrgubjubM57PyUsd9NH0L8AycvnhMHVRlC7nmxDydxXwGEzfVQo2/d/KcXmv5O5Yrz7oeQLo21bxdNnAe2ArQEdZn7qK8rFRAMQ6vIR4/bCus/wOT0rf8BoHmrsgmRiIOVYsp6ROBHU/X/KghePSyEz3+Yo0VNET0e6kQuZgIuEWLZuYCun14EjdIpn0rLXeE/7hiCSXxRaPGmsyBVYLFUvyA2gwJcqTGA4ycQiRFltkOBIicnCby6CJOsaxtKcJ0nhownTLy4opHiOL/MYcCN0aGv5RPjR4mDqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GkRlc2ZoKpEbXaKRId3KYl35DXEpVt0xi11ZA/TOGoU=; b=EJCnuHRQLHyk8fWbAEAX13MbPg5deaq6EI5N39/Wvo1j4dMd4ojeDZx9lBl8K763SnwtkYxnpsBa8bhA32nd3EhTSrrONytcDQj2lJtSodou0VVWku1241IScRf70DOwZDgiTy4Ym+bKrVvL8+OxW/H7ydv8WQcLLtWBGECNdKzFEHeTA5GBhlxCqMAsgw4mM63mKpooUGGgp3BupmzQfPNE3AxdHFb41VFI/bhNnvgRpPCJ/ZGGQturbxYBIbzKB1YQrMIqr7ZVePlDIzQUOFYgr6gZeU1HjbM/uelXDjPZE81L2r6+BNChywe5RiwiAzW66OoULnQnCavJXKe5NQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:20 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:20 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 06/20] git-p4: remove commented code Date: Wed, 12 Jan 2022 13:46:21 +0000 Message-Id: <20220112134635.177877-7-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11f008b8-3723-4832-b1b1-08d9d5d20de7 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:115; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ydtJeup6OqgxgZOq3AiCRPNlVZ/w6x8NZfNEf7yiRq094kW8y2eXIIXYuAgvEXEA1qsZEpVt22G8fj5RdaY7xxTITVKZGz+QgL9109CTqKmZWoFUKqOcjfzF6VK78ZCJirAffIbflAN4+HlrkQ3RkLHz0iCmUWChiW9yE+rbfOs7tEsWwc7xUtLggCydpGnQqYVUNWEImunj5maKqmtEXigNqaFeO9fPqKGuIidvLDEpHdHaGX9DLNEFSFQS+spgWCBtspkq3zqZdnSYiP18xVw2/22rYtHvI2yEXkyXBKnoOsD+w9RYYjR1IBWVuOoZ462cy00i0T6K2FECBU6QIox1lzpf0m8oQ+fIUPcxSxXTVhHejAYLl95/kLVGCBjAnBO72v7HMZc7Bk5SlyB3e1CG7GTPTFZd7VE1aD7HsiaYtgOy6fnfuK/olYN9lSRmlz7Mp/Tjo2dysQiszxas+oU3OBIb7bU0Qvzpg3DrEnOib24X1YqCnXMoRGgOWUT2YjBxCrNDURWKHvAnsofXQnMH2rh+P0ZfQlLwEGbFnBsK9UUXaBr+hAHHJQNOXJjTxLbaBgew4jQjZtMTJjAX0IFjHLI0lP1R6w1wxLRuLGVW4KxcYDouOfm4WmYmwxDSV2ISOzMZNj05iIRSR+eokw2RmEXkaaCTz9ltgatqU5CqOjoZX8I2vAIiSts8KPWU7CUwTcml0rgVJfFNKYvrKw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ybtu6G4e8OeKi7eaHIoGYuP97fR5tEtDyEBQrJs1SI8E4jZVFsRYX73PHK+n0SRYuisQt7L772mvaLIBbimiWJx877+M757iMoUKiBnmRc493OyfnEF5TIFO0vxuUq7e5xkO8rE7XrN1E8GRA2EiL98sci9NUUzrWS/f+uDXC7HZ+CTiipTQZl6eSJ0Qhr+NP5OArUiLYakw52UUHUf0v1uj3sTtSVpvDz2MujTWB3rNnz3q7Dl8P9e2G+iZGfUlme628f+C/jifIrUFVFKvaeFPWP28GR2PSEp3mhzX1o2KeU6JS1FD8qkq97fYUVyFLsrAiINGtHKmF0PHfltfVg7ebOHKVMIq/WfIqAQZRXruLyNAjC7GE48NkiuT3K/ubdeRVEtwOg4ZwkpopYKp/B9zdq7q0SgVBsDvpLWsV8T6QG9X73tawgur1xJoVhHZIW1PA+Z0yEBRyPCzWfLydEEt0y3tkoGwSHltFLMywoQsjLOsEnyiZVylnms+KjLGLl9IgXHSeK15R85EonzdtQxLLazOwV9OIxzCm7V514K+P7QMaN7EKEBMGn8iTBiF/+ptl2B+Si1iIr7Daewq/Rp6avWEk2bpUuC/SRw65r+A26m8kN59yi1zR6U3AQ4xt6kdEs0bvAjVC4TumzxIKmKzK6Sg7v3HKt3gdHjIPm0iVE4RnOuYZy0FNvo2S85TxCUd1iSHhE6hWZB7YeO+oXWOl/7AK6EjzDwNqrFdZcVX8HUgxkFrUweunVXVUkB7k1vi6c5f9jW0Oaw+OFj/NWmsm1fK1epr50rlsUtdQtUd3WDu8R1py8LrKqyD0CCjNpKb86ZjgtVQbpNcZboV2lcET5iZD0GmKbBNKOnK2LpyCQrIJf0XHvrupjaG62ZwDl7J+z/6U/g/H1hl62wVL46czNPDuNQ1DQ+KjJoeBZwIkHzHZNkzCTQko6zkiU9FskeJWz/MqLHD83AnOWLkZoO8fUTDl4jbFG6bhDGazM+LoUKjmcKo0R22l+L+mV1t5iboU5Ofl1ZcxeHLG/g+AeAnqXQO8uGCynEky666cbhrJLOeARTBTaIwpni+qDGpf4piBCzY2r1QktXw0niJfnnTB6vsMOLXtinh/ODb6vw4qGRlJ7jlw1oys5KM3dr4d6eC6jtBXidguxxTjmKjwWVw281voKsoj6Rh0RXIkARZCsSDKnF5FkAfmfWzEzCEC2KBwr3Nl2oWGfkDTIhUPL7aFHb/esfhC1eZZu8fzSEIlvD2oodv64xXIpu2ePCbekG8JX0LzjnZNeet3s/TybqFat/7GZANYe+RZNVnR1QdJF3CJgCNyWXj/PKoSn7rgGd/R3s52VTzYfss17qyMf5RXDeUwssn5nuqTw4EIv9pf8ju2CjrkXiXMx0AYekCgMJnAdcP/MHu7RqEcUqIsZ9mspoB7bGE2/o6NN8ylLpaoubHLX6KYZgnisIOB23TR5Ua8wFx7keRdq413WRf8FKsUy+xaESUhXSUQBffprTq8CRpFSRzwlen/pu/75/p9XbDA4L+oVpsejx2lFLCLj7ZZDcGFq8UW5j0/piuGsWbe/OjWqxoWMsab5N6tqLE37Agn7OC1QlC+K8aCiLJVndi6t2TGqigwotk1p1406I= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11f008b8-3723-4832-b1b1-08d9d5d20de7 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:20.3709 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: enxa01iqbijPiIj/U2Wv+e2Az2SO43Pbz9/p8WndcgQa0G43Iw+QSNZWlINSUeQaImkek4cjPKt8ElrnzhWJsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Previously, the script contained commented code including Python 2 print statements. Presumably, these were used as a developer aid at some point in history. However, commented code and therefore this patch removes them. Signed-off-by: Joel Holdsworth --- git-p4.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/git-p4.py b/git-p4.py index 0bd1ba00ba..ad385d6919 100755 --- a/git-p4.py +++ b/git-p4.py @@ -3654,23 +3654,18 @@ def importNewBranch(self, branch, maxChange): self.gitStream.flush() branchPrefix = self.depotPaths[0] + branch + "/" range = "@1,%s" % maxChange - #print "prefix" + branchPrefix changes = p4ChangesForPaths([branchPrefix], range, self.changes_block_size) if len(changes) <= 0: return False firstChange = changes[0] - #print "first change in branch: %s" % firstChange sourceBranch = self.knownBranches[branch] sourceDepotPath = self.depotPaths[0] + sourceBranch sourceRef = self.gitRefForBranch(sourceBranch) - #print "source " + sourceBranch branchParentChange = int(p4Cmd(["changes", "-m", "1", "%s...@1,%s" % (sourceDepotPath, firstChange)])["change"]) - #print "branch parent: %s" % branchParentChange gitParent = self.gitCommitByP4Change(sourceRef, branchParentChange) if len(gitParent) > 0: self.initialParents[self.gitRefForBranch(branch)] = gitParent - #print "parent git commit: %s" % gitParent self.importChanges(changes) return True @@ -3813,8 +3808,6 @@ def importHeadRevision(self, revision): newestRevision = change if info["action"] in self.delete_actions: - # don't increase the file cnt, otherwise details["depotFile123"] will have gaps! - #fileCnt = fileCnt + 1 continue for prop in ["depotFile", "rev", "action", "type" ]: From patchwork Wed Jan 12 13:46:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0608CC433EF for ; Wed, 12 Jan 2022 13:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353748AbiALNsB (ORCPT ); Wed, 12 Jan 2022 08:48:01 -0500 Received: from mail-dm6nam12on2043.outbound.protection.outlook.com ([40.107.243.43]:52832 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353710AbiALNrc (ORCPT ); Wed, 12 Jan 2022 08:47:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ERQiqTfjAWtLvQFS8K/Kbz0W017w9jbfBL/oDCQWY4sOoN56SsYJlOWWnOmW+TRwf+MgqBIDyurJYeE6cK6hPm4VhAVp0yil0fguYc3Ppm3El5NGB50q3f5i7wasQHianOq6YGiglzxITyTo7ltLtATUuxYMyaOGgFKixn6KHDv6R1tSf3cB6i18WgkW2ZLNbQXZm+obXF0fWE4/KYEy+UkoWIkqTSOgZwVsh9pQzojdl7IS3W5jxUwiGLx75MV49L1Cj7YfmJ0Sww0d9vW65HUmc3H3uZygsgI8SvVxmQmOu+l+1bMZ2tbECcrLso6Lp24dz9Sjgzw9JYpHaaP6Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Dg05Ls94yjgWfK0ByAYBc5m6CxZC5mexyWzJGmJTS00=; b=i4IRnEVYgJxGRm5Vdcn+aFtC/6UXF4ItvOc+X8X8MDaZ/7h4WFygaef1XcqGJdeIn+Qf34+ybnx0AShnJlLuKj6EvXm+yu3rIK+3tawwx04hAWIc76IeRSsi7LNY0m5EcSpgUIGTceIgghHtnDDGkh9mJUPLDNcn1/KWIQkBIklPGXcyu4kyeOW7N1RiCgk0cRi2TytduYqI5yx9PWGJc8z9n46DQA1DfapPya20iGhq4Pz3ccCyNwRGGWdCCwDQ4/MvI4X6fCB3VdudfGRFPxh92RPgn8rd8h5l0pBE1HzhibQvcLqv0UQcWQux7gJ3E8Ig1473DX7FRzRIwc82kA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Dg05Ls94yjgWfK0ByAYBc5m6CxZC5mexyWzJGmJTS00=; b=bf7Ws8lE8aPSgxNzuJkvTb+sjljfXOwaarj/JeunOdt+nza58xaeN35pqs2PdIAZZiMpkubjM02B9UI6FnHyUO3Fh2brpgJIQa8vtWkzLfP1vKT+Jgth+H6fUfzWx8tzCrzov/4jx3GJRxo/IJUX+k2RuueuX8s+8xi0eoTAwTRueJoTBAYa3OoO64bWdkbjENS7/v/JUiJ3xha/ckJ6uxhSIvlO64Nx7/1lT45sUVwzK+5Jv/ycAWIwWh4wgw8cnmXwE8a1S8bjfPLmrE96B0ihqnAwtyD3PRLnLALk3aJHzEb9LrkgdpIBoPxTbOWexhcF6C2A0vTHmJEutGTKgw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:22 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:22 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 07/20] git-p4: sort and de-duplcate pylint disable list Date: Wed, 12 Jan 2022 13:46:22 +0000 Message-Id: <20220112134635.177877-8-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bbcd5736-8e86-4a72-c4fc-08d9d5d20f05 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8kmGVeBawEmCfbXcQbw1OfSmxgwcywwTKvKeEAoIAvqzdT1MWPnu/dVDBhKNM6LoTQX8OOcd7XfYZzzXcK8rePP+WWct5PYpyoPEh5gMPINVZ46HIclg7Knbe0s/pHB9SJXYEFPNpI0J9mCox2/PnCQK6XkebaMi5Nnp3RV7RmhDKDHzZxmBZVSvdi+HWyL6ERYzYS22p4Kg3c2huTVcE/FSIPQ6nR2hmzRRLBocQuchZ3AxRFGszbRrkK2QVIzcScYvxmjGpSCflzec8VSu36Q2/3n2LLsqGw5U6pUnQMXKNN6pQlTrHhrSqeCQ1y1BYb0GXtMB6MJX1zEKMSH90h2bHk1k1ZnvbW3XIWb2yXOwuoJZI8qUj1Vb2+8eIcCZ0Z6UM0V91VUE6ABjOv0yH+M+ABwj0pq1wGM1kIKwzKts0gazH7//bz+x2YH7vgoGcrwiPwLgSdKWwMGLesVKFfTPzfRFvMLeCaqFwM+19YD9ezXDJ63KrOlqtXtmmuduBBKQhBVaB8rYpGw1vGnsFThGiUNFPaqXCtUg2DUSXRl4+tn30obvyjv4CfETT1fkWxBnLUke7qYDVhjnk6Oif6PYxrNfssRfliq2ybIXETM0MYW08XMBeeubWuBfIaVUHsuUSkTlYEN1IcKKcs1rnil2HBLWLUUNhnRhvRjVuc2Jx9rzIEjgiTFGV4E5TL9hO+KEdgcoeonzBPBCqP0j2sNOVi77LE8EgyGPiwPPSJ2i6zSpOo6mMSy34Dye/2/z/28ma3ZnoYv/muqsgg7/gA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(15188155005)(6512007)(16799955002)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8yks1AR0UVlrBP25nB10HNrrT+Ex6NqRhiHN/gUzqE7ZTarupVqeea5xeEjS4pghxN0IRFhf8Tm89zVzIqRZD3ErC1VaA++ZVyWLcH2UzSlbyH0FKjm0D0pLBKhYaAuLkGTv5uURNDoHw10c38rElJh80GC6mKlLT8GpREgvE0PJN3wBOuVNH5RyDefWTNTNmIU8/nVvHgzsj58uhO/vNgcKkb3PPn2ZAAwMgfFTap7FsAi8C2nLHj/Hq+4qQM9ua4Y5wqngbNPInnXxtWFBIOr//qEOI4bFM4jcEjfPGdKU4AtxY/+V9CXdyHyouSirFkQDBtihwYAEkxD+mUG8PisK7L+Kf7nmHOdKAvdTjjyrPlB2oydOXTPx8KSNfSRQvfdsm7z8znEuJwJ5Oj82SscErXuMNS6bhF+TTnNpG/C2PCOpp49+R677Afv5lQS/AVTY+Eem6Pzzi5R3eDulLGQaoE6UjFnCDEXb3C+Gtrf+Ad1vMK802q/1PpYoSzHVt9z4OCJe49bY5MKWArtyxxGHOh2QkNElfE1y0Spu+DiRDuq7L3VeY1ZqFH6oJvVtBKA4VULRbBr+VMv8Wmcgo6z3dIM8Z88X1HpV8LCDtzCfYMXWwh002zNk1omHxPQGmCDURKW9yyYRZfz4uLVhm+xCUHIqjKPPgIWLUrzGdCf+PY2lUJ8zAY6GlsuqP3iwsM1akvR+EUSxly9F48a+KNPRNKSriDLQXY2HQdgJH3i87AItVaU8qztZT4k69Rovcsa9f+s96BQf42WBMcZpDV5R2UXnvquTar5d+ADWYPys9r6GWSXImYeQg52zEQCVWcnHasuxvJF17IzcxkNmKPZpRg60ATCH9eXVgwydGiKFyqWhdrYAyQHAnSd69q+ElDwbdAYE3i3d5F94se94JBFn/qClDWq8AetpiG14+oww1FVN8wOLPkz6YT5C96Snqe3NKIGU3cavEZkEuZ/xOV+z8Qlj47IX1isv+WCD4Azp/BcpNZAA9RShhGfB75GSfGBIGFKGQFkKAH5Kkfid8kDrRr1hKCzP1G1vCrq1FDnXmelIRKGL/1fC7A8PBUnUxhsLgapg/ru0XLMfyBG0l9SPbBH3+7gC+pqaerTSGthtRxGt9dj0Yxln/HdjgK4858PvwbQXBwtO9dSLVpP4yvIDC6mQx2SvSm+KaVfuP942DJOPbXnY+Fb0489G0bUJrv/ve+TJ4x2NuXEk12q7AOIoqq55eam+t6pF/9y3cPq3GsuV0FHiwxBkhXww1zCSqM90CkqYA+8RqF7EAu2t1pGQRygPMepeW6GylTVXL9myH5az8w4RJRwIEFesvbB0W+h6pIJfOeLp+YxpvVYquTZxgBKZ9Pa9Ft3PAOgNTYtvqoe0XNmupZLnsgta0+XI3zYOHTXt5PJ6CSYDigwsmQDSogvLV8ffEgjHBg5JikFUmE1PvCGMdA2pEQ08Z64q05phmjyzsHseEcmKpLBr2JQeCeFHRLE9ZPMBx4RJUjXQWBLPPXZEi1qb8FOvhFvt70QVXV2Egl/v1z37ys2AQaV3ZWZ2sFQs+7lhnmdnvTy+WPE1gFsaehvTi3A19u3YzGFloeKjsRy/BkfmNmYQo2aab0blDGoUq9FuxpfLN/Y= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: bbcd5736-8e86-4a72-c4fc-08d9d5d20f05 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:22.3238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PkV90PMqjL0UWU1sfT8I50Cll4dMebaE6YICXRG8Oq4bWdO0vCv43WUVP0xBIglGcs8jQFHghaivVCD1amWNdg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org git-p4 contains configuration commands for pylint embedded in the header comment. Previously, these were combined onto single lines and not alphabetically sorted. This patch breaks each disable command onto a separate line to give cleaner diffs, removed duplicate entries, and sorts the list alphabetically. Signed-off-by: Joel Holdsworth --- git-p4.py | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/git-p4.py b/git-p4.py index ad385d6919..2f05ec10ca 100755 --- a/git-p4.py +++ b/git-p4.py @@ -7,13 +7,28 @@ # 2007 Trolltech ASA # License: MIT # -# pylint: disable=invalid-name,missing-docstring,too-many-arguments,broad-except -# pylint: disable=no-self-use,wrong-import-position,consider-iterating-dictionary -# pylint: disable=wrong-import-order,unused-import,too-few-public-methods -# pylint: disable=too-many-lines,ungrouped-imports,fixme,too-many-locals -# pylint: disable=line-too-long,bad-whitespace,superfluous-parens -# pylint: disable=too-many-statements,too-many-instance-attributes -# pylint: disable=too-many-branches,too-many-nested-blocks +# pylint: disable=bad-whitespace +# pylint: disable=broad-except +# pylint: disable=consider-iterating-dictionary +# pylint: disable=disable +# pylint: disable=fixme +# pylint: disable=invalid-name +# pylint: disable=line-too-long +# pylint: disable=missing-docstring +# pylint: disable=no-self-use +# pylint: disable=superfluous-parens +# pylint: disable=too-few-public-methods +# pylint: disable=too-many-arguments +# pylint: disable=too-many-branches +# pylint: disable=too-many-instance-attributes +# pylint: disable=too-many-lines +# pylint: disable=too-many-locals +# pylint: disable=too-many-nested-blocks +# pylint: disable=too-many-statements +# pylint: disable=ungrouped-imports +# pylint: disable=unused-import +# pylint: disable=wrong-import-order +# pylint: disable=wrong-import-position # import sys if sys.version_info.major < 3 and sys.version_info.minor < 7: From patchwork Wed Jan 12 13:46:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F171AC433EF for ; Wed, 12 Jan 2022 13:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353715AbiALNsF (ORCPT ); Wed, 12 Jan 2022 08:48:05 -0500 Received: from mail-dm6nam12on2043.outbound.protection.outlook.com ([40.107.243.43]:61056 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353714AbiALNrg (ORCPT ); Wed, 12 Jan 2022 08:47:36 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ihxMWZNKVvzH61yJJsXRcxCh0gtHNAIXT0SP/ZSg0+ju+KRfJ6JIBzP1fONtYIi4ajy+oW4d4F9iZaOFKM7mx5Ab4/hLhoqGWxX91yd72L5RrLuoEoxYVjzUHkPBbL/f8L6m3Xispau7i4lwPbOl7p5xVxQ1HT6NU7W540W7FKLhvluJIYnq2cUaW1PqCqtabR4iZ9PxYBfLX0Q+KV10uAMJVLscIgK7Ev2X21APwXqb08gxubImSlUtmSs/tWSAEq0m3Xu38VeAk1DTygYPG0x+LCsKGwQUY4JQ9vzJeyKxXhJ4/ixzkSyMTME+otoyZL5JAOO23MfAD+Q0Wr2QqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8du1CFglnpG9HTACMEmF3YVp8Irz4r75xEqFeCrwUmI=; b=l7f/zdcj+Q9zsigPxo58uASQTnpUeBlawTcXq2M3fcuTVH+7wLuY9Gvd6v5mgfNoCVeqQ6stlzqC/+YlWLiH04wCU+JwVl3SnGrCFDzi03HvJWQ6xI29EBt+InlaqhBG1xIz0cdsnbX4cE6rIpfjOASFWKTEjYXPnotJ8yhh+AKYyuxjZHwEn1qd6tBPzqCCAIsu3rN/XUdwuYFn4P8rB1NBGwp+3/m9KLkpuBpv9XTACbrdzmz2OMzfs37kk8CubQOZYJkhAKx0snQCElP82XupTzcw61RLiFHEPlI/5ADPIxd41sqvF2R5rbt1ocsSp3l33db54h6OT0++rARhVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8du1CFglnpG9HTACMEmF3YVp8Irz4r75xEqFeCrwUmI=; b=JNauHQfNEt7bHK0ZiR2/812Svve+dOQlKooXO22Tq5AhjwSXY4NrA9CMnevXZXqB3Xnr4eLs9o8sXlNi4RAEDyRUYiySwyrgobVJL8dwCdei9sA+QhRoJIbOe5CMozlBW15p24xXNjsbbgGdS1fLdrXpgl12GfkV4sodhRU6xOcYbH1jLtvcRiqf/sr0xG2kFZmcAzUqaNcocKj2GgKzdRphQB2B7Ru1eZpzZdsl5ZMXvpzdZ6nhNJUWwU7oFJHONmhqyFrJ0JZUbgVszNk8TZ/8tzXlekzmX73dduYuv0S+sIqMceiJW8gRoIQYyhMYs1duTzNtxjohKSocNi8vVw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:24 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:24 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 08/20] git-p4: remove padding from lists, tuples and function arguments Date: Wed, 12 Jan 2022 13:46:23 +0000 Message-Id: <20220112134635.177877-9-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: afb5e91c-59a6-4bd4-eeed-08d9d5d2104e X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1265; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KsRl8ENVAYdRcQO+zMUlvWkl3/Ew6KQ0eJO9GyneJ/k+PZiDcFxX/FtCd+4+xAiCk9vkZGrxM5tn+nKraQvGo6hyOREllrzdlFfFhZ/DfUnBQaHu+Pc5wl5tW3uZkn2rZhyXldrzFLWSEoFEoKJvCikrRhlOHbNlHWZNI6Iy1hTAlS28UKKsiDf3Sb+YRc2xqgDR9hwDdC1ELXcSdgZB3VVs6ENDAOYu9nVSfs9jqnpdBG8N2R7jQgNRM1hpAW8QBu2rrq+40wxmflFZX4YUZKAi0kBebqlqGdt7AWws/mkEReqdTTDTYYMUnlsLBafT+rVO66IQLobC9ap5n2sgMZDw5A0nKoMP5aBmr4l3TIRJRb3MGxX+5CmJd6XRZQlg22KeCW04An4ieZh8g8jwFbXqAdyLw7S+x7+i8Ol88AhQTrv/GWgpLXlCO/0y1Dw3UtcybJNvj79UKwUTO4Le49A6P9Av4WAkHvp/iAqoCAnyRdcfFYLgulvHq3u6kqgqfI78//5glA18vFuZwdAHMktizV5TuOgyI0kpe1r2kWvi2hETIdL31eFaC7fH0EE4DsLkMILAWOC2IpXpVpxA2urfhTuEbuAR0rvGiLD+/HEmYAyUj7u/pzIE15aZZTR5o5yi+Zg5mih2bpkLs5+Qh/NgEzbBbfhVlmWyHk1CRty9at5/kwKCH2iXcqcmcZBToDye9OphogG570F/LJ5qdvYM5hgToUZG184kjRVeyyRmAu1undxiu81v16SZWUJdko3vV2xoKkMzCn3oHSlC1QOMvUr0IQT2DveHuI6DOLs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(19627235002)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2yS6/bEH6MWnruz7ZMFfyoF6jjopQd0oYtMOSY96dz5q9Gk0/WjVh5DYFj4iERhRyqO9LBmZEOE6Nqs1OoF9Lhr5rHzTN//9if1eR0AKB6tTzdXLtk0DlXekEKhmqw3blx2r1dHWhNovqSjepQlVUi/lv+3R5bzZcNmv1MAK9e4oRjzD8flkyTJKT2fuqrAEaMj3ouf8q+PBngByydM0BfcQDY9/S/fqQwk2yL0b3AFA3tzcxUO0whdwX/hkugEVJGzIecx3iIkxtZbr5ul8rH44q3abkIDDtR2l9CYS3itq8BCqpJgxStfcrLuWE7PaAYeZGZW8OnN8z7PpmG2Gu1DE+NLcVd1RtXTIVUEtFUaFEJDsGG+lF5lvhcxKcFRqn1YQ0HIZdnaddMEJ2LuyY+RWTUCvqyLI2veGa1gU5wsCESw5a3mJIy+eCOJMRyFkynrZ+z+nka4AY56Udwjae8q/i6d1+7xiwH85t6SVioUWUUiORU9gV7nLhIEfGT9t87ZpjiwetY4cj8XGNKdptkn9Rjhm3nH19puTDok2vdoQGz0GyH9o6HGs7HjYN016C6iqsrihDVulro7QlkEVaOTn6vfK3KBesfKAUy9nUXEjaJke+RB+R7JOekkkIIgzBGE2SVu7P4JY3RrNAaW+sDawwBPer44WECECAqA9u+dOWjqNsZ7EYHX48nq1na4TAwxofNYR7a+U6cJl3GHeOigwyOz19s0jtEJOzaLpnx51Dzap3300iwJZOl+gzvgizQqhXzY4OiN0i//b+vYEibL7CtAOkU+h45+SD19Oz/z1FrOt5gMDFij+a7+QdBvjdPPhOMuNL8tzttaDJl4HteWGrq085LnOH2rfmuqmEZmRbxHhREnZfqh164knwAwsA2akGFQxcYXyAxBaT5x1oOYUPhjeWo8ZY0F+clmiEKHcPgDE9tAbT5wGMH8npEJ9U45O/9eCSwysSmSix/AChDOMbk/s4BiliVtiu3tfwz6lnYG+BlX8xH7WH+UA8mkNMOmCqa9tZjCB3/dcy4n/GY5VYvus7l+Qz5vHiEi42Kk3GFJ0G0IfAiQWST/bJi/0OFxFM/Pp+6wLUbpP4C4ctnJcDllwJSoRdU/axn9/jABh8HD1+bvR6YOaEyaN7kzYlt6c1MxljDCGoguVM9/M6rFTLhmumBEDRVUkVPCFrypI0I5LHhH+9XBLGRKUIqFR3l/RztgFjgKRwlSZxDYP9haAcHmUwvKXuPj3+NNu8qon0Fme1ZkDg0z1jYtOJPqhhCjxNJyjquBCSKiJ/QeO1WcU4S+Z6YJHaeGDi7cFpIkoXQDosFoq81fep71QqhByxTE6YvV/WwOER5j7aIy0LTtiVh+fL9D2o+Y6gEMHJRqGq73W1HXSPaWDqtgYikv8sG49TGlvvTKDzuAS2nE2f/bAmuw3YfeTJhsRdWj0KZa2qEl7tzAEEOspLfFs42NdDq8DwAsrCJHTycD5EZGQkL7C++hcbjPA5FOG2ijP1FPmbj2NB91WSGjHO+Qz/VruE1dFiEYzowR8dONRZX9h2UxlvOR23/Ns/HQ9FfT5Drk4mA92YtVqRvpfxmWtSCtgG+zrugBHtDJVdl+IbD2SBv42QgWO30IZfTUIX5Lb3fI= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: afb5e91c-59a6-4bd4-eeed-08d9d5d2104e X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:24.4654 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lO2qD1QPS+hLvnQ7JJLylh6L5PCRdCYby22CnJ6iAtzTWfLQRBa/dOa9W9ot73RI7+SdE00hwpmRtiWI+5S0gA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 discourages use of extraneous padding inside any parenthesis, brackets or braces in the "Pet Peeves" section: https://www.python.org/dev/peps/pep-0008/#pet-peeves This patch removes all cases of these. Signed-off-by: Joel Holdsworth --- git-p4.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/git-p4.py b/git-p4.py index 2f05ec10ca..39c1fb7d4c 100755 --- a/git-p4.py +++ b/git-p4.py @@ -1025,10 +1025,10 @@ def gitDeleteRef(ref): def gitConfig(key, typeSpecifier=None): if key not in _gitConfig: - cmd = [ "git", "config" ] + cmd = ["git", "config"] if typeSpecifier: - cmd += [ typeSpecifier ] - cmd += [ key ] + cmd += [typeSpecifier] + cmd += [key] s = read_pipe(cmd, ignore_error=True) _gitConfig[key] = s.strip() return _gitConfig[key] @@ -1047,7 +1047,7 @@ def gitConfigBool(key): def gitConfigInt(key): if key not in _gitConfig: - cmd = [ "git", "config", "--int", key ] + cmd = ["git", "config", "--int", key] s = read_pipe(cmd, ignore_error=True) v = s.strip() try: @@ -1103,7 +1103,7 @@ def p4BranchesInGit(branchesAreInRemotes=True): def branch_exists(branch): """Make sure that the given ref name really exists.""" - cmd = [ "git", "rev-parse", "--symbolic", "--verify", branch ] + cmd = ["git", "rev-parse", "--symbolic", "--verify", branch] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, _ = p.communicate() out = decode_text_stream(out) @@ -1319,7 +1319,7 @@ def getClientSpec(): client_name = entry["Client"] # just the keys that start with "View" - view_keys = [ k for k in entry.keys() if k.startswith("View") ] + view_keys = [k for k in entry.keys() if k.startswith("View")] # hold this new View view = View(client_name) @@ -1585,8 +1585,8 @@ def processContent(self, git_mode, relPath, contents): class Command: - delete_actions = ( "delete", "move/delete", "purge" ) - add_actions = ( "add", "branch", "move/add" ) + delete_actions = ("delete", "move/delete", "purge") + add_actions = ("add", "branch", "move/add") def __init__(self): self.usage = "usage: %prog [options]" @@ -2593,7 +2593,7 @@ def run(self, args): sys.exit(1) except Exception as e: print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nThe hook failed "\ - "with the error '{0}'".format(e.message) ) + "with the error '{0}'".format(e.message)) sys.exit(1) # @@ -2798,7 +2798,7 @@ def map_in_client(self, depot_path): if depot_path in self.client_spec_path_cache: return self.client_spec_path_cache[depot_path] - die( "Error: %s is not found in client spec path" % depot_path ) + die("Error: %s is not found in client spec path" % depot_path) return "" @@ -3093,7 +3093,7 @@ def streamOneP4File(self, file, contents): else: if p4_version_string().find('/NT') >= 0: text = text.replace(b'\r\n', b'\n') - contents = [ text ] + contents = [text] if type_base == "apple": # Apple filetype files will be streamed as a concatenation of @@ -3717,7 +3717,7 @@ def importChanges(self, changes, origin_revision=0): for branch in branches.keys(): ## HACK --hwn branchPrefix = self.depotPaths[0] + branch + "/" - self.branchPrefixes = [ branchPrefix ] + self.branchPrefixes = [branchPrefix] parent = "" @@ -3825,7 +3825,7 @@ def importHeadRevision(self, revision): if info["action"] in self.delete_actions: continue - for prop in ["depotFile", "rev", "action", "type" ]: + for prop in ["depotFile", "rev", "action", "type"]: details["%s%s" % (prop, fileCnt)] = info[prop] fileCnt = fileCnt + 1 @@ -3978,7 +3978,7 @@ def run(self, args): if branch_arg_given: short = self.branch.split("/")[-1] if short in branches: - self.p4BranchesInGit = [ short ] + self.p4BranchesInGit = [short] else: self.p4BranchesInGit = branches.keys() @@ -4259,7 +4259,7 @@ def run(self, args): os.makedirs(self.cloneDestination) chdir(self.cloneDestination) - init_cmd = [ "git", "init" ] + init_cmd = ["git", "init"] if self.cloneBare: init_cmd.append("--bare") retcode = subprocess.call(init_cmd) @@ -4271,9 +4271,9 @@ def run(self, args): # create a master branch and check out a work tree if gitBranchExists(self.branch): - system([ "git", "branch", currentGitBranch(), self.branch ]) + system(["git", "branch", currentGitBranch(), self.branch]) if not self.cloneBare: - system([ "git", "checkout", "-f" ]) + system(["git", "checkout", "-f"]) else: print('Not checking out any branch, use ' \ '"git checkout -q -b master "') @@ -4404,7 +4404,7 @@ def run(self, args): class P4Branches(Command): def __init__(self): Command.__init__(self) - self.options = [ ] + self.options = [] self.description = ("Shows the git branches that hold imports and their " + "corresponding perforce depot paths") self.verbose = False From patchwork Wed Jan 12 13:46:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711410 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 223FFC433F5 for ; Wed, 12 Jan 2022 13:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353741AbiALNr5 (ORCPT ); Wed, 12 Jan 2022 08:47:57 -0500 Received: from mail-dm6nam10on2057.outbound.protection.outlook.com ([40.107.93.57]:44001 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353708AbiALNr2 (ORCPT ); Wed, 12 Jan 2022 08:47:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BVM5og8XT3NT+/3vqXhpJcYb/FiMU2wKFS/tf8xPO1zUmle0s5lHvMMpa421DuotROws1vfuBWYq2isj0y/+PPU5ryz8f4xwSqZuA0pf7D/pT3AlGU4qLrUjSmtiZ9P++aMGY3uQ6By0tKCklRd+kRXCt97LQgfPmdDhI+HpAMPU0WEIvSMSYSAPZDb2o6rcjPmHSuqbLA6hqLGci5yTk4HHXZvG1dLVah2AnSrVX4VeWkQMt27d5KY6haVTPaUODhYRrA/zI32GkYn+7LY0QcyNPIZb2dyuSOhSck/O/IcLMGl9akXZMnr9bcQqXBaWZipsR7QnCIlLopaThdhXZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SJEnspccawyOVQV3jwqKRJ3hhQU8kVH/zT6Y0X/O8iM=; b=Xwso6nONq0Wn93D7HSsGjNlw8ZQ9irE3xwpcciNCiuOpPCM8obdgmIKsG0jxcFoLXQeRT8UHWRbVwp+vQHXTwzhC14OUJeJMjKExUiURnJk4VmmYEV01imLLdA+nnjsxhSL6O5dW+d3LKoaqJHUr1ou64P2D0PXT+9u+i/32XNSamfNKAl+8su0a/t1s5eZRrtB8TADkUmWvQ3DZD09MzYCfsP6MZsbUZogBoJfzYtF/ZcCJfALU17dzo1a/kauLWcAArklh8AU8YGI1eA1pyyxqLbhjZPyfuOzL2n9aXYE9Fh0EEDwlp26xBHCdOUmOcki6Thtk+/LmZ3Yk2VkpWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SJEnspccawyOVQV3jwqKRJ3hhQU8kVH/zT6Y0X/O8iM=; b=DuWJiq6AtXDvCWK4pBOy/wgiRURQYu1WKNivxaEbS1QlNdxhJV+v9QIMTYIVphX1omrV7liUeSVeyyCvBicx38tbnAukv3SxfsIJjRpEPMYKQFnMG1QdsptE1uwLZtGfQhA62YLwkbHa+u9H8Z29KbG64vGou8LGYzs6Lw5mLFdYUZ1Cqos82hNJuMYIfw3yVrYyu/in7hsPRoHA0JtQcgpAnt5HtpNKLa8ISdyqM0JQ597WxKtd/3MPMI0i4YNcgrKiIoeluYIYL1WIKka0Bl7ACCigqjNSPxHoUd9h66R+qAArE00uOOsPss+AKiE2I3/F3+j+SsDodQaIfh33NA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by MN2PR12MB3693.namprd12.prod.outlook.com (2603:10b6:208:159::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Wed, 12 Jan 2022 13:47:26 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:26 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 09/20] git-p4: remove spaces around default arguments Date: Wed, 12 Jan 2022 13:46:24 +0000 Message-Id: <20220112134635.177877-10-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 636aa3f0-6afb-42d0-4cc9-08d9d5d21193 X-MS-TrafficTypeDiagnostic: MN2PR12MB3693:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:158; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F/+duNyS8Mu81EPdxJb68gFvHeN+7GtAWkFGc+lg+ZePCBvTlJvFUVJlNodhc2T0KDsRL0KTOVINC0f4IozZW9ymqwPP7DPAJLiM0zpIJlxJDJdkP1dQwOlOvLccZw4d6AerS+Ro8AjlK3muAWUkyUKrCvpCpaWL+yhQsM+taa5rlnOSrDSKGYuKPTtUi7AnOvmluxDOF2U7wnWvgyoyzloxh+WQGF5JFhsleLea6tdPGt5BgWChAfPs+Ga0FYXtGLwCm/TrHFWNrY/JvetHL1KV2tTfrABpOFfEPvgodacza1NTnRRk6n04mIKXzDUGv0BymnTanPcrhR11hQDQ3jYlLzmsa1xVxdH894MYroR/ctPJdnT2EdVfgdmN2cORDokyfJJQVsfVqDprFbLfDIebK4JTQDcrjbwOwC9JNWg0PN7/+m0hF1ZByepBN4rKKkhlDIzkrIbC7+Ne6ZDLPGUEJPTEIo0Bx1Q7ydIm55OHYE80TbNEi2rsml7sb2VzLoRykKG9iOk46KmAres8L4P3MkUX3dCiKzI9bmAC9fks6Ny1J9QAxplk28Sjr4LcK2vFKi7UDWoW5t8JLIyNa9+UTOnUuziU4yfPkSkB7qB9orDqC1t49h8NmqTkVb+WC+F0sNugxe3GJvGZhEIiP4EfgHXD0tYcVOEfNg2GSbzFhx92SktAfBKAv57wv+CFwAoxJMfjPmLH6p0sK0vX3GSBBtVH4h6TJWd4z2t3fZ8rlu0JNrc6aaqZd66LYBgCJdsCqjaCg3sEieqftVjzj4SCIJJGqevb6GbscPRUPgE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(1076003)(508600001)(7416002)(8676002)(107886003)(8936002)(4326008)(86362001)(966005)(2616005)(186003)(6486002)(66946007)(66476007)(66556008)(110136005)(52116002)(38100700002)(38350700002)(6512007)(26005)(54906003)(316002)(83380400001)(6506007)(2906002)(36756003)(5660300002)(55236004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8WFj5Dca2cwN0EwXTDjyKzNnSXVLuhasGAcqoGphN3Gs/jE4VuuDIvsjHCdhkDQ62HDjDouDpoAu72MPhYZXEqu4Qdnfd7ddq3wgdB7d7pIhlkOhsQKDFS511tw3sONjoLpk+amsuyUnAV/5yBI8m0w+1mfmCHa3rM4lJ7UvWZ7E/HcPUQfj/A0Wf4MwXXF0qViNUJBHMqwFvJp0Bdcz+9xtKlwR8k23mUk4Q95faPw1HLS648c3PrSKioKrMXflgn3SDrYcmX00up1z7LDt5yzGZnpVQFWjLTvsolQSOzFnZ98eG+gA1XJ4OPChQxN1OADjLvlrR5aMgGLAu6vv3BWRyL43obkTcQ11bsC8pm51p6honwmI5CuOFGhkGH1Bmpw0qYGomjVHmZ0cTjEf38f4v6Gj0P8kCh45sKzMPClCSGbKAciS34vBs9L52Sj4py4wiW1Mtuzg6q0WXbv6pcuwR5lrPozNLkk37TgQEGYqe6Ad+69HMqyTNau2NIUle0XPcBl6eN4qmdB8wxzH0wRF0XsoDRt7CHpWdZnWSA8rR2PkglRhqhcYewgvKTUwNr64Nj+coyb7Gv7WwtxO1UgEAIdF6UvmCA4GdSfbxPOynnOODPdgxPh3q+bfIG9Aow5IbjktWCX5Dg1hOhuszFNmSJFWa7h4Mg0k3v9TbB+uGANug6XJRknpCatzsWzyWX5AzezmTGm5HsBiTnj92hwDze2z8Ink5+883OIo0gHmVYRlu1scnFz53C4GMIkDcc+vPhG2Qskdtqwcmj8LbTuE7ApSV5HK0viNUlMaiirdmHEG22PsyM4CcDIFlmtQmiUjm46wJ26DM6CuVfih/2OCs8bIixCbSGv6WIEZRoHbPEeG2gEkCkqVD9POB5QdnzIxEGIPZgJ7fVTAl34HfyYs09hgdLclJXiyvD+IuW5DXYB0mmuU2EqowaXeAxu9yZSL9W2v63PKag+xpbGFadiOSHupd8h2uBtxQQoBLwNyHpekVT6sDkRKQfjpsUlmYcQNQ/aeZeimOGgtCm6bVb9IKfhfQugEIMuHkkNASyhIpiN+bH8FG/xauo4GsiMd3F0mPf5WRVvlDT3VIjfVP+tf4D3iCECwBPjin076VhEC3gx2pdHoHtbZKex3tfc6bJnfr2znoz8pBPjfOxwUZlgLIKCaMNYvzfXqDNHwDelgXfCG9KcRZJyzmyyx3rxZMODZ5w0Jo/N8mXfB20OeMZtaFR65YqqLB1I0hVgd+7MXmmO7ckF7oj1CbzSxGplQNMxpXNhHTigQx16kpClzo2VpePIhkvhFOMH/GyCCYy1GPoeAugQhU0ifLBEaod7Av3G0/IUfiQkfyypbO146/qKN/vsPkbN8dD/ZNMUgqFXNeyoXj3ot3GtlOnX/1KZy2f9Ih5V8/NmB0REm3hDmiTqTA3x4TI0CAuePqjBX2Ag9mO6dR5fu0owHOZxh1DqisUJeFm/OU9nXKd649n+ruKo94gPfPwICP1emulrD2MjBLDcgrYgF+iLhQHPSxqFNITGKhVBh8VLKxClFs4wC1k/eZM56UL1vCLlU7TSM334sCCjtAxzZxjJ00G3H9Ht6AOB/YYTP/Zh7ojeJDijSflwbALne3byEraxlLX69U+c= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 636aa3f0-6afb-42d0-4cc9-08d9d5d21193 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:26.5131 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GcfXel5BMonf2PzL+N5ammtYkdIw1hCAHeHax8iDTVoOgrV/zQHyzuVIcBnN7pEu5Lup1+wCWbCJtZsQ1Auubg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3693 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that there should be no spaces around the = sign of default argument values of functions. This guideline is described here: https://www.python.org/dev/peps/pep-0008/#other-recommendations Signed-off-by: Joel Holdsworth --- git-p4.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/git-p4.py b/git-p4.py index 39c1fb7d4c..c6201b8d23 100755 --- a/git-p4.py +++ b/git-p4.py @@ -1113,7 +1113,7 @@ def branch_exists(branch): return out.rstrip() == branch -def findUpstreamBranchPoint(head = "HEAD"): +def findUpstreamBranchPoint(head="HEAD"): branches = p4BranchesInGit() # map from depot-path to branch name branchByDepotPath = {} @@ -1141,7 +1141,7 @@ def findUpstreamBranchPoint(head = "HEAD"): return ["", settings] -def createOrUpdateBranchesFromOrigin(localRefPrefix = "refs/remotes/p4/", silent=True): +def createOrUpdateBranchesFromOrigin(localRefPrefix="refs/remotes/p4/", silent=True): if not silent: print("Creating/updating branch(es) in %s based on origin branch(es)" % localRefPrefix) @@ -2910,7 +2910,7 @@ def isPathWanted(self, path): return True return False - def extractFilesFromCommit(self, commit, shelved=False, shelved_cl = 0): + def extractFilesFromCommit(self, commit, shelved=False, shelved_cl=0): files = [] fnum = 0 while "depotFile%s" % fnum in commit: @@ -3338,7 +3338,7 @@ def findShadowedFiles(self, files, change): 'rev': record['headRev'], 'type': record['headType']}) - def commit(self, details, files, branch, parent = "", allow_empty=False): + def commit(self, details, files, branch, parent="", allow_empty=False): epoch = details["time"] author = details["user"] jobs = self.extractJobsFromCommit(details) @@ -4487,8 +4487,8 @@ def main(): parser = optparse.OptionParser(cmd.usage.replace("%prog", "%prog " + cmdName), options, - description = cmd.description, - formatter = HelpFormatter()) + description=cmd.description, + formatter=HelpFormatter()) try: (cmd, args) = parser.parse_args(sys.argv[2:], cmd) From patchwork Wed Jan 12 13:46:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADCD1C433EF for ; Wed, 12 Jan 2022 13:49:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353732AbiALNtU (ORCPT ); Wed, 12 Jan 2022 08:49:20 -0500 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:20961 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241069AbiALNrx (ORCPT ); Wed, 12 Jan 2022 08:47:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aF52WuEZMms5g0XkkUxx1mEHOzgRqfJZID6vR1JG7WSy/0eGJh7f0ovelkUqOAdebPL8v9u8XCgyxqggaVuv6g8S27NTND+lFzivkBG9CCc9CW8mPXSpKSOCZWL1NxdrC96TfuqBB4O4uaiRaC+ENGqo+jAWXq4cTp9rZpxeUNpavk8sXd67HvuJsSanHugZvFePUUBo2b2VEUM1fZjpv+QnLzcmBDYw4pNepHK90jYeNF8qQPALSL1NX0nGoON++6OmvigUtlyl73yQBjpRgeFsTomYA9pnUEzh7xcoikunMkWf7W5yS85YtSSFDajkQmMovqNmhjhWdyQK9/VzYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=y8oX9VPQP4nkilu5Xe71CHGtDr9Oe3Fov1+yfGiQ16o=; b=B1lXq8cldj0ZMgRKeB79WsTVNj6jrl3s/EgwYYh6Y8Wb6sQQwjTbAMvIiV2xLygRsEjdUh25vdilAGE0SkafnXUs3EYRsJFoNuc6CowIrBfHCBDz+J9zVZuF03gbJJjNQuhMIGcqzohOc0W6108I/RGUyilPXxtfqwBLAUh7k/djS/Dhq3yNopX+IqkozAO3nlWIIch+mjlNEdC/hHI6Zg6VZ+QGqhf9O4sjfieka/KQ5WAeRrBNOQoP4rOoWMLoxmuStjjMUMTzDFHpguMmEq4fh9nYUHOgWIoMHr3Wv1L3uXNPLfxDJefo3w0XdObJ5LlLUN1s7LmUWWGvU3Sm4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y8oX9VPQP4nkilu5Xe71CHGtDr9Oe3Fov1+yfGiQ16o=; b=HyHIQ3zFXfqt+KBc+CbsNKCBaYCD5nTshUpF6f10eEv5j5LHa94eHUbpvUX3Tbk0IBivt8Ti0ZQu1+OY4dtkurGZCBgbKFJnmsftqZldPS1mYTAqXzTkB0Pipo5EM4rGcKMYyq/4UMul42J8IH8GzIxq1oP+1MteF7T3gAOFTYWBCyyw9ip7pdnLcASShkWe3Kc5yIg9AbmP2fPOC9LSgoKu6QImWZFvJLL9filWH07tJhASANml/E1g8MJLAP+J12WuqCmy9rsEUk104iRueJjiiYDsYbJ53eLpdJPv61Wa01fe8xwWDA8Sc6IJKjfYG+uZsyQbO44jRyrhHjrSLQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:28 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:28 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 10/20] git-p4: place a single space after every comma Date: Wed, 12 Jan 2022 13:46:25 +0000 Message-Id: <20220112134635.177877-11-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 269d7701-7ad0-4cc4-4de1-08d9d5d212af X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:67; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9R93TdCHsbAldO9yb00sOCGLRjYDhyh2uxYXr5E7uk35LT8bRIWK7+AdnZN4pYKvbPuS8uBT+vw0GXeaidEwRoU6RhJrh0Ri6mocAAuq5Edr/W/Q7X384MvIBaWEgPlBiwk8xZ9x3f/HQD/LjEz+Y1iyigqWBy6cpSx2UJ9J42dS4cNxAZ5Bw9Q3LThgkG02iDzsxX1r2Beglt5xALTSOo4Qh52IE+AdA+oFJjADm4cefuVgajO3upZXddrtJTZuX+8MBTATCCVv2oYHQj2XhOG7C4fS7yLnrConT14rl/K0QLw92fV+kx7KsX4/6689t0+tvxUloyEJn7xUPXkTiS0IDaJHjGn7ZnKzbLKVvOEi00arYhMYDOvCEVM28FUzYMIERoDvyma5fnza1AEMjI0SFIDTiP8an48DLOI1n4Bb1m95iE+AqOxYFiWd0X7q7rB2o1l0GNxJFT9GMcuqaJa7mTL13yMuDD4Jg+8cD8W6sqYFJPQxVmz8YdG89VzM9HcTR7SHphnOtGraJTmLQA+BrQMCjqdWWMTB6iTBL8oFxGU2uOaR2aBmHlO6lrXV1VNINtwYAq+dXoeuJVcuJfSWMb3eSd7KOgSJ9G4eAfdgABhoKHGpFt/7c9ybuJ78xBrjjC0KS9JBs1NLuTsFmtF26DF8I0W6/AwoDZvSv2q3u1DxBZaHXF+7e7EqxLQuCzizco4DJkLPQCqWnGtRxg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SHRTTr0dAlpCrEuwrp8j/B1fuJEyQa253rXD2a2tXdVWxE+Xje5bkUte/aKBs8O7ViZroucOcDRhIf2jjbZ07AysPRzR/DLEYvM1LaOgPMhHqoCcXWskw+fHy/WZEAnpvMiRa0d7/X1sqUcbyrKGgnnDOMcsS5LS8N+e+jtWSk+cEmOPC6QXpwFshvJVC5H25NRg2Wa8UAKEhHaWA2cEy3ERbYy/mEZ6gR+xptBhCoDLs4mhCxjkX+tkIfxPFEBdLN0+fAs8ZiiodmHorp/dEY9PbjDo1KPG5/E1OBCx2tw1/xeO1weh7KnmRy77SadEPPEDoit1F4aAcdNlnA+M2Hi0z3Vr7IPZrsiH5QnOacMqhoFmsHmSwKTpBkOJYRTy6LZXEF0ClOYI8ggQKvE9sz6D4LzzFhBS2ePltp2tOYDzkZiQDjQI3SmK3r/CTdQFzyCpH+uS3g9XqStMAfV4AmTcu8lqfX5UP/XmfaRNpUIXWc1+AjKaTgUYTfEPbrYOB8zDJnd90sdhfjnEL6YXeBjX7hIw9XVpvusjnM5iKeryh99hlVo3fxjoVnj1RoLasK7g9bL4UC4LRGJ0t+5sbJRCuqr751Wwu3Lm+km3os8ThuxNZnFTl8Y2QTWcfuBDoLp9LRnKAqk+c2A7uiXOxNyGIhsYYZj4B4YglCs6XFRncXgzlvMLOIprf3LlOcIo7BQG3wkQadxJ3xweGak/eY5HFP3eBfCT24cS9c2/I59Wjjk3Emj1I5ZPY4MUYVdQ8REWAIZPSmz666qXnwlL0KJdfQLhaAFR3pTnUrfy1WJaDyXaibpzk++3dlgQdG41JpNQFXfY47jm8zGsAPxU/TYXtr3oEhAqwnV3UPnSCLMBdMqb7utrPqzamTqli2cxSqXsvWbjZ5KxQg6RzVymG1/QO+I0MDvE8Ny4lXnkdsWdkujTJfnIEQll5w6iGwmyoNIAKY4VejwqD3/5HT0UfGDZewjHy7+7bHjpPooj7Rjx64NAU5C7Qhl8XG3IXRVud4CtLdAC5KnoJ410ihgIHXvSnCgl4Z8GfSynq2myPC2Mo5q9FaHMCtdICS5HHIACP2GOCgWCy/F+9CUKkVxZZ2Y6txCElvmkt9F7gumzLEJHw+KsiXc1BNhFFqpwQXj0B0E6662PWZcKHenX+S7wItl3Nxy7OK/Ug/Be13w36IuEziSP+pFOa/ab+/7mvkcykUOdv0SG3ZX61CiQS/tGdfLgLrX/olJyMy55TthVvS35Kq6Skqx7DrpiErNh+YT2m8vQMU5ky+r2AkCGaNZcFhC8bO2UbZ2I/QikxFtULIZewezaKedcky3vXizpWtrgHdRB6/1FXWg4ZxgzTXJDxt21TiYoOSjADxb27zwJISiF/T1s5+4z+uRsgAht0FfsFfoPeaVayw9n78P/089bKLMIBQLrBzSjFXXLQiQJaRvcHJ79g5sEJX9iYaD5qJfcwqfJfNuCAUnRmM2m1GKQRPNJcZN0xXbSgH6bKj4kp+vUJMnw18YkRdAyD29PFfNZta2LNkHjimLR3+wl114PP+/v6NgJo0nS8WuHlmxNOduOFyPBJcjZ29tkzVHzSDE1c2r2xJeQE20xQ3TArs/cwGmvGn3bj/IqTVyXCj3QfRM= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 269d7701-7ad0-4cc4-4de1-08d9d5d212af X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:28.4681 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9aXddOz24sHXlIogMIN+jVKT99elww3ZrI9nqNcygvRpcYq9Qqjdc6ggDvnDSWpk3T4coK+WWk2LI7ryPeB7rQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This patch improves consistency across git-p4 by ensuring all command separated arguments to function invocations, tuples and lists are separated by commas with a single space following. Signed-off-by: Joel Holdsworth --- git-p4.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/git-p4.py b/git-p4.py index c6201b8d23..0e54be57b3 100755 --- a/git-p4.py +++ b/git-p4.py @@ -99,7 +99,7 @@ def p4_build_cmd(cmd): user = gitConfig("git-p4.user") if len(user) > 0: - real_cmd += ["-u",user] + real_cmd += ["-u", user] password = gitConfig("git-p4.password") if len(password) > 0: @@ -303,7 +303,7 @@ def run_hook_command(cmd, param): cli = [cmd] + param use_shell = False if platform.system() == 'Windows': - (root,ext) = os.path.splitext(cmd) + root, ext = os.path.splitext(cmd) if ext == "": exe_path = os.environ.get("EXEPATH") if exe_path is None: @@ -1839,7 +1839,7 @@ def patchRCSKeywords(self, file, regexp): print("Patched up RCS keywords in %s" % file) - def p4UserForCommit(self,id): + def p4UserForCommit(self, id): """Return the tuple (perforce user,git email) for a given git commit id. """ @@ -1848,14 +1848,14 @@ def p4UserForCommit(self,id): "--format=%ae", id]) gitEmail = gitEmail.strip() if gitEmail not in self.emails: - return (None,gitEmail) + return (None, gitEmail) else: - return (self.emails[gitEmail],gitEmail) + return (self.emails[gitEmail], gitEmail) - def checkValidP4Users(self,commits): + def checkValidP4Users(self, commits): """Check if any git authors cannot be mapped to p4 users.""" for id in commits: - (user,email) = self.p4UserForCommit(id) + user, email = self.p4UserForCommit(id) if not user: msg = "Cannot find p4 user for email %s in commit %s." % (email, id) if gitConfigBool("git-p4.allowMissingP4Users"): @@ -3272,7 +3272,7 @@ def streamTag(self, gitStream, labelName, labelDetails, commit, epoch): gitStream.write("tagger %s\n" % tagger) - print("labelDetails=",labelDetails) + print("labelDetails=", labelDetails) if 'Description' in labelDetails: description = labelDetails['Description'] else: @@ -3478,7 +3478,7 @@ def importP4Labels(self, stream, p4Labels): if not m.match(name): if verbose: - print("label %s does not match regexp %s" % (name,validLabelRegexp)) + print("label %s does not match regexp %s" % (name, validLabelRegexp)) continue if name in ignoredP4Labels: @@ -3801,7 +3801,7 @@ def importHeadRevision(self, revision): newestRevision = 0 fileCnt = 0 - fileArgs = ["%s...%s" % (p,revision) for p in self.depotPaths] + fileArgs = ["%s...%s" % (p, revision) for p in self.depotPaths] for info in p4CmdList(["files"] + fileArgs): @@ -4304,7 +4304,7 @@ def renameBranch(self, branch_name): """Rename the existing branch to branch_name.N .""" found = True - for i in range(0,1000): + for i in range(0, 1000): backup_branch_name = "{0}.{1}".format(branch_name, i) if not gitBranchExists(backup_branch_name): gitUpdateRef(backup_branch_name, branch_name) # copy ref to backup From patchwork Wed Jan 12 13:46:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20709C433F5 for ; Wed, 12 Jan 2022 13:49:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353713AbiALNt0 (ORCPT ); Wed, 12 Jan 2022 08:49:26 -0500 Received: from mail-dm6nam12on2043.outbound.protection.outlook.com ([40.107.243.43]:52832 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236601AbiALNr6 (ORCPT ); Wed, 12 Jan 2022 08:47:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jtRoe4Uc00nEJjcr2+XYnVxKd69eyqamzGfROKSZ2x+57bFspse3ZQi5H1ifTA2vNz+q6JgZ4ghLFuuX0l9t78zN4oQx2dIRrRNzER6STyt4T/gWQNwRyEopx4IRlxXHuAKi/nhnARGBH7Q9h8g6tcmeumEqdFlzNe5EIzAxnE6aQBGXMz/YumPn7+8rofbvRLUBaMTB3LOkYNL8foDgSppFSSfyho9dNaj1v4Ixnp33ZUHWIyj3P/YRjxRPceEN1GLhX75aLfq6jjq5p8t8Q9++Exrc8rTYCbdKbp4ViKHzmnGY13KvNjMwq3xhHp1G3sLlIyKSVwSi2LyMVohXAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OdVU2WZkaABXu3nYmQ/eXg9L3hO08QKQLjegoiBU6o4=; b=HuHiupCcfZi6Zs/U7Yea7rgirkkuBvT+M6FOZjhhKd7Z027jLAQPzuOj90iG0H8en7oeKYtKrMxYPwXGlDYNXswa0Etc1/Qxv7OqJZ8lAh614qTTB/FlUjAvjeeWKi3gRhr1LC5bPYh+5rLyBtKMDpS041qbSucmf1LOz4Ra0Canx89/YDwZ2D8gJR01ftb2xG9TCSpzB92/AGg6L7/3+KLhd1i6nsLdYWSODf7KcvwRrlSj2qij1Js39XwCq9AvNszSlo/8eQ28tYWSp/me7klm55Rbx1pth+u7VFDQCLS6aZ8DItrqTKYhkxtv7N0m0QlyHuKUiu41/vaUbFhw4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OdVU2WZkaABXu3nYmQ/eXg9L3hO08QKQLjegoiBU6o4=; b=BEKOK6jVK7iyQjlLpFmFymrnQ2HHZX2g8WOVBLNPckpgJFeM9gz9iaZyLeXrI+XZ7w5IkAD2ndsakIaSon6HsRqPrm7B7/GLsJYpvkpdUK5G8qHXtSX2se7jbBbnKp0hapTIPQHTzXe6TOcLi1wzQf2zddohoFs3l9hsXaQJS3ECxHKy54iLucOv5D9L/X108DQ51UehEbwtxNe8rPeomBz5vxxVzRAVPfRaHbMyUAUYjwingZ8gXWfun7j+F9s8y9ORB2enhw8x/CLoUdXYQC7EthFO0z5uq6Xo1/xkJ/+iSBjG+rQSeXtUI+TtMa9kaY6hrpgmm+EKVPfRCniPwQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:30 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:30 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 11/20] git-p4: remove extraneous spaces before function arguments Date: Wed, 12 Jan 2022 13:46:26 +0000 Message-Id: <20220112134635.177877-12-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d819d2b-3536-4e64-f47b-08d9d5d213e7 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mTrAEBvcoDU+dCDN0/2MUTlszhXC/yNFuTdzK6PjoTSr87b0wKhTrY19uhVoSgpPS/Ij2URKzK1Uf7Ztjh2nWCdZZa3lzylkB4oJe7h1Afy6X/jwQTZj0gQZdMj2yRgXShfw7x9CCgTtx1vdUvQypQsE8N57owpV7IuwtAWJvsd1Oz+ZYm2JCL/SkyZqqLgzWLGs0HLYFDmQJqYvD/8QYEBTW2rwaxrtREca23YpPBRbPcoVLi1UxDn7kHLYzNSFGxVp0dd0AclaVnx018zJW3K20W29N+iRCQuevBj1HBmo2ubpjlI6Hy6cuyh5TaVyZASJ+EE7dc8BEYmn7b/y3L9f1iAqac/947gw2XZDK6dnLw6ueS5XzRPiMoBwVB0GAUS8XlZkxLqf+71mQ3x4FFbz8PzRnMHJRCdiLfB680f2pXEBCjOvTurLJ5EHhcBbFUySv5bWabvvZ79BziSdUUsiUPVnaP9BnlppNonFMqj1PeFjPbo/wy7U2WN2E+pfVsX6e1K4+qUGmok6wgTmdkt+FqIVyetDIe7muWjlhtsy/JUbRdiMeSXJnlFvKlOnyDdMUTjmsROzpTGw4TXrs9IQ61XEt+UcL0Pj2Zb21fOAx2L7JFFuNNSEKCe1aqfXfd/WY1Vp1CBC65uVEccueapi3hfFC+2YWcLYH6+dKgla6bsi1U/xF5YmLJM7DjVW6fWiY0vEqRbdCgLIAGDh67WdCE82cbdFKaV58Tmp950Lm4iVHnCWBaXCeIQaJRusPePngfhPcC75k4QldDisUupba3oVWCv5S3eVyIRPMls= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t7DkBDJlqmxmtUj/0sPZ4UhWgqgYVdMK5c85De++hrAt5uSDuqLBYdM3IsHksr42eWLzSX3/BzkcFdmT4V44NceZEy6c2VRSQ8pPJZAq7pizRZOLU6cFfnCGk74Y2xlMkQrkGlDVZQURC3yqPf+5da3GN6wS0495Ottp1+eDBlm1Ug7Bxb0Qm9n20oQJBAHKepZTHqb5E93g45UHsaRKKZK9QEWjWj4hhmE38qtmFymlBLZXwgFhQNmNYD4FCh78mi5Yn3Oca3MAVX0pK32Em+6maVW59oG/gh7HyoWoIYb5DoL07RCmCjVvpInXMtqVwW+D1zad86z8U3/t+g3jP3/nDzX4g1gb/AGtm8+b/F7ZLX/GSaayHnVsG8zdchHPnGA+sZorDUE8Fq9JMpuGDQ2ooJXHn3soVKUVzHFa7oLW0tq6F7ipeCp5quQJVpFl5aBVEL8h1MJfjxg5+qZ8C37nAOUVUPtjbFQBHty/U1t85iFFjK+ilStFn+3WgeL6AnLS2bE3HBXA0t4udeFF/KIbexhOVPaLChAQtGbslwMbdqoGrzGIN6c+VFKI3tWxT+TVi00i+Ut5bBcj2d/jihCDKd+aCE7vvJpabkpcooxZc9c1LTHzRzZDHdZ3D9kbNMHO1n5ZZhLXbXuzNxyD/cS+KIy8h25HivNqz+LwUIaXH7/QKijXNE6W83F3lOOkmcdfEWIikFs7JqRmBWbTj1VAskYjaT2jI8Q11bm7HtVdFtLtTrRSQA8vIsIdwX1P5jS2sJTF5Wn8y537btm2RYduTJLkx8zMsy2+3tvsMrpOV6T5Dnr8anvkg+wW8xCEvLo0KiSJimqvC873K7bySmLa8jTnKlO5dJDnF0RvHEftafnOBggIf4GuVWNWgENf6P9WHgR/MOVGCnsIKtseRvOFTCrfAxE//wzzdJZBfjmg1sWjiivRbOQfa6qdgFRk9o2hVACph5et5F6kHL53aYuTgJcuddxnOBr2mJz94b8zNi0ehiZItL6V0TzvUMyWjHqo4KfMLI64lSeQB4C5usLHm6u7C6zAH8iuQHTsQeiDyM/5pUd6KiDpCZtq3Tj+KxVfs70zw0G+/A+/W5Om2NlbfTFOmybZvQgfla9piUPMnFLSuX6PM8WUyzL3WFo/qtG37xDCLVYnbNY9gMc/dW7NwT+M6gjFR+nqLIKJP1yjWpkEU1WS8/94k25Dn/zZou5T5TizOGCCf2fdzTibkSO/Sj3U6mONGEaq283DCNcPTuUbjA2ugg/+dMshoI4S4PoCwByVS7Zk6DFp7diPuoyAXayL5GFN9M1CT1FWYS+3SdIFe60nE70FSizoDd4wg0LoSfK67KeOz1bIVRzi7oD0LrIe2MmPf+rMO3l5gEEtvjbYS0qil+nyGtlF8UzF6gwfNUqxo5u9HUROCNdUm0Yzaeai59SJSL0wAvcVoO+I1EPcaGqNoE6YDx+n5RvccbFj9pWtuldps3RogOjguOAe/QLxC4hidRajxh1yQVGJQduvFt5xCoGV7m5jB5afz3wK5MHpYe2mjIC9PV0C9WxONDRyJrIX+U12ICw8E4Tt4qRI4TQOglryF1x1u5U2W/o/bGOLFCCl+mMEs6+QpNmiXyaGjgNf4so2aY4MdQw= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d819d2b-3536-4e64-f47b-08d9d5d213e7 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:30.4390 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k0E7wIQXB7hXqjE5bdGT3KvYhjOFibpITv0CekFxeSVUS8hrdN9TtnlOqQD99XfIAQ6xKYuNSz/4F1bTRhQ6UA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that there should be no spaces before function arguments in the in the "Pet Peeves" section: https://www.python.org/dev/peps/pep-0008/#pet-peeves Signed-off-by: Joel Holdsworth --- git-p4.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/git-p4.py b/git-p4.py index 0e54be57b3..f7b6df104f 100755 --- a/git-p4.py +++ b/git-p4.py @@ -984,16 +984,16 @@ def extractSettingsGitLog(log): values = {} for line in log.split("\n"): line = line.strip() - m = re.search (r"^ *\[git-p4: (.*)\]$", line) + m = re.search(r"^ *\[git-p4: (.*)\]$", line) if not m: continue - assignments = m.group(1).split (':') + assignments = m.group(1).split(':') for a in assignments: - vals = a.split ('=') + vals = a.split('=') key = vals[0].strip() - val = ('='.join (vals[1:])).strip() - if val.endswith ('\"') and val.startswith('"'): + val = ('='.join(vals[1:])).strip() + if val.endswith('\"') and val.startswith('"'): val = val[1:-1] values[key] = val @@ -2347,9 +2347,9 @@ def applyCommit(self, id): # Revert changes if we skip this patch if not submitted or self.shelve: if self.shelve: - print ("Reverting shelved files.") + print("Reverting shelved files.") else: - print ("Submission cancelled, undoing p4 changes.") + print("Submission cancelled, undoing p4 changes.") sys.stdout.flush() for f in editedFiles | filesToDelete: p4_revert(f) @@ -4018,7 +4018,7 @@ def run(self, args): i = i - 1 break - paths.append ("/".join(cur_list[:i + 1])) + paths.append("/".join(cur_list[:i + 1])) self.previousDepotPaths = paths @@ -4047,8 +4047,8 @@ def run(self, args): else: if self.depotPaths and self.depotPaths != args: print("previous import used depot path %s and now %s was specified. " - "This doesn't work!" % (' '.join (self.depotPaths), - ' '.join (args))) + "This doesn't work!" % (' '.join(self.depotPaths), + ' '.join(args))) sys.exit(1) self.depotPaths = sorted(args) @@ -4088,7 +4088,7 @@ def run(self, args): if len(self.changesFile) == 0: revision = "#head" - p = re.sub ("\.\.\.$", "", p) + p = re.sub("\.\.\.$", "", p) if not p.endswith("/"): p += "/" From patchwork Wed Jan 12 13:46:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45BB4C433F5 for ; Wed, 12 Jan 2022 13:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239874AbiALNt1 (ORCPT ); Wed, 12 Jan 2022 08:49:27 -0500 Received: from mail-dm6nam12on2043.outbound.protection.outlook.com ([40.107.243.43]:61056 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353747AbiALNsB (ORCPT ); Wed, 12 Jan 2022 08:48:01 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=deihxwTIVP3HuyxmwQBklHXJvYb84l8d04JaBWd7HnJlrkJLOAO6q5v4/PAK0kooML8aXsR3tiximCWhYZnsps82bLXwJidrdEZSY9XqcSX5t8I0/MHZLNSbpUdx1gUX1WRT2SiAQL7gWqQ5sCbQznTjE9EYcv0FLcoIAC+wb1pDznVYMA95Hl6tJ7izoLkJSUGcO97b/HxtdWMLUWDl7SgupBIBHDvq/k67i7+K3NWu8Hxzw9eY9rgrOaMxQaQhP6FAwvFaKTMbez23Z9W0rLa8crEbv4pxkzTeF6SB2RVf/6xhxXlgDSnY2cE4QfW3LdruuRpKDN7dKAGOznIwVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VNsDq7q8r4PSKe1WkaYlFiim6R+V1ZBXIW4Zq4vWJBc=; b=FQvcuPSUR58sl4fMoeHd5uJwsy4qCqM22Z0gVRsdXEgQlB77zQWg5ref+d1Ta80r3naZfdyD62NkkPOl3qE8QK5PG0Rs3oaumNZTzOaNFGXFBD9HNq+wNV8zvQWe/uxrScoSo+h/0hay86jEhtT5qdisnUzrTk1O9QcaGXs4Kj2YpczRhINv5I8sYKD7z1YFeiq9J7sIs9MUqWn6q3qQIR97q4d/v6t4ggLcwE/cJ+KKDxTMF63NYHU+r/g4J8l+dT4X0e7XOb2lB574Y1tpwkbJJym6uY2DYh0QCewsFEMozoiNhcq0MHG95/jlqM1Xs6EqbQTVb9CIoaNUS7TqvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VNsDq7q8r4PSKe1WkaYlFiim6R+V1ZBXIW4Zq4vWJBc=; b=S9K6OlmJO6EUXYj9rctelvI2E1xN5PudqaoNHMylCBJmQwbhatgW8T2kZaoaJORcvcjjt1dyuxoufxsWQYItmPp4Joq1ASF67EP26yyjWMWqIcNOwA8iqWCy+9ccqD48jLlHxveLtNS7SFU6siaZ/7v679lbeGIdHPUb3NrPNQ1rfy626SOo4mKGoAzrzUKvtUGUuBdA3OfKazdCOF8LSc8m0Ll7BAjZe4m23b2r+1JNtJ4kkcR1NzkTLI6A5I/Va57ryZ8ef+M4rVf8J2Afq0HjA7Go9cYTSG9+kOCIGPwDOW3zupKwR4Iab16SptVttOeCBBa4V7rPJvbLKC9xQA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:32 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:32 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 12/20] git-p4: remove redundant backslash-continuations inside brackets Date: Wed, 12 Jan 2022 13:46:27 +0000 Message-Id: <20220112134635.177877-13-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87192d55-f9f0-4c99-a10f-08d9d5d21503 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:126; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9EH+KpygaUqjXJqykAy1Nwt2lWztT7QRQgQu/o9oMpZcCoZ6So09ShZzssZtTYkkeAA1zLp0qvW9iWxRKQSLDkujR5hpOOmFTc+Nu9I5GFXRAiwEbVkCsHfaI81ZZua8M/fgICUKtGzMinIvRC9P59Pvp3/axJsurOTcakluEnNjSj1DKHeVBo89rVfXaD43Vx/EE/73tlV5SfOj+AczVTCW8cnWViQRFiuAdPtrle9X+vmdkt3AQoMv/79gkeCAxdmm+0bbqWqoBh/6GosgL9hBemUKW84PPUrtomfvbkQhT5XYojbNGBI3LquTE9QiNNfbotr9+UGHQLgKvYK0y4ENdCNHN+449dyLOB1zD56l6ADaJlimRS11u91ujLYre2uajkY6yDyu8vQbRQcpEF8uAskGx/gPaYn4R87TIDlRBSl/94AI2PSqyA19hDMDUWNAxhI6SaK4btaiAwtsdSb4zoVwWERTVcTJeIsU+Ka202nshblWzRpnCW3/agXeXwxnxSlRDzJn4ZoCXQ7r8nEEfjw/3qw4bYMvgT5ZaDg4Wi2Wpk/3wltrlN8GSruf8lUoRH85r3ltWXVQpmzOpOi8P31jaLHKfYdF+NX+tfJUcYFHYREggR5MUhXmyNJGpWOudp8Nf3EAlWC1suB8uXJjFDz+aROkLtpwmE4DD2hpDUKvfqt+QR8Z/k/gz5Q/zaRPAQ6+DfjgNLOHXUNCe9BCSn6ydK6s5M7tiJQHR63fyej4o0ivAqfGVzxusryYhZE8iiURKmgXq/LIS10FOKIpdJ3bk/3w9yJUSrhOi4s= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XCoOx+PLUGHiuQtd/HEq96ae5o9ReakAjRnHPZo8TUQw5xNYMk9K8SdTIm2a0YE0p+ll0HTqMMGSvz14O302VjRcrJzKU2lMTW6x7HArkJPgknRKbsxi2iCPjEcxi3YwwLhPmbx14SZDyPNiYtnU3gImpnJk1diXCrcHTcILdpOQvdUekYEnXf7+pP09HxU2HAvp43APhpkshkpGl5yRnwsuCvwquGffwaQcOqZVkKYbb3N9aRzlC9xx4JriUloP2yJziP/K+wMEbB7n3Qh7W+INC7VILPs+W4rtSKGooRvDw2cXPmlGOanK4FU8yAkHHuiRXg/rHJbwba35SjQAr6Z4cyBFMkUsoXHk8EGjvJRg/5XORAiXa40/CMdOXQCB4r3zjAa/v8p4Hbd1SNVKETLScLwkhXUSZfQgTOhAX/PC2tD3vjiZ4uK+e96/IkZ3ugOChSlAtYKgKI1n4Ps8wDJ9KjxaQ3+YDtjH+PeQ+/LlL9KWD+TntLvFsawsI0Qv63DnJWhb9agZEJaynHuUKqqTPcmvSPWjjooGlmjJspGwcwauM0OWMAX8Y/fzUuLFCxsJd7XL2LMP1JJJaq2xeKmaidzzEs0lpMdlvwoSZiYSM51gorrnFhI6FXE1re/svVOBEEBn33a7NOgBYYfAzCc61uFUa4aYelaB1rdkBsXl6bYvgop4q5k2bJ6ef5GaMYy1cVMSQaJN+RfpyR1LHMXogv8gVMYon45wv5a4JcVAmkkzUTv9CuURP7UFqyT0Y6EkSI6cwiiFwb4eLD9ybJMnGygrHWhF5hzviSQoNC7jv79y4JA74g2DtJ0rD3iJb4Z+NHtwFp7yKHF9lbLdqcM1uO7IWpivwG5lGcNZyti2YWSdIjBvvNQf/QAbkTAdUtrRm6fgljlCzqvagNGj+a8UWXDi975c3/6NCS966YZ7AOz1IzdAHXnX/vyg+IZ7i4fcus5m53GGwjWqSoue1YIbU58qaHA9KDa9LocAYcAepF/ITc9y0fShABNVSctD2B1/E0EuyihokyzjAX4Ru3teYNXP0t0SRNITXfIxalnDjT7wQDydcShLx7pOYm2jJSXW7scluaTEgRF4bFBpNNz6e2fSf35jDnkE1mrhd7dEyekqCKmAvzjbJgNDckrJqnurGaTl1DiepATcP4DrwkpNtBgOl9m5YNEYzQyyXstDBUDXAhYprJNJaQB0i23oVnVn8gf4RFWSsNQeg4CK//Rl0rJO5KnwK5ZcwBfaFXxZq6w2Q4pLs/Frsy5iJ61RMwYu+ieZLa6wvJ7FgfAVDYT2zhvwPlRhYmAu7DJvWYOoHhNuiZ3FIN62qFRFHAEBXyFwiPO6eDqWJ7ZGsnVSOTLQgjyTfKpklsrN85vwGCxaVti8Eclp1HOTabp6QuctGBTkPo07dMvCoA5sDLt0AI3ds/mjmtk2iKbnuBzGV1PoJqfBobOXXHR9MpCOcA3QoFcZUdnW+zaq+GaQEsYMdAxMb+qXD+5C1lXY1LwhuYu92cnq2BKVDuwYo5Bqk+A88mmswLkuOIygCE9Nn9K4sDIqSde1ql9Pt/QJLg6CVvpULTVG36357CPgcnngsmCTu6AAdIW3irtMKbKg5e1Chz6ijjk/DxirJEgJFTuxxDc= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87192d55-f9f0-4c99-a10f-08d9d5d21503 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:32.3762 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oZgAf6FTLpXn2bHNKd/wHwZ0TYzSHVM1jSWkkigOCam5CXau3hGm5OWfSRbNnEsIakzebhOAapI6JCphlj0/qQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that backslash line continuations should only be used for line-breaks outside parentheses. This recommendation is described in the "Maximum Line Length" section: https://www.python.org/dev/peps/pep-0008/#maximum-line-length Signed-off-by: Joel Holdsworth --- git-p4.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/git-p4.py b/git-p4.py index f7b6df104f..80101e02a1 100755 --- a/git-p4.py +++ b/git-p4.py @@ -2273,13 +2273,13 @@ def applyCommit(self, id): print(" " + self.clientPath) print("") print("To submit, use \"p4 submit\" to write a new description,") - print("or \"p4 submit -i <%s\" to use the one prepared by" \ + print("or \"p4 submit -i <%s\" to use the one prepared by" " \"git p4\"." % fileName) print("You can delete the file \"%s\" when finished." % fileName) if self.preserveUser and p4User and not self.p4UserIsMe(p4User): - print("To preserve change ownership by user %s, you must\n" \ - "do \"p4 change -f \" after submitting and\n" \ + print("To preserve change ownership by user %s, you must\n" + "do \"p4 change -f \" after submitting and\n" "edit the User field.") if pureRenameCopy: print("After submitting, renamed files must be re-synced.") @@ -2422,7 +2422,7 @@ def exportGitTags(self, gitTags): if self.dry_run: print("Would create p4 label %s for tag" % name) elif self.prepare_p4_only: - print("Not creating p4 label %s for tag due to option" \ + print("Not creating p4 label %s for tag due to option" " --prepare-p4-only" % name) else: p4_write_pipe(["label", "-i"], labelTemplate) @@ -2587,12 +2587,12 @@ def run(self, args): if not self.no_verify: try: if not run_git_hook("p4-pre-submit"): - print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nYou can skip " \ - "this pre-submission check by adding\nthe command line option '--no-verify', " \ + print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nYou can skip " + "this pre-submission check by adding\nthe command line option '--no-verify', " "however,\nthis will also skip the p4-changelist hook as well.") sys.exit(1) except Exception as e: - print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nThe hook failed "\ + print("\nThe p4-pre-submit hook failed, aborting the submit.\n\nThe hook failed " "with the error '{0}'".format(e.message)) sys.exit(1) @@ -2615,7 +2615,7 @@ def run(self, args): applied.append(commit) if self.prepare_p4_only: if i < last: - print("Processing only the first commit due to option" \ + print("Processing only the first commit due to option" " --prepare-p4-only") break else: @@ -4275,7 +4275,7 @@ def run(self, args): if not self.cloneBare: system(["git", "checkout", "-f"]) else: - print('Not checking out any branch, use ' \ + print('Not checking out any branch, use ' '"git checkout -q -b master "') # auto-set this variable if invoked with --use-client-spec From patchwork Wed Jan 12 13:46:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3773C433F5 for ; Wed, 12 Jan 2022 13:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239722AbiALNta (ORCPT ); Wed, 12 Jan 2022 08:49:30 -0500 Received: from mail-dm6nam12on2078.outbound.protection.outlook.com ([40.107.243.78]:40385 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238942AbiALNse (ORCPT ); Wed, 12 Jan 2022 08:48:34 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z6ZNou42aRgZnMHF/tWzZGVRZLEVwVvBVFNWA1Yauo5sG5peT6GvP2SVUA9GUIqugu26XDlw5ek8kg3aTWxOQxpcCNRmE8qljJyQYvhlpOQK1I13dMwwisrN44zphYc8q47N+qA7wZq3HZn7DPNaZFZasIO+jmZZuayoy2ERwCqvHIVMydQwW8TUyK5a3e/Zv6VGvNMXQHuEmo0iESG4ABRcTiff4NgeHT0ce53ir3SlDOF8qw03CHLRCBhmGFK6XLR4zzeYCUJO0dhtFTkahUZElmt4QC3qW4iG2p+y031bpkcpwArftih6nV57Y5Tl0j2VYhvSWzfTR1H8Af6WGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Bli4UoNcdCpTOEyiKH+QpAYjNgFaUYRJqS6RR0EvHnU=; b=mXMeY7CTjkj9z8a3RH2/uUXrm3n8GkyKOxZjgSo/xZ7LRvF+hzN0j4Nwcn+4MXqxiAHjQf1+s25vtLn0Q9O0K/Pbt+dq8vcBE3q98nBVtBWim7H31cfDTALaWEX2vabKHfauapeLI0UMJk83J5IQg4rRcME/PhZaJKTPL3rUh0bJjdVMXhMV9Puow43SUiVWpFBlsU3Y6rKR3VhEjMMRPIlBnqzqll/2HWJ7+dS/Rd93+P8lLV8z3MVLC0IsvlJ266j2Hod2HCLa4oM4gzStc+MOy9aKK3YTuHGFdtccAKhWMmhilnhza/UCh53pdyjES7J8XwcJ1BLkEG63WAwcMw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bli4UoNcdCpTOEyiKH+QpAYjNgFaUYRJqS6RR0EvHnU=; b=XRrwcEpnF2hLVHF6BcX3+GBvWKwAABs3mvebMQOTQ2bAbePOZCZKCwZp3tGcvJX2fd2LZ02WlO5b52trOklJT4o6OzBPwJOsEB+4dTiuhAjsWFGtznO9OuhmjbTlKsMfS86POX7rQt3WvD/LWltqjAkF8tby8QTtnIboN1A6ydqQEb68eQZPJ3J20tUbr+6pwQKflM8xbtVoX/SvnfN/vgXK7yFlHuK/hQ+w6j5t1ForvZziuYpnBCQcfPaCOoInn8bDkywMx5pm+UxG1cPCmhd4Mg5ob71+qglPVbyXhVJaUXkDPHdFjqwExlwuaPdpQEk9XrRtIMKoS/BSRNOdLw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:34 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:34 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 13/20] git-p4: remove spaces between dictionary keys and colons Date: Wed, 12 Jan 2022 13:46:28 +0000 Message-Id: <20220112134635.177877-14-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0a3f8704-ec4f-47ab-df1f-08d9d5d21621 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:407; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qS5LllIJ68ORTijcq5mwxRwXMD3y4EPOxHsqSFEIu0PcbWikBPi/swtaHE2m+CZfgPDxbWn/FOJwxHFP7dvx0TAreJVChYD59/Zl9cpp9EzI/y5nzM2dWRUCiiEEzgCic7krTFbk8gd1wvuwhoyXdvVQjvyeMfCh2Kb8ezP17oVwnFayGTv9+w85m/40YaBAlJAYGFdQrabBDhchfrGedFYgbQGY+iCe4iTBOXtfcAto+LaWdg3pZvBz/2hpBLDc6AKJ54CWbh6Z23EjU1QdcxqgjP4bal9tbuLJELhQYtcHVM2Krmzh/GAbkBvlVXfEDnCKbFPn1NuThVrGPNyXgmNBK1dSOHSFnYzxM4m8VXU/ixpZJLxaomlb4IYAL+sjA3eNP7mqa/4SwkVc6yWKQdbkg4/7Q/Z6gPsf9tzK6iyqEDneTOi4YRFeb9YdbWdNMD8QBCIFAaJZWJhUPKSsfp6ScihbFR0BLOrFtKGdVwipczLswjUCXqPrrg01gqpwdMbsc6CW6HUcY2E40MoJvEzf2ibyDs5D+xzq00yVTa0BWg869PjU166bfJFpBFNAbDPyTOEp6+WYCEf0janUKi4m1ijFI7jSI5fI6AwLuuCp4bqwGmjPBcSogzn3XJ28cx0gAi/x+LuUBkvj03dRYtR4MTcBSrV0WDWhShdcPES6M8diOvd8l0cMQAlH6CXE+H7zyNqai9aoI5km+9jaQw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(4744005)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zIB7VykQav85Efs0C6HIEYF5U2rYrbt6846p8x2mWlzy2akPst5Dax9WQiz1ZbCYpMehWb0giqbHcHhzo85XifQ5etMZk9T/5odn8GoVVavu95uV/LEf5ivyMVF8A2ETAK4SJUAxJq4z1wDEWCp1Br1mkZmLxVBapUW6hyMOnEavxRGjCaht41hdqhG6FcjDOg9smu0oe23vWioWrZgZksuYa104iKNTfi5B4662VJIX5xB4rL3p4eKSFRbcgKrZQtctrMJ4eKpynSIrfw0xF13YAOMqqPHu0j+hkz02UxIAqcqGSWkYRIGqqGVHGiZQ0B79zYSk5kvX1d/LTxh0X/j/4ivZpcmWgFOanRZ0WODtmCPIfUyVMfGnEIss+Xd0SSVzDJoIUhCnZx1S/VUYeeOBzp+DHucDgz3OFIhGUccBXLaHaDXDBaVOhKiDxRhadvi/vyi/+xnR0COGUApZVFtOEtbMjp2Pp+ai6Fv/qbjJAM7NMsDrXV6lypwBJTLsiAcFFY1Ipwk0Nbn1U2jR5f9tb0Z5/6zu1BpdYgYva2POjKYNT3D6WizrKDFcF7oFBcU+z9ZMZLhZDGeh+zWgu3nT3ann02Zo1Hsl0XVus7d4oKck1vu1vonSvvhInk748SxqEmrlfOHv68dl/haEiGEL+QA/BXPXLB6dWiZ9orHBx7nMd4nnqAtMgc64QMRhLFPL52TpQ8Gu3Vpt4LFzzy0gcSULma9R+7QMH8v3Y8cX5vGu24AaQQu9KETbh3vWXRkCQx6edWQv2HlVXcAYHgcusEtiBBo5UnHjh3GAdc3IiurIHH25LLfsn++yWM+whLKFe/6SMt5JRAVnuqxxooZl+cJ5d2LgA1iMnJeWbh3NcdUyjC1FI9LyujP2uI9c54tPFPliGiGPWanN4+zjdA8kYzGNyD5lZKvHwxXDXqW4oTRBlh0aOq2KfofD8mhf2CZks94un4krnK/79dHzoEf1L9m7U/2GqSS5PvQiovKVrNLySyNbc8jSGOdSMRjGXgud9GySp7yVg2bVCFvgSh719cjy3U/E4K9Fh7Jm3yhXup1bTeBUin7URb9bojUtx8X6/pix05o4AEG/JdbuUTWI0HLNZn9fLH2kYcjoOY2+NxGjmcUKQFhWD79uIj15LXz1o11jFQaYa+t+byelF1VodU9zhb+2PkfODTNn9+dole+pJiczcDcvdj0QcA8ErmsBf0TBrLpcjC5e9cAedu9u8FhD7YChB0IED6gFtOe2gzCXV71wWo2OW4Nq5xdhKDA5Kdnkfzd43K6nyPfvEhcMbZh3s0cDX1ffjq7V8OtfEqvZCn3coR+pCk56ZoPqUAUxYhIjAWgqnYLA1MAg4MpNH5O8d1csOyEvCd5JqP2OWrIeo8HgGyp7IRwhFYfurj+E7Y1ZYmR0M09NFCHgIC5uaLgP9ORAmjF5iu1VG6Sc7r0He12L/JONzdgDd+H2kY6tOmFnmQONvV7vIqpgNntNh/sxcs/OvT7SdDR1fwT9SeKk+cq2pp7TxkCgcqlK7ldBCovu1F2T2zQCd2wBJyZAS5qjbBwoAiXXCy5SLmJrN4Clu/KTutF+a7e9XAAS+AqGYUtYtaznL0IOruXwUNOuZeS9Yt7rAoHJB+0wWEM= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a3f8704-ec4f-47ab-df1f-08d9d5d21621 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:34.2677 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Bm+Cw4tzN/lS2LrxNVWG7wxhlX+hNdX3vR18USPSxj9Edc6eX7+eUXDZZDCNZzfDmuWW5pYXIqao7SXPsNk7fQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 makes no specific recommendation about spaces preceding colons in dictionary declarations, but all the code examples contained with it declare dictionaries with a single space after the colon, and none before. Signed-off-by: Joel Holdsworth --- git-p4.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/git-p4.py b/git-p4.py index 80101e02a1..7bfa282f7e 100755 --- a/git-p4.py +++ b/git-p4.py @@ -4451,13 +4451,13 @@ def printUsage(commands): commands = { - "submit" : P4Submit, - "commit" : P4Submit, - "sync" : P4Sync, - "rebase" : P4Rebase, - "clone" : P4Clone, - "branches" : P4Branches, - "unshelve" : P4Unshelve, + "submit": P4Submit, + "commit": P4Submit, + "sync": P4Sync, + "rebase": P4Rebase, + "clone": P4Clone, + "branches": P4Branches, + "unshelve": P4Unshelve, } From patchwork Wed Jan 12 13:46:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30287C433F5 for ; Wed, 12 Jan 2022 13:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353804AbiALNtd (ORCPT ); Wed, 12 Jan 2022 08:49:33 -0500 Received: from mail-dm6nam12on2073.outbound.protection.outlook.com ([40.107.243.73]:36313 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353755AbiALNtE (ORCPT ); Wed, 12 Jan 2022 08:49:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EnDYMr0EXciqd7XqOqoCt6C4Ro+GnlVzlzsraSqdc+4/ZRFmWbJs4RM/0bmFYZpybl3CI3bctvy9WzJzz2ogCjlVH2bJX6AurGPjGhTcWDuQ+O1Un6DyF/vhJoXO5YLX5jxk8I21M61wGILqOVJIHak+/HcN4wgjUTb/SdjOEXkU9I60FYcU8HDfjfwqE2D5Ugv+BIejDtDm+Dr6D/hk3cwPUQZAh/xuezNEF1hqvUuWmDsgqU5TglRq5Uo+iaF1+u4Y6Zqgfp1KUaPCAljkHaeJNBOqpfUEF5QXA4/xtI5yumgrfICjihLeB8l76gOo7x39Kn4Hshalr4mWyoQPWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VhX5ZBHedIFNsEJWupxZgZ9lwVsGIDpvzNd7ez8gA5s=; b=em24e3AaB/yN2fNHQUjP8ejB3uFV4mVffvxVpUTNJHxcWl/W5qFlVKMODXX0uAwwCgCoHLyihr9zIhAnpfQ7l7azkf+Bd66M0B9CTdeKkIbUSIqRpFe1AE0m5kVFBCIP3X2HWxMP9VEXN/+KSicNQDT+CejlFQjRb26XOIQXPNYwtcreZfzFdEg4F2byrk7UIOPTYzjyc9bL1XFG/twvJtKlshseWV0aMpMjfbFvMihnGredql9ZcZiBpcsqZ7Xkr+puQwRA53iyYd06UXEsK2b31EYbI8pdobBq+cIZG29YHj0anUAnSaEvOtwDihT7XfwdvSCn0yf/e2p40pPtDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VhX5ZBHedIFNsEJWupxZgZ9lwVsGIDpvzNd7ez8gA5s=; b=DdI7Q/paogNH8KBDkr02xa2fVJXgDBcswT9oyN9Kx6mvRPZbJeTV2pdq7rFaAebN7Nu1WRInPBz/7Fzc+I+71lE8LBogYgoSmNDJkVcp7RUzPhDpm83Uw/rur/tYBjLkRomEARnev5iCNFNL8vzveiIBwI9hzvCeEEXfcZGgnBv/ZHILFULbHH/sVh1p0yvwjSpzK/bMlLb3fVo5YuCR8eTu5v1qbPyCLSZTOoxkWIXh5cKg2MeeTCegK7j/k4uJGTOcoD035Of507MxLvVIFQG8hUf1NPgKMaoaCCh4C0K8fC74vE/25IqFQgMgmi8382xhgUnnFEiNUbFzXzocgw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:36 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:36 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 14/20] git-p4: ensure every comment has a single # Date: Wed, 12 Jan 2022 13:46:29 +0000 Message-Id: <20220112134635.177877-15-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 508ffc4c-c492-4245-d022-08d9d5d21750 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:357; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ko+x0TnLDWx9UwGLP3tqy9bIYpZ3qPe/JNdh4hutJviPoH71KkXhYVOZ2gnNquKwHOaTpg7zKPz7vnwfP6IYCgLm5blQJahGpWjZzntEM567mCdACgL5j8qnbXmR/fuuQ3b6tv5fKXDiwKPnX0ss6QQBzSDGqR3L6gVc3Ue44RuP8YPuy86coDwV5NG4Z5hGMD34hsledLNF1TEnool+h1VTPf/tvZGYHvoGYaYXA8HlnnUuYgK7irIh+TT88nuRVC0uf2gw68GYdZdbKRkJaws3CdvirWH+un+jiilkQAO0mAna+H4e9oV9v/zZpMTH3NXQC5krisUtutoRcIkiBbMzLPr1gJ+vQtPdjWz14W02AVn/patarrYd82YiVBmp+yyyrpkI9Ubk3UXpntAyXOa5OBwqIrRgiaL/3/+r7Cr6GjqNwjrpkHqkg5rxigcJGi8TomA6hw27uMo0RUUJJmw86et4ENvv6i3a5KzCVmky+rNUa9gsBhDcUIq8QDEEmGwSOTxAyUE+hwAPXKhLIgE6aDjKzfQAGZE3KOFqJ9eOY1HzomwZ90GRWo2aUGBoQ5+lMoWvYUmxQBaPJXr9hHoTlRJxU0qw7YhwravLme+8NGyzAMDg/ui3yFS1+wfBK1Nq4k5okIn9t8HdKGIS9iJf6h/Ao3V9z+sCGkRcQwZXup+bDUura+IZVGc2HhjC2yfR/+U60EbkKNkpT3pRSJDgl9VwPqNJLuYTsUJrvmkfObhId2ow3ApHGdk/jiHmNctYXRzYWRGIhto5lUSOZxHIRwBcVvQ433W+p1k3Fzg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IZ5Oo0ax29qswE5Z4lp5LCJUxRQA3wnXvKBLfsgSl6HpOUjIIFPVVGbg28s+k2p7p/CMGIj3CenGaplr7cDo6NDJeIfxyMZ01BUWbnwBh6oWNLA6l7GGsb1gCV1JQqmrjmCG3Xx2sUSnTmeo2bd0FvJ4nkA6y/dpWADunbkdHOBsp02GZdTK5Jtgbq/AkFA05Ns4uO7NqR4Knv3S06HWozjVKOWP5/PX75eyhqqiGFqvhLwmfEH67Bc/XRUpXdGQMpRyXO5KBvrjWWfxKf79JvaDMQ7IEzen6wtuaWoq+bunj9BeR2ep3ufvXXXNxXpn8vMZwDhJ3H2l/hoIVS4kjcU3dEdhX6P3eeN2OuS+7TprBcwbEPtfJYlyjEQ7oTFwh/lTRCkvWC2JqXBrMvVKLqWml6ftenz7jK5G78x0sGN9IQg32Cz5tkT7R2PWboYqimIfVLi1k+lRyonHB+Ng64SzqsLU9UrZtAIlF4uTiHj9mFAz0+cbJN3mAYAu/JPcoHLzNSCu6LOdrYgslOYln9m4kIJ8mqM91L6tLfg91q4xfHo4kMqT2AAnUXcfz0iWwC0GbBCOZuBFWmXqHKpnO9np2hwAh0CrduNG1kLtqAu32Djn/epDBHceTS4sIXZNKqS3gutmSQB+Gab1WVqOso3caLhg8b/JOuYz6M5FDx2aRBVCyJmU6ZPUe15CNK/W8XFnsWTajdJufkugKigBn88lsAoWTV8k944+0K1vX2880YRpWQ/uuBOZNeEzcg1k9vDTvT7qjJlG2s0bguh5RWgueA9BwChYTMqSwRQyg42UhKa2ZTqrxftgYVgaLTD4fcvAuvsjVIv/j4CBkU24e2+H2TdcX6sSYwscSGMNloNYZApRnFkrvtK9f5CFJZN4jdtxmBQcDktkruIMxsOH55/0d4Xto76ksuynU3gqeCU6MoaNQ4xZXbHtiNTMSHX9S5OZqEv4jkReQTfaxFJNPPEUrsHAAsj9eH3tAWMa6eJGy6SJDA4bUg9EnLodXVvUbaJJ3TrDnHks7KZEWoUWbgQ+ExDPzgUWk6o/mbouMpRlYzTBnVu0Erfv/Ug7Wexq5jirQbM0PyWItZ915nyRchSYNtqt18ftplQii7AdEXeuPXq3ojOGveE+jCxYuvf/BAtETKMnNz267ZVI/pM+mp+0k8zdeXrmIUrrhFQAJ17M+0yn0A6K+y8MV9nkRytbUxbx9Hjc5Bn8JpLGmMfXkHOcCPmIhnPEBL8vjZ4NXU0z9X+K0K/h8buGZNtmEocjV/LfCIcXO2PNQzoitIDyuiwtug+IsFgW5oNFx6mdby6hRY1c4YzTuxFT4qPTbr3m+tsiCX+vLQ4saJ9cKNzKPEo9IPmQmj9bXiwOKy1Zj87CjOWQ0iFNm6M+VwQVxqZN2WGV29o9SIfo3+0+OZJldZORntwb4PpshOVStPLzORD0ftDvzn6cMqZOFUHuI7PYWapO8zsL/LiLPxyRcV7OTEEY7ev7lAuJwIX2XXTYIjIfWQ79ZkHFdR4RSQ//V4IiIFMpaLv3MimHOOyTF98v/gHEHYSJIejnWTrThho7sTN2GGXtj2DLVoFosg4sBgJNs4bgFdn5q+ZI5dYDtS559wKWEDduQWAULtdMvSdw3Rc= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 508ffc4c-c492-4245-d022-08d9d5d21750 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:36.2218 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FKwqShu37iZphmb2E26p+vzTjELZDhk6xGCuVrtujB1doCkmZpUhPr+zD30/NiccbFFB9LVy0koxkklspz8aYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that every comment should begin with a single '#' character. This guideline is described here: https://www.python.org/dev/peps/pep-0008/#comments Signed-off-by: Joel Holdsworth --- git-p4.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/git-p4.py b/git-p4.py index 7bfa282f7e..404de3e86d 100755 --- a/git-p4.py +++ b/git-p4.py @@ -968,7 +968,7 @@ def branchExists(ref): def extractLogMessageFromGitCommit(commit): logMessage = "" - ## fixme: title is first line of commit, not 1st paragraph. + # fixme: title is first line of commit, not 1st paragraph. foundTitle = False for log in read_pipe_lines(["git", "cat-file", "commit", commit]): if not foundTitle: @@ -3557,7 +3557,7 @@ def getBranchMapping(self): continue source = paths[0] destination = paths[1] - ## HACK + # HACK if p4PathStartsWith(source, self.depotPaths[0]) and p4PathStartsWith(destination, self.depotPaths[0]): source = source[len(self.depotPaths[0]):-4] destination = destination[len(self.depotPaths[0]):-4] @@ -3715,7 +3715,7 @@ def importChanges(self, changes, origin_revision=0): if self.detectBranches: branches = self.splitFilesIntoBranches(description) for branch in branches.keys(): - ## HACK --hwn + # HACK --hwn branchPrefix = self.depotPaths[0] + branch + "/" self.branchPrefixes = [branchPrefix] @@ -4105,7 +4105,7 @@ def run(self, args): self.getLabels() if self.detectBranches: - ## FIXME - what's a P4 projectName ? + # FIXME - what's a P4 projectName ? self.projectName = self.guessProjectName() if self.hasOrigin: @@ -4118,7 +4118,7 @@ def run(self, args): for b in self.p4BranchesInGit: if b != "master": - ## FIXME + # FIXME b = b[len(self.projectName):] self.createdBranches.add(b) @@ -4223,7 +4223,7 @@ def __init__(self): self.cloneBare = False def defaultDestination(self, args): - ## TODO: use common prefix of args? + # TODO: use common prefix of args? depotPath = args[0] depotDir = re.sub("(@[^@]*)$", "", depotPath) depotDir = re.sub("(#[^#]*)$", "", depotDir) From patchwork Wed Jan 12 13:46:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47826C433F5 for ; Wed, 12 Jan 2022 13:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353832AbiALNtg (ORCPT ); Wed, 12 Jan 2022 08:49:36 -0500 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:20961 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353694AbiALNtT (ORCPT ); Wed, 12 Jan 2022 08:49:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RwSVFG7niT3uQ6lcgz/kFAciilNOAg5Iv/jk8hq/589nDOp9qmifXY/Vy1ooUzdxcwbTjRDuJSp7+2x+797xEXJHb5be4EM5HjyxgbinG5YrSziv/HEDji8l5/5Fv0GhGyrQEPjBVyCr0Kt29mRfDXLXaut7pV4cY8DYlCcI/W0s/sdQpSbfEcnAXBxbta8/Qlc93QjBqsc92Z5ndeNvbgdmd8bR4JmYGSyRm1F/puhYa8i4+h8Fq52iA7fl2o8APHpCyXlYRUuP5kOiMFw2ua/+pASw9lktZHFDInm1swW2vpn+oth3qTSJFytF676iOnj3fVANLqOvBtnI2bBXug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WTlPX4X0q8rjV5UmpT06da0Qb0u4BAhc1Ywi0fvBGDU=; b=Yg0YQ53f5eRWkW7SXR0fsk0C975uBafB7HkOp/1O60lZj5oVftE84VEeIwdK4CY/HhF31gwVuMpB8FmKGQ4gsgI3pZ30M97WavO9LhsF64UEvCMivGQD9Oc/UbSuSjgy7IxOdJkQ8KBeUT0KwWQg82nk14xOfU9kEnGDbhSNFG5iw0iOCMsieRfMM2q8qfFkv5g1jRo3aWCBW75Jshy9cby+KGNC2DrfRqikNSbQmvArPbQ26C/vWsYB3ZnFxQfE0+xb3zHIxyu7jjgIgH1cBgdeFw0YlYuIKg9rifpT1SATV8FS+17fBUndgYlrpf3VIaI8CmaVDZsK2SESW5pGEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WTlPX4X0q8rjV5UmpT06da0Qb0u4BAhc1Ywi0fvBGDU=; b=F8GDJIQ3weq0bn0fm/wOuymPk7v5Zbo99mIH0LOc5MgC5nSfQjGidqItIuh2q9h9wKjZdw9GMtnZCiU0ZrANSRaC/w6QXQxGjj6vQvUTNCLuIdcDwx9cegU3RLEcWZDxCIrPiZniWTaXod+c47UQDT5+ya+MAxDinYlqsRxBTMMhB4oeSAaFHkZ4UP4T/E9kpAkncSv1bgi78M84HJ/j1DfSyDEUT6fTcIZLYlJy9RqsHQEzsw8Qdsp3uJ5s2C+wDyElhUh2jOn8b3riR4+YcNdOeNy7Y668+6rKzc96nwaqKYKp5CKsOgOxDeF/5PKsa34qUoiDgI3efkBVmXx08A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:38 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:38 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 15/20] git-p4: ensure there is a single space around all operators Date: Wed, 12 Jan 2022 13:46:30 +0000 Message-Id: <20220112134635.177877-16-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 955a58dc-6768-402a-4895-08d9d5d218a1 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:159; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HgqZ4ZdPqZ7qkTvCp1DkVJdxoRu9286FANIagcUsLmvsm7jmyNxiBks94GzJsOmBv+DAoIIaoN+zNV9b4Le1eAvbxTYOg5EH6utC94OtYZYhhMTbwKspGmWlYysw6al6vHh4hK7RdMpC0k8nNESBcJmAdTKo5XKqa/Mun9s/11mIxiOU+IJQVrU/Jlgy3hz1mHrTOV++RPy7Q0vQyth/D47ZSmOavKjz+kj7aLUoYGY73v7y+GKwoaBNQ2m20vWLIGaR9C8iacbFqMJAJi3h5niudDl8alk2E27jp5RjDAo/OEHbsbERFiTp0t6I/pvdb+8ETSIxZFVm4TfQEJCj1msGB4jXUETKh4G2I26sJyHXxuV4nJSxl+I2lb0S3dIazHbDh7XaYtoA/vXsY3+mk1r+wxSqCMqvZGbVi1gUSJbWU8qbwKgGMyePilSqkjIpjivhwXZ1S7Zh5+CAawRZHoFnvUSVIBmMaSbuGqI8wnDdy3mx2GmKgJzJ70UEDcIH2vMVrVWK/qNuOdq+6Z8M23fPJ/lVXYaLZrNnPvRNR+f9x2mJTJW2pL/vkgmmcVumYS1UEa0gCRc6b+a6JNzS19BtiDNnnixx0Y+6HV+YTplZosoLLAQ62ucRZOVEP+erdhkkKqX9ITz8hUlR5I9F59T8P6oxjRCqqvGk0Y8n92qL+UXEYU1owH7OmZhKhsLbCp7awdfqKIKCzMeKBTvM5oBOFipiq9mPR7xVLxvUJoWejzmy+PF7V9AwL5bHveX+VSu7ZTgcnXsPIiuBRLdq5ZxykUvUhxIW3mh+u8QcFW0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rvu2H7C6eQY3Ht06YN3caOxs3lBFRgrrjr6VHhjJe3d+8gb5ARUL5IBt6nbo++Ud06Y3OR00EjHXGTlM0otmdX8vxlrI5/B19Ft/GgSQo9oRBMl70M1V7HehBUsXtMCZOklHPpIUGLos4qHG22e4exOt/V+g2i/QvCUpqzLSWe0KA14kk8m5G+FH4Zkac/9I8Mapl9kNDt3r2apkMUlx7O1ojd0cYhpPkLXgB5Ajtms4hZpfKyX1bHzkyrwnAglraEASIFDTNqOSkWcz8I0uX/ZwQ8EHxsg9+eDr3ZjXp7AZUPM7o/rvD7wzILg/tMM1T4FZYzUr+rA5a2N7gK0ghMNYacPdA1274h79vv5/ad76AGcOAsGsxfxeZadka8NU5Mr2gp9a5BP4cALKnGffYwAHChmNMCHoHd8ZE3oHigoEuP/ko49nG0qOq3BtJCGw2orOwLy10jOMHnVkOUfvSakE37V0+B9cB5EIil6j/Ic/T9zegtba0u3ZJnvKCsVmuJJqazpo4O2Bv2VIJTjPtHzxE/W0J0My7oTWad+vGnA3VBvPQne3EmL1rFXOwxFoqPwkPQ+AY2LRElnB80Kp1lZdAhxPCzPUm8Ox31/fO9lA01uSzzkLrLdpb2Q/tRKgjK/ojfZe3LyvkFPBbllZ2FabRGxalzpF7Ozc8Kenp9n6Ae4blmgrsHimOhZqci2ZVLlRCZ5M5AuSw8E8TbvOt16ckSutxBTViw8jVhoDtnq/sYCQJ6lRgmNLmhZrhl81nRhUloSlOI4ldgCPxzF7kwrjQAXyIucOqz+rjRzbwOsGc7/beAeRBG1FB40FxBDIRyIZtRcYsOjmSTpwEhypo3v2/JglT3YkOL/5PdLb8TRWNP80m7YHBMAJYp/M7azKC8EafAwJ9Uc6UymS/8MAMlvzhRZh8GJmnMWdKJHCVwdsEI9oOM6FQldEAGzHhGr2I9i+grYgXQOHFSNCZvY9/yPc+1hqZCC+8mg0XC3Vp1G24hMmy8+ybJ4rA2OiYRtYHagHE8HMrWqPsz7IfwnxrLX7LF3t/0xDw57X8O/4hVH3LODdLrFuuztDtIHvPD8Ie5e4LMEIslNxDDVLSnDmLsMmBUs/V6/CQeqJVtU61KvJ3Jn4SMU6zS7oe5HsoRRyKtv078rGdGAiPCl86/eDB5KM+v4cqbKvPS9px+MRcYiJSpwvhhKzK0phSFrT39usfwYhzJrftQCYsXR5O0JSSdiLEbWPpZsq8eAR88jqdLn2AesqjY6vhIDdAaUhU5jfxHFf2PGrmWcNSo4pY6GU3I+8O++bdrYdhlSg8o3pIsUfQTS1awpANFDH0yd3HIWedg6WIVu5pcjFZwrb+KYN+rDEEMQOOBY9A9+pYIiaFi8rQRzgPv8YZwrIZVSFXRj7yf34LBb7jcv91HncK3F6/Jn9J56mKAMQ9ihjWlOY8czuI+KcMT6ERKvDp1L/u9mIRRbHIvSygzPM+PhFofqnUk4aO+s/UU4OY/JfZpDS9v/P3NrdR4n73RdlSp+ltmbwvLATshR/eLC5SnkQgtTHAWfYhwUTaNvf8HjDVcNUhhvT2sblOI1pdVkIQXTwB2Sp7SDSXY/1ZqL7fD625mG5uXfRYjfsnVBWJQWdWgf5R94= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 955a58dc-6768-402a-4895-08d9d5d218a1 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:38.4269 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NBpX+N89hEIBm+sO6EbcyXDjMP7B39/As/Rb31TcpuckEjAHZM18T8La3ATpevgYt+ZR1WHEkFyii/e/o1H78w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 requires that binary operators such as assignment and comparison operators should always be surrounded by a pair of single spaces, and recommends that all other binary operators should typically be surround by single spaces. The recommendation is given here in the "Other Recommendations" section https://www.python.org/dev/peps/pep-0008/#other-recommendations Signed-off-by: Joel Holdsworth --- git-p4.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/git-p4.py b/git-p4.py index 404de3e86d..90e7922ebd 100755 --- a/git-p4.py +++ b/git-p4.py @@ -67,7 +67,7 @@ defaultLabelRegexp = r'[a-zA-Z0-9_\-.]+$' # The block size is reduced automatically if required -defaultBlockSize = 1<<20 +defaultBlockSize = 1 << 20 p4_access_checked = False @@ -204,7 +204,7 @@ def prompt(prompt_text): sys.stderr.flush() sys.stdout.write(prompt_text) sys.stdout.flush() - response=sys.stdin.readline().strip().lower() + response = sys.stdin.readline().strip().lower() if not response: continue response = response[0] @@ -259,7 +259,7 @@ def run_git_hook(cmd, param=[]): hooks_path = os.path.join(os.environ["GIT_DIR"], "hooks") if not isinstance(param, list): - param=[param] + param = [param] # resolve hook file name, OS depdenent hook_file = os.path.join(hooks_path, cmd) @@ -2411,7 +2411,7 @@ def exportGitTags(self, gitTags): # Create the label - use the same view as the client spec we are using clientSpec = getClientSpec() - labelTemplate = "Label: %s\n" % name + labelTemplate = "Label: %s\n" % name labelTemplate += "Description:\n" for b in body: labelTemplate += "\t" + b + "\n" @@ -2914,7 +2914,7 @@ def extractFilesFromCommit(self, commit, shelved=False, shelved_cl=0): files = [] fnum = 0 while "depotFile%s" % fnum in commit: - path = commit["depotFile%s" % fnum] + path = commit["depotFile%s" % fnum] found = self.isPathWanted(decode_path(path)) if not found: fnum = fnum + 1 @@ -3995,7 +3995,7 @@ def run(self, args): p4Change = 0 for branch in self.p4BranchesInGit: - logMsg = extractLogMessageFromGitCommit(self.refPrefix + branch) + logMsg = extractLogMessageFromGitCommit(self.refPrefix + branch) settings = extractSettingsGitLog(logMsg) From patchwork Wed Jan 12 13:46:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2190BC433EF for ; Wed, 12 Jan 2022 13:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353708AbiALNtZ (ORCPT ); Wed, 12 Jan 2022 08:49:25 -0500 Received: from mail-dm6nam10on2057.outbound.protection.outlook.com ([40.107.93.57]:44001 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353701AbiALNr4 (ORCPT ); Wed, 12 Jan 2022 08:47:56 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m0tA7rFgKMtg/OXufQICKSVvdPIbqULH8zsW0ucaw1yOXp+tuUVCo2dkTwk/7+l7UTchjFDuwvhp6WkKN8QrHF3iqbp0hzAY16A4FlpqcP48GI8+vebipmubETNbkiRV1lohP9iuCuslfjMTxROop514RmHQKimA9YJgsDTY/CcmOHvEhvqzz61B6kRzVWX6eYyPLgciWKNApm6cucsOKBFKS56pbkdq/JK2Vy7smYD6mn0i9pgPjOKXElBS4wf9FvLpmod393M+1iSINg+1kNUw4NVTy8km7kP6/+thRuzVbJ5gBrc009IScgOZCDgRvHcIQhPiuKQGqmngbgIDYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wxds9ybv9Of3vjOuabhzf1oske6FKC7HVnBpUySNMIU=; b=Vv/Qqf5cPsCvmNw9bO1q9ZUCMczHQd69Z6iXe9XDjOYZQoC1EjZAj/ZS2fpLFf+Em5ujl3JDKrcIJb4wrH07GisBwiw1CMIj2bSW58rHTDaOG78atEsYjFhySv/+0KSQjHT5/BFSR+uM9BEiffEXuiXQh+A44XVQS3/auv5iXdcsMNGU0vbwre/aUbeIeC/pWm2PCpCEQgBwc7PEWfty9Vg7O2vJfC7Beug5N2ilUKb2suiiV5anvzas6YGpY0AaVFXvMkcdNAem4Yx1kDMVmnNLX32pmHF0KQCBVw1mE8gZuCaXDe3gYZnk5EhH9iGlMbMDBqxmfLP66Z/Rl8INEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wxds9ybv9Of3vjOuabhzf1oske6FKC7HVnBpUySNMIU=; b=JZK6bC4TfBziDa7hKtYhGC25wD8q4NCGT5VLaSnY1ENyE3eOgEMQ/nN6oGZ5h9XIFej2aMBNVa2y7n16mK8WhLGg2pGzbiBDUU4/8NzJNBePntRnG6c9brGdkB7cFzCx3gBmGlumlUqfJJSa+J/v4f8k4dy/wnv9KApbUmOvbBT5SCBolgB4z2CKGLuf3f6Els1Gu781oBuTxVrc1/43MhFXPS/idfhzK1PFp6QvkpgPLJwG8ZAiR2f16NBbdeYyiicnU0MAoBVjlcOYMVK6R+q5mXxjbDnABXzBjtYJDAuj2wWRpox0Cfb2eed/LjLBpvWg9qCLQa+rhkajZy/Waw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by MN2PR12MB3693.namprd12.prod.outlook.com (2603:10b6:208:159::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.10; Wed, 12 Jan 2022 13:47:40 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:40 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 16/20] git-p4: tidied visual indented lines of conditionals Date: Wed, 12 Jan 2022 13:46:31 +0000 Message-Id: <20220112134635.177877-17-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4564b66e-6f63-4fe4-978d-08d9d5d219d2 X-MS-TrafficTypeDiagnostic: MN2PR12MB3693:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1468; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vtoQeSmMV8nvV4BY3DfLck6hb6y7nalBDRU0TpDf9ff5jcJxvFMLKCU0J4z/1aa8iW+eQz/Mm6MH8MsXjAfm/lmUn7QcO/535EnLU4Us4wTDISdmH9H4DOPUs/7V6L87mNJJFzJd5/uh32APGfIEyeUghXW0IhENH59rBGZn5icBUay9saaQMd58wCkyh9UKag833DENx8e5/b1uJaWyJB/L/qKb5Zz7A4i6SOlJDsKymv1x+Ypa/ICxauKzlrExWpfWpAxbWTD2EvuimKy38FYL2BfmmRgyT+DOgQQ0nAE3I6XVQrgz+75kasQ+3rSZQLt39wzxyXGoBe1UTW1C/XhQJ0i1mhZypCGDLdkkNFyoPtGitLvSb2Ip56Ioe47xg24uIEJYOL8oUcjz+b//PddJLytqlQDQ3ZBmSktfJ09Pg1aJ7Y50XRBeBtPrQBzu8FDszJvm+Nt6Ryz2Te+Vj8TrjjmE/ZEycqyl028pYwAaH9iGkk9FQhQcEz3qXUulqcPhpPr9oYI3IvJ8z0Z97+c1HwkdICoF8btVBm51BuRSJDTnXsXU63Pci97x3mDesfFy+YQJb/P/1obZKfZQYCYW/jyijMF3yPzvkZqUpugO/FyVCQWBEXejPo6fqZntZXy728QIzLxOTULmJmPpXLP9j8BLFLW4iPj5a8eq2tJJIEuLXN3S3tUCAytXHwMktggXY5hAlvYOBmgfYN4swaz0rOdcnm9C+mScWfX+WPuWAzIXgCa5440nqoDSetsj2VNgyBUxcdT4GwSZVo717vAOEuVQZtE51nZS0QZCHJg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(1076003)(508600001)(7416002)(8676002)(107886003)(8936002)(4326008)(86362001)(966005)(2616005)(186003)(6486002)(66946007)(66476007)(66556008)(110136005)(6666004)(52116002)(38100700002)(38350700002)(6512007)(26005)(54906003)(316002)(83380400001)(6506007)(2906002)(36756003)(5660300002)(55236004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3mQsVDhpfeHdsqQhl7YLigWPh6vIaYx/dbYDAnvEznrJuNI/qW/Un+QvTo6AAfKkMHcJEBhkDRRGDmg4f6Zvv1GQ5lp0EGZWegHrfSDQFvf4luwLmTFt54GLCK0CVqmqzZ/QIGljfv50js37p7vSFaPRy04w7ToizZq1RscJt829MPu1eeo9OtbJsWGuh/z62ZEGL+jUCCZ1F3ND5HThzaihx50xeSl95dCSzzZswN/P4JqogSfz1Zsl2QxzNo35FJqIF/kJMWAh+jC4PVq61FZqcH9Vzq4/qAhboayF8WSUykzhMicjJsYhiVnuuGLa7NgLm1Lm6h3azY/lzURaD/vNlLgIlYhXBv2+B3qXrx6s5odYAnPZ6L5e6dOziDMB8CsIPxK0nQwS6I1Zn70DrDL9SiJyRcU5QZQfPZCIVxY7aSdXkuMn59jTzyqnMpaLi5wnPtOkOYfqyarMQWnu5SLPjBaEtHP3satTWKM4wNb34IFMxqBthGUtTAY2Yi4QSs2a9jfW96iSOAGdRcKYCjeK/rCvx+/VPRYV+OIGgwACsjjA5gEzKOfhD3H0U6I/k/qmqCIWOsCc8KIlhn8XFpMJ7ii9u1KYbZuDHHQMoQyI/DuvG57N50SOLTn1fP+1pv164OEo4jwSjGSEPcflNfkiReqcKFNGrRDG2ubpmrMJIft40uI9Tlkp/d9BVe5NCiaFm9F+XdQkCyhqy6M3T9ovntkFmgyikEn98BBoUhw5Fe5oDyJZsFxEMOOmy9vQ7/BsWAcWyPLHMxG/pXOmxa44xNzaRjAL0+FAmlByMZp1fAhATLaruQbHwVNhmlVOkeoOu+gomEeCISUCMH/cPVGgBhzxdudCIxokfBC8fCUz7gM/y1F4mExqP1xGsqiPDJU6asbFGXC0rtViRFEbYOOOutEb3Mpg54GiER7DyTXJd515+BlcaZeACn+jkP2MJ1uhoHXxLvT+nXkepxIgKMkMsqRYTuzBipYDpEbgAzo+viCILUy/rbyRXrKd6VdPboL9G2eB6+n+ipEC/KxZ0yBwrdhcRxs2xT+S3AxJrvBmILZfWsEuojneBWmXGVsffj210pJoN3PoqNpwxJIKMsGGQ34SUYOsJ73/ehK9V3fixmbM06YRFi72cLFpqGlU8sLy1mCqfXdsw4/CXR0xHqVyAdL2q6LfJjkNgb+XMsDHCDtZtIL6Nlc1Ccj/5brcy+mP5YFSA/pMPstYgl9yROXBRO+gehozkRfUQ+Kw2vn0xQhAry5IJeQGQkSggJTkFcF8I35/5ssljDJYSTzeMraKeNINUCbEJvKKKH4XJf23wLiZ/GIDYZumd1sv8qxvfIUFBS1BvsRtws5dADpZyQ1DOgX55so3ktsCPTwIcN8sEO9oRjVsqpgYvnXO8OdSUsKG6DCIWQCN4AJcKoJj9ep/oC7NcRXRdqzJsAsT2aqqb6kwhBVWr+0qz87LFZoQFpfP3LZkGq/cASIYc0mUncDn5UcrFbpneY/YLfnahFGzumGJYilHmPobA4u0XBfl5V0l4aTOCLkBRa/uyVsVmgnC1wAlQJBaq6HS/dkr0DhAfzaWvKlRl6NiBxonrmP6yE/P+Ojjlzc2PmbpyUSxc0oS03wV8c8vZE0mtPyoVa8= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4564b66e-6f63-4fe4-978d-08d9d5d219d2 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:40.4122 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b8wzWFT4xYqF6kqJagPEi6f/CskE0AdbQ5oHRmsmrql2Iqrjbeu63P2hvFvOKFqtvei2yuEfyLU6pc7CNU/6NA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3693 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that when wrapping the arguments of conditional statements, an extra level of indentation should be added to distinguish arguments from the body of the statement. This guideline is described here: https://www.python.org/dev/peps/pep-0008/#indentation This patch either adds the indentation, or removes unnecessary wrapping. Signed-off-by: Joel Holdsworth --- git-p4.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/git-p4.py b/git-p4.py index 90e7922ebd..0159e35adc 100755 --- a/git-p4.py +++ b/git-p4.py @@ -1158,8 +1158,7 @@ def createOrUpdateBranchesFromOrigin(localRefPrefix="refs/remotes/p4/", silent=T originHead = line original = extractSettingsGitLog(extractLogMessageFromGitCommit(originHead)) - if ('depot-paths' not in original - or 'change' not in original): + if 'depot-paths' not in original or 'change' not in original: continue update = False @@ -2170,8 +2169,8 @@ def applyCommit(self, id): if regexp: # this file is a possibility...look for RCS keywords. for line in read_pipe_lines( - ["git", "diff", "%s^..%s" % (id, id), file], - raw=True): + ["git", "diff", "%s^..%s" % (id, id), file], + raw=True): if regexp.search(line): if verbose: print("got keyword match on %s in %s in %s" % (regex.pattern, line, file)) @@ -3181,9 +3180,9 @@ def streamP4FilesCb(self, marshalled): self.stream_file[k] = marshalled[k] if (verbose and - 'streamContentSize' in self.stream_file and - 'fileSize' in self.stream_file and - 'depotFile' in self.stream_file): + 'streamContentSize' in self.stream_file and + 'fileSize' in self.stream_file and + 'depotFile' in self.stream_file): size = int(self.stream_file["fileSize"]) if size > 0: progress = 100*self.stream_file['streamContentSize']/size @@ -4000,8 +3999,7 @@ def run(self, args): settings = extractSettingsGitLog(logMsg) self.readOptions(settings) - if ('depot-paths' in settings - and 'change' in settings): + if 'depot-paths' in settings and 'change' in settings: change = int(settings['change']) + 1 p4Change = max(p4Change, change) From patchwork Wed Jan 12 13:46:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3A2DC433EF for ; Wed, 12 Jan 2022 13:49:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353819AbiALNtf (ORCPT ); Wed, 12 Jan 2022 08:49:35 -0500 Received: from mail-dm6nam12on2043.outbound.protection.outlook.com ([40.107.243.43]:52832 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353702AbiALNtY (ORCPT ); Wed, 12 Jan 2022 08:49:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WKPjpQepNrL88U/Ch2NF0/KENPEkT+Ob7rEQfbF2qMHzteeB0cLAnxd4IUo1maNAUr6Ot/0lHOpmg6zYC8yGs6BpM1XGhZtXhaXC08bHia+LuJ2H9MftDDMuQmTIWgShHFogGI/hLvo8ohZNcSCYEZqh9yEB5bRH15kEzaEuaJfSAtvdNJ1GObIqUBacB/HB6i5AoRHz5+XlAeKZq3YzrbWWrN3SFbBml+fKoWTQGEOHL0FW3K9QyUfi0ev1K4qr5tTVeRmhLtgpaFNkwrOL9dhzZJ37o78gK8C+iknf8f2H1FusP/wAA+so8R6m28v/eh2nXRyzDz+VXHBmH7JNpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gnNTDoN4xzaqDr0abdNUHPVXha0GMNPM+9R55PFa0EU=; b=f6sRJIXHrbnH3DDJxO7aTOg+e85IdTMefC/AbvTCGChMDjF+vR6NeOdlWC1RqUyWLwmfKvTOw5oAWLJDgq/giXFW/uqP6QppXUDAXH/1AyjKk3dfDZm6nPPDX3HpIy10xkOnS8MyjNxpaAcHFO6vi9RnNxWTnh9yznmuo2mLJ2L67bcqfdNvhoCnM9q1/FFPD3qmHODHZaq50HtWj5287MiDxZk2gDknziboftxu3+cNz0X4rZZI88RS7jWDsRwIb8twmTxEck8FM7DVQlysnTouwtdiuAWjRjJmsR1RypWdc6NT4F9dDUc/f3vzllsFboSyETMlKQVAFtxxmdZhEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gnNTDoN4xzaqDr0abdNUHPVXha0GMNPM+9R55PFa0EU=; b=IKnvDzSqZ8favkhtY0TGGMIOcJskz1fk3d1n0JBGQcH/auOgVVaDdSt7Z2s/f9ewI70qV8JwbNEj4CliwX5JwCv18NwM8L8bxEuTypfzOq3XjMl4WSpHE/FttfOwN1ryD+vBIPk0qYP/mi0gVF4Xut/4GjyNoHQJOS9Rz4d3ouo51QtedLrcNjUeTCM42j51vyVEZBKlyFrFpGhGNuGtIwD2KfLEQP0Z8oMp1W2qAEXysfUbBgXLCA3fVp0nJtys6AFCE8vDLm7hYZF+bI7Z1nvsGDepKtn05xhzMduQzkKNeaoyNmx2TCsUPmL8pmUUrMzWW9AQYU+5Pf6hKzBKog== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:43 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:43 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 17/20] git-p4: compare to singletons with "is" and "is not" Date: Wed, 12 Jan 2022 13:46:32 +0000 Message-Id: <20220112134635.177877-18-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d784eb4c-2ae6-4c28-7b08-08d9d5d21b1b X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j6LjO7ii9HafjeqOtQWm4W96ASmmNo5sK5ZT3/kM82Er1JZ5roe5om2zdXcoX93QWkfkr6LI+F5BtkoZS61b3jzeiDA5xCby/TrGJL9G6Cd31u7GGbj2fd0meG9bVXxWtnX0oo7q6U/qr9JoYOiqHGTAU+x5H3NBG3F/2NiYmjuJUO+Qg6ZTSPeGqXbGiZxcR+2/gksgjx0sBN1di/5jv5q8cLIKQDG5Ao9k2LTxkl+/kr8WElD+WYC3oaBt7SaIVyPyYwiaPT2pA/minB/Lbk+yiedjxxYfNuRCxr9vCtAud87wynFFpkQAIrQjIjlN9u0LRCEk3vxpiJ6FyvnmgBV4ASWbSEE+79K6nA7Eu/F5HJGc0lrm+hmeZUkvf7q90W1fGb8FNy6wTbgcbPrbSyuaL0E0QIlv/yqtG9auEusev1ipHlVSPnwzFYMoLAeS++qm7ny3ESKVqfh5i4VEsVABZ28NW3NUZ4Z5o/syW3v4VLs/DecXcBXprYlJ4pA9rFktl704kdiK/Q1MejLk5S+R+zodlnVXNAEFTReWrgfnkryYtnb8uGmVmhCgg1NNiWG/tIJy9R8DhQN2j5jCcAH7E423yOIIvAjomQGruSmhePsuIrmnz4FHbHz30lgpanqwp/29M/91F/kJnUqrbvawsDt2git5yi99AeNbrpj9PnDssDsSkAJ5ZADaHA887gmFjN8RBh2VrHHwNd9BI3JWgai6mYtAkjSpfLgCka2YK4rbFG2RVJVvykQ8vEymPUDvGctnyxv3bWNSk+UPhOWi5Rih78/BPwUy6gv1uI4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +Xk/AZk5BS1irkuOmMQLXvlSat/qaeHVMm8hkQeWhH/NR4keFhClLy154z9e/Ji6JRtn3ed42tSDDUsABbDrmU2qhHEmeTCsSkdwJOoGDED1UHUBlqdDcPLSMCFbdRhipffT4nnC95r24ppUaAtiP0HE8lLUl4E0ZtJs7Eqd7VqEHJSYqnOxBt6SfdnirQfyepuIeOsOmecLpx80o8yIn0o6DtldMWV357ha5vlYZqvjt6sT8ZO19FrS0EkEDWrSKQt6PQhpxc0Uf8PiQkVTwxUWmArRiHwZVX80eYDb+SnqbkYcIhkAXyZKX7lFrEVEjE03K9m4WG+mF+deVfbAWV/jPSbdM20NfcKh9YF36CxLFl4TWneIRdnldOJeGmfz87tMxTMt7CF0MeKoM1dQMbkceTDOqoGezGca7ovq/fGp0u6+b6zHcLLpikcMQSUDFhs40c9K0OEW53aMwTX43kJOUfhO47fkNOZTZIWTnzi9ve/u3dQdijH6HHXkG0rZvY9dXwMY5F66VqU9y+DML5ZJ2slDBhwSx7NlYQZCYxOuPTaPmie8UvKftiONDrZDcU74vMJkpzhNX1gSi2jNQC8wW9UIThwMqEgHNRRRK6Tdq452dC551M8bezfJq4skvEjLjvv809Ho/u7P5UmGFzUUKXqWydddqtDUjhvOH/pMSi+9i3kgH9pPSqXHMD/PtBacsPWRV1hWc1F8U1MesiXfYmNiUtXOyz5sOKI176wvwyfliNZGBGAPW8xCVhep9kh4w3hmHxmNyPPPDIh0AdFgS3UMjp6RJMkRDzptupKwUwQxlEi0Dtz+ikmDfGSVIJZoy1SAagYkbSNHTxbacwb8cq+lSV5xXJlMPetPY5lEtIFUPoCV1GeSy9W8vLiOf8LryyEt8vLuVRmsZ0RKwG83Teff3j4cKbt3gtKRRh4apBSwZY3cmQMHoXV9S7rIhLft2rAHoRBZC2x99124Lvk1bL12w+l35KemZ4A/m7SoFIj/LSLkYXiz4QxNCtGXItmyfXWkzL2Uqq/HSV/rp3raaobJFItloiX/rY/6lXSBHg4pu+bf1MuWR0t/ljR7iSDmM4wNWRxqG1f2cwBNAt2AfV9D+SUS7PUMSa/w4AanK9JKz4otRUzPTmYxGsgR7xfTp2cXdIdDwf2ySPGYX/5EXgk30DtuEgrak5YEk5eAwVxqMwkw9ErI1g8cMC3MNBI1nh2e8BLoPPGlp8IQo/+zfCgt7oUhFfCYotFAMaq1tK03OHlJUTHnGyF6V9zj9zf6QcHg1uL3GVZCEuiDtwQUwk67Cj7MIppcqYYKSf+g10mY36LKIcq++qdWH0WKmF2GqfsXKHARvGzBZb1g4LAWCn4HYsqteeyuqTfnkB4CJeVWNojlNl+FYKJghtw8tuOuDZlXAhmKzzjJHuECGl9Y+PqH7f4Wqosex0twMPYGqtLxrRQRDGBtZRkBatas2qK5jM5sdJNKN7XXaVv0wXp16UnXldxvr4e0uN5AOXmDvpf6SoQFuXh0kiVby+WIC7w3BCgqvsvuJoOKDVN6v1saLi45YqfMmDQE8B0lsqCvjT+1LbuJFs7Nk4inPD2FSBQM6/exGNEMZHfnbSPmaQWIylD96mwjfxFTFS6X8/U= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d784eb4c-2ae6-4c28-7b08-08d9d5d21b1b X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:43.0518 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HhJ8YFI4qkGDDC2hrLj2xWdbNYBL2mx84uwFEf7SdIXsj7HNcX9f1et/OFOgYVVkitaVN4oaGL/qg+hAm776ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that comparisons with singletons such as None should be done with "is" and "is not", and never equality operators. This guideline is described here: https://www.python.org/dev/peps/pep-0008/#programming-recommendations Signed-off-by: Joel Holdsworth --- git-p4.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git-p4.py b/git-p4.py index 0159e35adc..2a3409ebd2 100755 --- a/git-p4.py +++ b/git-p4.py @@ -930,7 +930,7 @@ def p4Where(depotPath): if data[:space] == depotPath: output = entry break - if output == None: + if not output: return "" if output["code"] == "error": return "" @@ -952,7 +952,7 @@ def currentGitBranch(): def isValidGitDir(path): - return git_dir(path) != None + return git_dir(path) is not None def parseRevision(ref): @@ -4497,7 +4497,7 @@ def main(): global verbose verbose = cmd.verbose if cmd.needsGit: - if cmd.gitdir == None: + if not cmd.gitdir: cmd.gitdir = os.path.abspath(".git") if not isValidGitDir(cmd.gitdir): # "rev-parse --git-dir" without arguments will try $PWD/.git From patchwork Wed Jan 12 13:46:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FCA8C4332F for ; Wed, 12 Jan 2022 13:49:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353845AbiALNti (ORCPT ); Wed, 12 Jan 2022 08:49:38 -0500 Received: from mail-dm6nam12on2043.outbound.protection.outlook.com ([40.107.243.43]:61056 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353738AbiALNtZ (ORCPT ); Wed, 12 Jan 2022 08:49:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RoFvvVdE5syALkYirs5KfYKZrfdqj64Ji62K9lQCnCzwDjd6on+c/Jts3Dt5OthGWkV+QZrD5VzH7wRqJuYR0OHNeOdNSIDMK2hvGnGDRdGWC6MT3wcHfMKTWUR0dPpQoLsEZCRm2Ay5fP1J+npCPw0b2Gv2S8ExhWeNBjQF91eYfm3fdzqpRV3dDelxkazAk+BPZlon8fdWIsDIp8V1Bxt3kUfqkyW9RUv0k0/0UtUp7v1l3MqlJnezkUUS90LUqG/FqbVP5ZS+Q+UhQrblUrteKmliNGhdm7EO0azAJYfnh4D9mM0LoLxCSYdE2FHvCP/H/pXasINFW/H1yhkyTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P4RW3CwHRu5AhWGd8SBYcPwqw6ICbvKjUmwancHoanM=; b=gFNOsYA3MvaLDiJrH6Vm8Z0PNY7XukCBlwzouLo0O8eyqs6eSmyMzYAF4NPnLAKb6Fs+ahsBp0NQVl5DH0IrNTh7gLFXB+n9IYGq6oT2bM+i5ZY0/Cczg1sahxFKkazUAx7tr/BYg1nihxwwSUEhQV7RcTdsjo097Gn1XZ1ThrDqFBvrtYMHXFNclfPUzgqQuBJiazZRqZAL/b64ShTfXQci/NkpyKjdJZaEyj00KqcyFxkC3qVP/JCOoKsiRfbxNWzmSnofYdZGEuwHSWjzT2EDl/ZR5S5xw4TNvJezdKFemHtwgfqcb0WeXQ/sRzmDOPNHwiJQbJ4Vixi9WB/qGA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P4RW3CwHRu5AhWGd8SBYcPwqw6ICbvKjUmwancHoanM=; b=jbSHlv8hgERRdFmIz5OHB67NN+awOM2RFmRJzjXG7INBmIQVXGyPkZ0rQwdUGX7Vy4Qs7MpR9Yqalw0A4ApfSGF0gJ8mnl/hzlOzE03D9fTj+W1A1uLcHiWvHXAuxL2ibg0Vjb1MAOjIHwYxYQjEXWjcZCWmTVvcRS1xagB0AI/gyrLHdku7oS6RJyyzBfHsLpHcxdK05wjBFmqxy5IV7hLZVppRu2y0OwFRO0eI/EMRIcL08k7BrTaetxJ/GEPUKmvc3R6eFUBI28i4D/fcU4fC9CpZVbm9+6hF4l3FkwoeWtZ7BL2XAo5SneO4UGtjMkqDjrC3xwrZWkoZvDMr/A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:45 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:45 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 18/20] git-p4: only seperate code blocks by a single empty line Date: Wed, 12 Jan 2022 13:46:33 +0000 Message-Id: <20220112134635.177877-19-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1063e25c-27ca-4499-fede-08d9d5d21c85 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TdA5zKtSKqKVI7WfXv5N6D8k4FFjqFjWe1yPSIGS2rcndYUU74CAY5pxm1VM3jKOZ3Ik70ux6ZsVlu8xTNJl1KvRTDuq2sHo6QBuzh3Ia20Lk/ote7C26EQm+KkWvIMnVqeWQUV0Ybi3Pl7eqZJhNKbZZEiQaKTevfAOLqmfWpRWDyK4f/czC0Bx6YMKtrRsAsfsSo4A2XU7e2SKYa4KrVMrhU8vJR15skxGhJit5F+9hRXlPeO5p3SWcckPSo80hNWlLsITfMWkWTVYyCQ2TjWLU7eE68TnHQIYkck+8p6v/XrofFcS1nptq9AjfP9dS6W1ea6l0vvbt8ma+H40GXECDi93HpIS6cPPXq5EotGz7+VDUEwNktGEqQIyrmkj4CxP4pnp/97GpbTyzVPYSKxJUqKicW3Le+zG+jqWQMGCLiySqdXzmJ4AiZ+TOEsqlAIPafivNVuOsP0Y67yFq13gkqtJtrAJQ7X4pihvNsFp+0et397IsHj7rfLEwCrBRuUO4e45mRXoIWq8RR3HgyGrsPTtfxYDCP7cy84dgNhkGMd2I0FsGfU7LQ4cRixsoJ86MpbArc3Bktp0RbIn+9ug6aW2cV7A8/rS6sBmYdCROSNbmefzwvQeAGWighZXzm8PZbJ6wa+FrO4ict7UW1dWYkYL7SiZkoq+sF03PyBvXeg6bRPYsERFCh39iBbZSfWXQB4gWfYHhkT54rmlZZ2catl0BuRTfCWjupT3obCHqm5Z2xCqyDGRluOXzU7k/1/gY44k7qMXhw5cQ6wcMh6Ma5mYB9hByhxLZ3IZaLw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(4744005)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0yEh4FFpG42SFbW+heIP8fEfpkMLCaYdbdJcE9FAjbk4ZSY623zXv4WzzMVscdaC+ocIOJFsdPO4kGIdS7QcNC8LRyysx/O24VqIf/QrF+C4ieiYKZ0iez0QUvqJsX51rL7cVL/DUzxDuRu13p4c1TsAfRYAVqPZPJoMiAKGMoc3jaf79hL78AtVfIFfLgJUNF5KSZZcmikT4SaQU6bw5FZirH9DsN6tAvnQ2J095sjK1SNKja3wd51MjYkHMZ2vttWAT7U40AT1q18mHgOupgZhpDLXTQoOFUx7dsEDZ8vCKzuCzGOGESTY8QLGzpLE2aBtbxJ7csFOwecyLjr72V4MwmCiSIFHemWmuZciDzrevB+YYz3VpWLPPVO6IXxahkXD54P9qufLrCAFBIEtSXfEQKLt304EODen38sTh8LuFttT54mxk8LoNpL9CONlETUmnp52XiQFiGcJqB1iLh+QKDtL6G3SapppxEqwmIBdb9trH4TrQcNPBU+RjPjraF061QUlCpjsu7dFtYya3swVDBPmFS+3LsGeOKsBSgfXCHKWCQ3A2mCnQPzjPjqFIeWd24b1D5O39KiIuzuAO2SMmzQkKhJQEuM3Vr4DPKs6yRvOvIB9NX73IZfkoLcLm8c+ajzFSCWEnJNzVQIiOTRaYPUIBlMcMglE0Vh4XruDg/gOWlQhoTgdWDEY5opE7K13WSk+lDNJBoUKef7q52GCzIAdlmJBhE7BDOQDoSbvXRLBerOohgGgmEUsh8HSx7uBGXtfPXpvu66PdZavWcGUdpGx21tAb+IVtVDDNYOK1ztFc1MuzIXteDjSiJgnpRUN33UNIK9gawf3PR2eKzF6UrvoU0Gz8gbGt0BYfNcqk909KMKxBXxuT8gnRey3LQOEIxGYyRYJayuzWZsnOYStCyWk3vjiJo10O/N2atR572EtXkOgGMuqU9/vxTeFL1meYXrzLNJQ1tfRm95uyA8iklzv67yiVBR3nJojAW7Arctgv+NhSK5mz2I9P70cHaECePgDMthuWD/KrBCXizSJPt/8zfEKBLgcbhYgQOTHxZmtM6SMWvWsoxtO9T4Nbiacx+PmbqQ2hY3Dt3O+gnA9y6qIpcIySZbMoDCI1ysBzhxDiAThQLYoHjF8ba4Hp1uuIYmzDDs02vd2IZzKhMgEELD1AQIA4Jt2O+np9hBmmOi54bLL8IRwsGWpsuaC6UpBHqcUXBAnsvZMyBTRuqnDPYh/JcvKCP4tIeGH7QsiuTXi+JBA/eka2uwKBfcFqsDYteVzI5I4mAfoKGA+Zl5EgfpLHERAMW5OPLD87Ky9lWqx11McGEp4lVp7FTnO1sWn/2s/NyNVJTk8sXYrqlbII531P75Lv5Xc6x4MwPia9N0drXN4R0VJWVjHcDJMq6+YxM5WBA0OjS/3RWbhGjPnAAdBlOQ4wh0P3QAj2BjlcSexRPdTLa7etdtHf/A+B51j4hpliHANkMgf4ppJ3TWJvKsT5G88NVtUbG0kB5Gkks1vyD6xTO7KptSYwkwiNvKGHDNmhLVbTcmMoDKLfflO0GypapGKhBSpEcbW0YkAqncuDmcLLLKjMn1xsePDEt9E6U6nQvNirZbGPM3KpU/nhXnpYX0tChat8cjy/j8= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1063e25c-27ca-4499-fede-08d9d5d21c85 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:45.0058 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Zkj6lf8+O/W+QclTCi+iALnTbpIvTFeemvbRj7gHr4BmZwaBT902UL9OTD/vqazlOVMiC6BNwb5FnJCU45K2MQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that blank lines should be used sparingly to separate sections in the "Blank Lines" section: https://www.python.org/dev/peps/pep-0008/#blank-lines This patch replaces all double blank-line separations with a single blank line. Signed-off-by: Joel Holdsworth --- git-p4.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/git-p4.py b/git-p4.py index 2a3409ebd2..58f11ee41c 100755 --- a/git-p4.py +++ b/git-p4.py @@ -3593,7 +3593,6 @@ def getBranchMapping(self): if source not in self.knownBranches: lostAndFoundBranches.add(source) - for branch in lostAndFoundBranches: self.knownBranches[branch] = branch @@ -3816,7 +3815,6 @@ def importHeadRevision(self, revision): sys.stderr.write("p4 exitcode: %s\n" % info['p4ExitCode']) sys.exit(1) - change = int(info["change"]) if change > newestRevision: newestRevision = change From patchwork Wed Jan 12 13:46:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8214C433FE for ; Wed, 12 Jan 2022 13:49:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236601AbiALNtr (ORCPT ); Wed, 12 Jan 2022 08:49:47 -0500 Received: from mail-dm6nam12on2078.outbound.protection.outlook.com ([40.107.243.78]:40385 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353718AbiALNt2 (ORCPT ); Wed, 12 Jan 2022 08:49:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qtu0xKGeXDIBrcCxdrX875rVxeFVokISD5hQbBCbNUuVs29Q8UNQISfW64OE5XaubnJKsYQxIaxMLXgnWap0tHzTZHXJvh7pXOVDMQencoJVU7c4SA0OFPS1jQJlrglHspM5CuQ09v/jzQmVE9UmdmzAMvgIMm+vAZqAz8ueqFdNG2GfQG28oRShrDt0+KNf44uR1ppoRyoJisaY7707MDYbeQmSxFyU7plPaXnjMfPpF0QxWnHQ+LLfd6S3mlgsdOcIERhsuLtpDhpR/kmzH3yECIj+bLYpAxyXtvFhUatPlZjAncrUohAREJEHEZ9YCYcqone3/6uNeA66EYhQjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=a8THQx7vUhHUkQHXXrq+Fqy1HPrS47oxZYaXKIpXX/8=; b=FgVXhWORjC/zIA3mMgshrQhz/Hx7B9muXwnpiPi1e38o45GACrVaLv0lhAio0SQM61oZez0JmQw56L8okTCXRErEXurlLwSJc+oLi5t2ZKxBunkv5uMJVh021ZR+K2lJyBWpxWhbCl+xbPZt4aDLzXgyIWs9jFNXpm1jFxOtoTSkf5sfpwY3fnUHErtZ1f8BVr3mI4pYZ6cXFPACy0ELX4jBwPIU2GNI34I/ewA+muIS5KROI7QqeHqdDJuwHReb3+Anj71id83A0VOStL+mF+pmxbILw++94VdpIL8Cw64XLqDJgu5ay0wlOCBkAkv4MD9cQIoiiJhbAMkQGOvPxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a8THQx7vUhHUkQHXXrq+Fqy1HPrS47oxZYaXKIpXX/8=; b=VwCSC2PtSJV6W3IzuNvEH9USs08ebuaIOLvfEiAcOoAZNJYN5ZkiOD8s9mvkOqHG9vJG9M3y+vccau+V/4JRIPTRIrGKryySQZ/strAuMNIQs2OLKzFsf4KN+zgmUyR0yGAT5WQYHT2ohurbWXPc0KbeLvg298KWfDadx529RAWOC+ZYblf6a+ul5O83m6BmgTs3yhVYVet6JOzoqXHl0Jsb08Sx7OzSw15s+cybdNh2cOMqM3+XoIyLI4ybh6v052s73NHeZbfyQvpPoIM8dmDYczeJTWPOvskDlTqQU7illtdRuPJpgXXwm7/wewhOV02Guuo/9kSqEOosvm8kcg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:47 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:46 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 19/20] git-p4: move inline comments to line above Date: Wed, 12 Jan 2022 13:46:34 +0000 Message-Id: <20220112134635.177877-20-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8f2ba8c-9929-4dd2-69f6-08d9d5d21dab X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:644; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qFv5HTaUNGoF03PJxFblh0dF3NsvNOZ+Qqu8sTfk97GPi0OdznAe+lXi68XcmiEwbVOWaVFtdsY/UJMx6xLu/B+1JUQ5HH7xaHfDke9rejGACzlRuR39YBJjcibD6zYF2+/eNojKzfZXeyxEPvdt9InIN9F9AhAdcWkP+l7sziZwc72tpmpXQTCKjy30QuoETvuSJQShc8HrviF9zwhjych8alvlG0gzr6gvyGmiaPEJ4PXYlcQF74mXYXTrRtyZe0tmJQ/IYxvgmYruRZt0h5V9G0+Fr5vKS19TJs7E88YY3Cvy3eEVDqf6ooyKn/Fp8Pl2xW8TTkjivx02LgZbjMsIcm/70tRRJhujTemjIvsNt7Vl+YeanFlgqtB5CnExpoi3blCz2wNAeXdMkpUdKPxN7K35rHzAk2j/R5Yj/rquSt9ZxwP9y6CL48evZETx7e34Zi50B0hNC3filZJegewZuzEDd/1m5D/ijP1KmVIs1zkKPVhgS8D45UsK+tNQIxShKjNXGu4/M/lAkb+5n3TbVRcsMsnToTow2mlMFvWCoeNdKwxsJZETo95OqIZMMNrz6A4LDwVfeDA2jQxa5cTZP6Xq3u36ExD7rWLo0HNUUuRG5iVRXVGlZPOirij6enTJLFD2mrdUdF3mQVuQ3l8rEVcZm5U5mRd6J8ep7KidwjTrQolzmcZv0/vu2ajcpQctBMU8THpNvRcuo26ddWjNZQBV9G6hdoy+qcZS0GWLEOfqQSjwtykDhLE7PGe414hk48H2bdoX9iH7Uo1R+iLgf78V/VsLpGg0WcKJchY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kexRXGLkl9BNVw936H716qbfkNuLdV8f6KFSzDq2+Uyo2OuQDBrTPo6csLHU5CqK+UKAKU1TX0mA+3k3wMmNfdZ/notpiimbI88AHbTRrWHkWXJ3RgYnsX5srM4W/z5XFxSfhRZpIpr4dVDjKNN7bxdcvjTqNiv0FhomLvgc+aRKEweGTNE1afubf22HhvMq0v1OGHxxciUe26VYXfbgEnJ5ZKmRWRZNe77auZefx+01ah6RSankAQcge0ulFFylBRFsZWksY0j/+wjqosImJmfR5kVR65KVuQIut34huWjs9QqsQwlwucYn0v4eWYFVG3FjTJpQcQHSV2rkipnzbh2kXCNIlL8i1MJjODj8SMO5HDHEIYDkReNFU/JILSwOGdM2eNe9HdiLPBVeY7K+NogL4ZNkVLZRF3x+PFiZzZQip1zhNd5nvzshpamctsNKk7V9++1lEaGVB1J99SdRoEBhFHkCQy5qPNfc4LrT4reUXhB4SnRzZiuK7S1lWgtgpoPeGHlCsQNwC/yNyVYOqFVNsR5EElAMr8su91pnEItlgDA+qywELVT+tK6+bL8VH2kS7hc1y+8rb6A2pNUtHBsqNVwDeMc+HHyKYvznAC62EVsNYiWr6mXnzB9vZMZKRYIrEpj0dntyXHIQ5VmGPP60jkNk2TV7RLvELkSjA04V5Or7ljg5+A7vTsnYtujPNWiQPBtOM7PneMteqmgNELZ3Ll6Yz6G+z1ampa8rGSfyRdo6bd047wel/goamEoJHom4Sb2rL3QIUJTZdL0skEgZPewYK7xblkQl5go3/rvgv0V6NAvmG9zyMKHKc0lgv2y/P6suhdxFV4UhqiPgGTPo3JUz74POXBd3WCN6RbDPtP0fHC18WI6EvEdajEbpZatAoIItyvOmNYVQUcvgZjaXy2PjBYqvvP9Aynnm/mpfU6fosNh5BgVFPWxCbLHgsHTe7mQS+o80P2sBurZWRa+grWukFynIsc4bHzjmX1PZBq9rEqtSEF6yO88Y6Kbthtx5yDXyLcEbhddrJOrRZJ7CtKEmSau1m4LGRHnqb1lQXg1FxhjIyzNR30G1bw/U8YXUFSieAmIxGPMwRm80WfEdGsUQZb4g9/KbtvOQN0l3BLEEe5UWiLPL7OeqJi1/Nes7RS5Xagvidl8+aCcbnFbD6G5QdgmEZK8QXoyeWTxMSXNHKDOaIjnRqfMD20LhUJOuDtXBXJ3IhVxlFJfsBkop5xiF0lEAk8d0oDpdXJ6MEe3XUagxg10EknI78U0tHzEivV9yazV5wH2+K8Jx61KBjoWLStsQ1sZ9pUG/WyjvEXPaYeCPQxXuU7MFfiyTKJHUQLnjrx9SR/SHvd4Ym+LOmAILS+ukn6wYJmfVv+8Aoh8pPFkxfjHBlIz1D9KLLfHuQzc2ZcaWkgNwYHrpiVaiTX8EQWsqngqkTLP13fTV/8TOqUbHbVmnMITFzBUs6uR0hkaRLVVRZxAvAuAcctaN1+1Ygqy4bBKpDsgSafKJPlUCjooPWIk6RyYwDm3AyldqSZfpHl0JRILu7WqDPv1XjK/pGTXXqZ18cZwj+ibzxDDeX2rv0NTzZ2eI3v8mZnGO/LvFXpoF9Wz+JLWzYB+jaX9yG0kwJcn6g/TiNz0= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8f2ba8c-9929-4dd2-69f6-08d9d5d21dab X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:46.8975 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GC4xt1Dc/jh/RrKUg5wKfc51GJulm4ejeYwvv+lNsY16Yq9Whhkyxr915kyPJy/q48m6Mrk/razr8avvko8/SA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 recommends that all inline comments should be separated from code by two spaces, in the "Inline Comments" section: https://www.python.org/dev/peps/pep-0008/#inline-comments However, because all instances of these inline comments extended to an excessive line length, they have been moved onto a seprate line. Signed-off-by: Joel Holdsworth --- git-p4.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/git-p4.py b/git-p4.py index 58f11ee41c..679667611c 100755 --- a/git-p4.py +++ b/git-p4.py @@ -2052,7 +2052,9 @@ def get_diff_description(self, editedFiles, filesToAdd, symlinks): for line in f.readlines(): newdiff += "+" + line except UnicodeDecodeError: - pass # Found non-text data and skip, since diff description should only include text + # Found non-text data and skip, since diff description + # should only include text + pass f.close() return (diff + newdiff).replace('\r\n', '\n') @@ -3044,7 +3046,8 @@ def streamOneP4File(self, file, contents): if 'fileSize' in self.stream_file: size = int(self.stream_file['fileSize']) else: - size = 0 # deleted files don't get a fileSize apparently + # Deleted files don't get a fileSize apparently + size = 0 sys.stdout.write('\r%s --> %s (%s)\n' % ( file_path, relPath, format_size_human_readable(size))) sys.stdout.flush() @@ -4303,7 +4306,8 @@ def renameBranch(self, branch_name): for i in range(0, 1000): backup_branch_name = "{0}.{1}".format(branch_name, i) if not gitBranchExists(backup_branch_name): - gitUpdateRef(backup_branch_name, branch_name) # copy ref to backup + # Copy ref to backup + gitUpdateRef(backup_branch_name, branch_name) gitDeleteRef(branch_name) found = True print("renamed old unshelve branch to {0}".format(backup_branch_name)) From patchwork Wed Jan 12 13:46:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Holdsworth X-Patchwork-Id: 12711424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D004EC4332F for ; Wed, 12 Jan 2022 13:49:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353729AbiALNtu (ORCPT ); Wed, 12 Jan 2022 08:49:50 -0500 Received: from mail-dm6nam12on2073.outbound.protection.outlook.com ([40.107.243.73]:36313 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353750AbiALNt3 (ORCPT ); Wed, 12 Jan 2022 08:49:29 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AU9C4sEFIeHjVE9s34T8tGvz9ddV3Ri5PpM3lQBYvajz8iWXqcT3lRUDJVZW/XbSURlcvCMWsdytXswd+dj6YHdCEabQWu5bTpBQM0NUBd8hMgm41QHjwF2UWxhk48NcwtKpgqZXj0xXOrubUvOpvrvsm0kkdqZa7JogIoK1sW6Oxprj8U/tP7K2AfGr+HguAbWNva5YhYxBNl8OhLuv28tttdldM6Cbx+qJm8gwOLf6o5VMVMO2Ge8DENM2JovGy0F/J9VOEzX3DOESnQ4DWqRkm+AvegOh90niPg/Bp2s63hVJPaqnlgTNElEvt3GeEEVm+tk21AH8v/2eR7ritA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=guICCNkFX+arutrgwnNHO1HhiNMo4pA0QwG4Ge82WQ8=; b=UoYii3izMQA7EMNgqXYX8iDJ5yaqTGocYD7nGjJq/72CzUSt1h4DpOSzP9qzaJ5cMXRSw4cl2VJoxYAjVdYbWXgvqIIGSeh/gVSfYEFkWHL8cxjZZB5uAVVeZFb0nj6qEBEhTdSL5Haoi8GJ94QCQsI4V0eQPedN0ycFS8V1H5u/Ht1UKt8Oi6XPjAL2VKjE37D3YGzf+sx2F1d6JeWg8fX9ctrNwcFRzsvZ68NCs9z9ZuvWyRc5uJDpkC+xvATyfXd3srbIWusF61EPJ8CtyfKrNtL5cx8Zut35BA2qmEura0lRwSW24HSYrwtYmV10+BakUE4zd+680h1G7BOkOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=guICCNkFX+arutrgwnNHO1HhiNMo4pA0QwG4Ge82WQ8=; b=V0ZHVqdfkDbmChlUcyC9gghd4gAVAx/9+EsKBD+8zqnvTnPzvYFlicSRr+OqqTb+d9gFmtB+JdiUnM/XkZHYdUZnE9PqIunDwEjwq78Bd+EGteNrcLGeMd7PUipQZulweO1vlZNl7/z9DKmEDvD0Nq8bqa98BTs2DVGkuT07H8QMXpmTtkBbmVQxmISnW7FEdNWJhdo6iH3h9/0fns+R8HdyAV+mxirufB49iY5rpNSLfjNpAlfj21lMKsrpNv+pYptFPJyZL2F0jjE8LuLOoTHPMPIp1t1u660ak45onHZRCOKhdW5Ih9eJ4fQIxQEidiExOPP7vDThe51OKuDSyA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) by DM5PR12MB1594.namprd12.prod.outlook.com (2603:10b6:4:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Wed, 12 Jan 2022 13:47:49 +0000 Received: from BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed]) by BL0PR12MB4849.namprd12.prod.outlook.com ([fe80::509e:bbb9:e1fb:26ed%4]) with mapi id 15.20.4888.010; Wed, 12 Jan 2022 13:47:49 +0000 From: Joel Holdsworth To: git@vger.kernel.org, Luke Diamand , Junio C Hamano , Eric Sunshine Cc: Tzadik Vanderhoof , Dorgon Chang , Joachim Kuebart , Daniel Levin , Johannes Schindelin , Ben Keene , Andrew Oakley , Joel Holdsworth Subject: [PATCH 20/20] git-p4: seperate multiple statements onto seperate lines Date: Wed, 12 Jan 2022 13:46:35 +0000 Message-Id: <20220112134635.177877-21-jholdsworth@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220112134635.177877-1-jholdsworth@nvidia.com> References: <20220112134635.177877-1-jholdsworth@nvidia.com> X-ClientProxiedBy: AM3PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:207::21) To BL0PR12MB4849.namprd12.prod.outlook.com (2603:10b6:208:1c2::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec453e51-b06e-4311-f6af-08d9d5d21ef6 X-MS-TrafficTypeDiagnostic: DM5PR12MB1594:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /Ih6UZYUTZkN07V3ND/wUeC1O1IqC8vkpkmdv+RZl0LWpPKJMpoEqE/5F1fCTvql8WN3iKLLScDFeBadvfMvJ1rcfMwmAhvuAVhJlGkr40Ff5XcGc4W4olrSdAqmGxPnvxCTg3jQVK6Y98K4touVksNgdp47qWmxGgOCvnYL9Lg2PhbN30oDefz3ZAqBWoECdNqUpdw9UtpuN3w4yej/rNvnXAuDG3giXVESyyS225fNtlqfuPQmoM3Q/SwJbfFTmxs1GgLKQSkXd9tQuNn+6BHbaiTmtyMdRKKJBH2E1f0LNrQe6ixF3dAlM3UrvGEvX3EYwM0hQglSKVI0+gAc5OwBgFcWmeI+VpSbIPLiFK4bJhjEPeCqySve5I4dUSDK/oBy1yn3gQAVuqBFOt8pZQKMfw8lJVOV7QD3lwiClneg0/b0+chYWoTuMoaHNstIksMtQM2s6apZTXePpeyPH95gV5HTDy5euQn3ndFzLtmFmebe2DUZgkKQ95FNuCNheRibhiq7+wyVR2MU3gpLsnz3tptbh6nk27qSevpScJrN0pYcwdsXLDPQ8KfneBYiK7oqbAltxR1vZWCBNeeaIRYImpNkUB02wggNY8YBCkMIdcGPLMNSbiTEYWoHc/xUKZ3UIyTFbuma/3VZKFsjA4hOMFSNQm8JgtwUDsvagtGalnDKdDT6fg0XITnX7AN2lIKl4fRmq2P9x9z0X5d/2jsVOD53me+oKU8c26Lwt+4eyuSy+nCNbjktI3TQB9iVDggBX05iSC7Fy5bPWQoUDh61o0D4aPj/MbaPuVexhEA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB4849.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(5660300002)(1076003)(26005)(38350700002)(2616005)(55236004)(186003)(54906003)(66946007)(52116002)(38100700002)(6666004)(8936002)(7416002)(83380400001)(8676002)(107886003)(66476007)(6512007)(508600001)(36756003)(316002)(86362001)(6506007)(2906002)(4326008)(110136005)(66556008)(966005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IrtX1VAzOYjOn80lCLevczj0P3GMfn6DdXl0XWKb+vnE6P6X673WYOTJIDobyAxVSNim5KnfIkKn6ryXDVrEFIcpV76ek20goRqzduIs93tIV5OrGzwgh2PCy6Yx7n0RzDPx1crU1KbXv95DGFhY3kTHjkgfb/3y+hfvWHHOdI8mkNk8VmuR3yfMDAUBNlk/jUXsHMcBwYNs77MmccpmsYJbEwrg4FU5OnIFmgSYdyNBVgAv3vKAJuT2i8VDZR4Oc80ostI7gZZdFSZ12G0pqtA6Spor7+iGKl9kTMoTV7xAfdMmcP3cOBulLUbjNPjl2Ob1Npeivh1Y+B5WuzzjsVsQzvumHe1H9Jt6/LsnGIpQqu0t40PMwAS86KXOQfMq9CcGcxT360dzlvC66vg4thCrQXNppJxoO9hjQ2Pe6nehrDlmefrWSOLIxb/KSscCwYucCgo3Dr2iWn4LycGGxZDAzV2Y9Y97ZlWkKJQYnkYqG9ykCHto1kbta+N/E+aSAwNxHDezQh0Vwqx0QPytTjlsZP5tHESLajKdLb5Tar6UfydzQP9pbK0Z29XKkHVmjRLg2qFcKQXB2OKzw0sCV5aWDqyopMpXNGDr9mXRJD9yUBSiKPcfscBh8opVnnIygzg0ejCLPH+vp7V7qguPG3jyC1ezq62DtVySPepAEZB0i9VOejyxHquMAik2/MOmlzNpLekFXrdfdEJCaFGfiFgco67jRlVH6ag2JLolExGxSBvtrz17m1/8RdtIUfbpJQviR6F/xf7BE+U/FbPIx+BNx0QkM4v/e3uihBm5+tXUyGxAn2YBmm45AI22zwmelfyvKrkUjOAjlxir/jDcHbt0hEtXNEbYMxKbioKuab5ScLTyI1k40oVvI38jkzx29P/Mg/qBmXKhVJBdy2ma2aEb3BWWdu/WobLd0ITTlmsd8VhGBWQE+PJtju0vLy2epK7UZI9wR8zY+EzQfpYt7ucZmxyaOZHguncTUOw9vVc1yZGxMCTUFQ1Bpu2u4SRky/xxi4K45Yb65ajWpflluU1qRkbowimj4xQQAjTtsBMuNyHPIVlpveN2tGdjEeBafOw3gNeFIfto9DKhPvxd1EhGqjjOsm6YwMx3FsvJVzEa1YwaS59V1QfTkkAU1klaB+QKSs4C+i9hvp/ru4TcXeHIvwORJUAhX0YM2S+VSGUrQ/r+02fqgfoO+uNYEP00QwSuPv3KTBUBfOqMhrIaMZB/U8WiHZNZwBEgA1udepoaV5DVBUERqxVdPq8EljRsiCwWfeYnVZcOQ8YO53zRXQn2ePVfe54PZopmdppdNDMokxO1YTD0+LYoq4UGlYVeX2FMzaC2+Eaxtz9AD6okRsjWvEv+Z/QVV/UHfZ08UpvXs0yvX6dPPMwgpIt6BvZ83wtg66WIAR2U82jI2SEiOqMvcAgxy8Dc1F33TQQBLIwof5o+9x8/KaywnkzfJRAhNcWh3AUYoOcPDTqitrAV41PKAG6YfjHMyePV79tn/rH3ahXN8RaM/LfSS2MMtdYQELVMh9XUtJ9+ygdHdEHNlAOE2M/pABqcL3O7PFcO5tVSWS+oCZdhtVlMmiSRd0jDiku10ReoLt8PFJn+3oPk1nP03cgk2rC2k7wkKnflnLs= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec453e51-b06e-4311-f6af-08d9d5d21ef6 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB4849.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2022 13:47:48.9766 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CZfD7vUa+rOmD5SlxcFtuN5tg5kbVuGaRmdcl/HKiZsB1v2gwDpA+QtGtoMi2dRfWZLOE9qp2y9EG7f1RTntSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1594 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org PEP8 discourages the use of compound statements where there are multiple statements on a single line in the "Other Recommendations" section: https://www.python.org/dev/peps/pep-0008/#other-recommendations Signed-off-by: Joel Holdsworth --- git-p4.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-p4.py b/git-p4.py index 679667611c..cd7ecb7aeb 100755 --- a/git-p4.py +++ b/git-p4.py @@ -1264,7 +1264,8 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize): else: block_size = max(2, block_size // 2) - if verbose: print("block size error, retrying with block size {0}".format(block_size)) + if verbose: + print("block size error, retrying with block size {0}".format(block_size)) continue except P4Exception as e: die('Error retrieving changes description ({0})'.format(e.p4ExitCode)) @@ -1891,7 +1892,9 @@ def modifyChangelistUser(self, changelist, newUser): (changelist, newUser)) c = changes[0] - if c['User'] == newUser: return # nothing to do + if c['User'] == newUser: + # Nothing to do + return c['User'] = newUser # p4 does not understand format version 3 and above input = marshal.dumps(c, 2)