From patchwork Sun Mar 28 20:48:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D10279: split: simplify From: phabricator X-Patchwork-Id: 48594 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Sun, 28 Mar 2021 20:48:17 +0000 joerg.sonnenberger created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Replace check with nullid with a check on the simpler nullrev. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D10279 AFFECTED FILES hgext/split.py CHANGE DETAILS To: joerg.sonnenberger, #hg-reviewers Cc: mercurial-patches, mercurial-devel diff --git a/hgext/split.py b/hgext/split.py --- a/hgext/split.py +++ b/hgext/split.py @@ -12,7 +12,7 @@ from mercurial.i18n import _ from mercurial.node import ( - nullid, + nullrev, short, ) @@ -80,12 +80,12 @@ raise error.InputError(_(b'cannot split multiple revisions')) rev = revs.first() - ctx = repo[rev] - # Handle nullid specially here (instead of leaving for precheck() + # Handle nullrev specially here (instead of leaving for precheck() # below) so we get a nicer message and error code. - if rev is None or ctx.node() == nullid: + if rev is None or rev == nullrev: ui.status(_(b'nothing to split\n')) return 1 + ctx = repo[rev] if ctx.node() is None: raise error.InputError(_(b'cannot split working directory'))