From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sverre Rabbelier Subject: [PATCH v7 3/6] fast-import: add feature command Date: Sun, 6 Sep 2009 16:35:45 +0200 Message-ID: <1252247748-14507-4-git-send-email-srabbelier@gmail.com> References: <1252247748-14507-1-git-send-email-srabbelier@gmail.com> <1252247748-14507-2-git-send-email-srabbelier@gmail.com> <1252247748-14507-3-git-send-email-srabbelier@gmail.com> Cc: Sverre Rabbelier To: Junio C Hamano , "Shawn O. Pearce" , Johannes Schindelin , Git List , Ian Clatworthy Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1MkIrC-00078l-Ay for gcvg-git-2@lo.gmane.org; Sun, 06 Sep 2009 16:36:42 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757984AbZIFOgW (ORCPT ); Sun, 6 Sep 2009 10:36:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757975AbZIFOgS (ORCPT ); Sun, 6 Sep 2009 10:36:18 -0400 Received: from ey-out-2122.google.com ([74.125.78.24]:12916 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757965AbZIFOgO (ORCPT ); Sun, 6 Sep 2009 10:36:14 -0400 Received: by ey-out-2122.google.com with SMTP id 25so801741eya.19 for ; Sun, 06 Sep 2009 07:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=NADCdp89HOgd+aYG8YYBJbT/uzmCcOLoBk6FKBRm1e8=; b=sVzkZHIeovPVcmW7yxz8v7GGEuSRrpQNgidzP0QJ7HYKcIreDIIRHC+ahUVVLG/sdk UUfjBcnzgNPplsUrGJ4AzWLcjIVk5eTd1jh7f/UnY70LwvLyDWh7/7UQh5wTIqspxEFz D3oG0T8NALDIxVDjyXU58TgpRpgf1YRzN/wcs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=DuPL7joCglIhMFZtj9kvpHLy50Mf0+M5f6AtpCzVr9QPDCkoI2jVr/Qn8ntYvgKe1l Um1knrNhEssas7jenBo//xrKV5/7S96U7VDk9FX4E3IUYTPyXrLHS6iLoIMupZv612xM cDMQbSKaKBneCVDbg8fdCcuZFYK36D2DlftjQ= Received: by 10.216.26.202 with SMTP id c52mr1245689wea.98.1252247775622; Sun, 06 Sep 2009 07:36:15 -0700 (PDT) Received: from localhost.localdomain (ip138-114-211-87.adsl2.static.versatel.nl [87.211.114.138]) by mx.google.com with ESMTPS id q9sm8759493gve.6.2009.09.06.07.36.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 06 Sep 2009 07:36:14 -0700 (PDT) X-Mailer: git-send-email 1.6.4.16.g72c66.dirty In-Reply-To: <1252247748-14507-3-git-send-email-srabbelier@gmail.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: This allows the fronted to require a specific feature to be supported by the frontend, or abort. Also add support for the first feature, date-format=. Signed-off-by: Sverre Rabbelier --- Unchanged since v6. Documentation/git-fast-import.txt | 16 ++++++++++++++++ fast-import.c | 13 +++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index c2f483a..1e293f2 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -303,6 +303,10 @@ and control the current import process. More detailed discussion standard output. This command is optional and is not needed to perform an import. +`feature`:: + Require that fast-import supports the specified feature, or + abort if it does not. + `commit` ~~~~~~~~ Create or update a branch with a new commit, recording one logical @@ -813,6 +817,18 @@ Placing a `progress` command immediately after a `checkpoint` will inform the reader when the `checkpoint` has been completed and it can safely access the refs that fast-import updated. +`feature` +~~~~~~~~~ +Require that fast-import supports the specified feature, or abort if +it does not. + +.... + 'feature' SP LF +.... + +The part of the command may be any string matching +[a-zA-Z-] and should be understood by a version of fast-import. + Crash Reports ------------- If fast-import is supplied invalid input it will terminate with a diff --git a/fast-import.c b/fast-import.c index 812fcf0..9bf06a4 100644 --- a/fast-import.c +++ b/fast-import.c @@ -2450,6 +2450,17 @@ static void parse_one_option(const char *option) } } +static void parse_feature(void) +{ + char *feature = command_buf.buf + 8; + + if (!prefixcmp(feature, "date-format=")) { + option_date_format(feature + 12); + } else { + die("This version of fast-import does not support feature %s.", feature); + } +} + static int git_pack_config(const char *k, const char *v, void *cb) { if (!strcmp(k, "pack.depth")) { @@ -2526,6 +2537,8 @@ int main(int argc, const char **argv) parse_checkpoint(); else if (!prefixcmp(command_buf.buf, "progress ")) parse_progress(); + else if (!prefixcmp(command_buf.buf, "feature ")) + parse_feature(); else die("Unsupported command: %s", command_buf.buf); } -- 1.6.4.16.g72c66.dirty