From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id F12B11384B4 for ; Mon, 2 Nov 2015 21:46:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D713321C017; Mon, 2 Nov 2015 21:46:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5C2B921C014 for ; Mon, 2 Nov 2015 21:46:34 +0000 (UTC) Received: from localhost.localdomain (d202-251.icpnet.pl [109.173.202.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id C488B3405C3; Mon, 2 Nov 2015 21:46:32 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: robbat2@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH 2/2] egencache --update-changelogs: Support reversing order Date: Mon, 2 Nov 2015 22:46:26 +0100 Message-Id: <1446500786-23199-2-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1446500786-23199-1-git-send-email-mgorny@gentoo.org> References: <5637B708.2030600@gentoo.org> <1446500786-23199-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: de8b9f23-1aa7-4e59-8376-3e4eab5e35a8 X-Archives-Hash: 2404d8e963dca8cc302ee0c5785367d4 --- bin/egencache | 15 ++++++++++++--- man/egencache.1 | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/egencache b/bin/egencache index 984d9f2..51d115a 100755 --- a/bin/egencache +++ b/bin/egencache @@ -171,6 +171,9 @@ def parse_args(args): dest="uld_output") uc = parser.add_argument_group('--update-changelogs options') + uc.add_argument("--changelog-reversed", + action="store_true", + help="log commits in reverse order (oldest first)") uc.add_argument("--changelog-output", help="output filename for change logs", dest="changelog_output", @@ -745,7 +748,7 @@ class _special_filename(_filename_base): return self.file_name < other.file_name class GenChangeLogs(object): - def __init__(self, portdb, changelog_output): + def __init__(self, portdb, changelog_output, changelog_reversed): self.returncode = os.EX_OK self._portdb = portdb self._wrapper = textwrap.TextWrapper( @@ -754,6 +757,7 @@ class GenChangeLogs(object): subsequent_indent = ' ' ) self._changelog_output = changelog_output + self._changelog_reversed = changelog_reversed @staticmethod def grab(cmd): @@ -781,7 +785,11 @@ class GenChangeLogs(object): ''' % (cp, time.strftime('%Y')))) # now grab all the commits - commits = self.grab(['git', 'rev-list', 'HEAD', '--', '.']).split() + revlist_cmd = ['git', 'rev-list'] + if self._changelog_reversed: + revlist_cmd.append('--reverse') + revlist_cmd.extend(['HEAD', '--', '.']) + commits = self.grab(revlist_cmd).split() for c in commits: # Explaining the arguments: @@ -1140,7 +1148,8 @@ def egencache_main(args): if options.update_changelogs: gen_clogs = GenChangeLogs(portdb, - changelog_output=options.changelog_output) + changelog_output=options.changelog_output, + changelog_reversed=options.changelog_reversed) gen_clogs.run() ret.append(gen_clogs.returncode) diff --git a/man/egencache.1 b/man/egencache.1 index b4a95b3..2465ddf 100644 --- a/man/egencache.1 +++ b/man/egencache.1 @@ -46,6 +46,10 @@ the package directories. .br Defaults to ChangeLog. .TP +.BR "\-\-changelog\-reversed" +Reverses the commit order in ChangeLogs. The oldest commits are output +first, the newest last. +.TP .BR "\-\-config\-root=PORTAGE_CONFIGROOT" Location of portage config files. .br -- 2.6.2