From patchwork Fri Sep 11 08:00:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11769899 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9467C618 for ; Fri, 11 Sep 2020 08:00:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7382F221E3 for ; Fri, 11 Sep 2020 08:00:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EBe+E7LK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725535AbgIKIA0 (ORCPT ); Fri, 11 Sep 2020 04:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725601AbgIKIAW (ORCPT ); Fri, 11 Sep 2020 04:00:22 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A08DFC061756 for ; Fri, 11 Sep 2020 01:00:21 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id y15so3864306wmi.0 for ; Fri, 11 Sep 2020 01:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=1fKzNKEs1POxgWpvxCsSi9q8KGe/+VjQay0CbX29ED4=; b=EBe+E7LKmyL0zGNgZgzpGpneek7xKDAWnVfOkTPZ+I/Ggo8MNayjBLzaYvk0WydiZM QUu9zxg/0w62Ss9fxjWlD2qUWcgw9G6hHO67PzneWBzmbCpLB8LV55Iq3MWHRscxMCfF M/OthLhfk2JD6LPkyF89nT0a8G9yFqFdJs74XKVGRMP/OwvRg8KievcxCFzYLdITwqdk fAq4qzNn1LBdMOxCBK+ql0Z9e/abLLMgEjKLB/L8EZfhmJ8N+f3H5D73SrHG8GkKThMn NjfLl+YMufB8yEbGwh+DAxwNvlSFAGJ8FWbVdnKEUCByIjwJjJxTcHQcdy7A2RE0XwY/ AcFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=1fKzNKEs1POxgWpvxCsSi9q8KGe/+VjQay0CbX29ED4=; b=QtwBGdQXcxVOAWU4CNNabfI60Ix7A4s2frX6VoWIUsYVDbbWm+fNOKYRiLOf1rRh8E /AUb8Mh1xKPkXqvlQdUgQVWpZ+2jvaWgIBHbVpscshoBtkQihtAoX1Z0kJSzeynDjklm xTlfZgOv26tUVzKqszUvFlzXLv+7d2cAYw1RKyI5lbGuLCGLKFMjFfnrzG3UovmwA3qL Zbe6peoYb9aCNaf+konGwBfVVkCqy2DTD0DmHfceVCy6w/E5+NVrTZLiWP07LivcDmsM xCQVERWxlyQgVOMpHFWC2HR33TCzjG0KpUaQXeBQoQ/5pseUfO/t1Ig16XgZWIqF8IoF ihDw== X-Gm-Message-State: AOAM531qLFKhlHjpm1L4O0ukjLOr20eXrXNXX2glqgvv+UjaOqTO5oev TQRqrXrrMIu2sR7A0DwyulEYxqlgspY= X-Google-Smtp-Source: ABdhPJyhlTctSLBLgXPXgCIyT+yWgIyQ2zu4G+mqWz34M0jB8o5dJd3FAxx5V7hIQ4AJXNgtt+3b1Q== X-Received: by 2002:a1c:7502:: with SMTP id o2mr889982wmc.29.1599811220181; Fri, 11 Sep 2020 01:00:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id h8sm2895983wrw.68.2020.09.11.01.00.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 01:00:19 -0700 (PDT) Message-Id: <97232523112b433a4273ff5b4c132ca4fe3cf07c.1599811217.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Lukas via GitGitGadget" Date: Fri, 11 Sep 2020 08:00:16 +0000 Subject: [PATCH 1/2] svn: added: Multi line support for ignore-paths Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Lukas Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Lukas With this change ths user is able to ignore more than a couple of folder. The git configuration has a max char length per line, so the user is limited if he want to ignor many folders/files. With this patch the ignore-paths expression is generated by all given lines. Example: ignore-paths=.*/somefolder1/ ignore-paths=base/differentfolder2/.* Signed-off-by: Lukas Pupka-Lipinski --- perl/Git/SVN/Fetcher.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm index 64e900a0e9..96b14538b0 100644 --- a/perl/Git/SVN/Fetcher.pm +++ b/perl/Git/SVN/Fetcher.pm @@ -31,15 +31,17 @@ sub new { # override options set in an [svn-remote "..."] section $repo_id = $git_svn->{repo_id}; my $k = "svn-remote.$repo_id.ignore-paths"; - my $v = eval { command_oneline('config', '--get', $k) }; - $self->{ignore_regex} = $v; + my @config = eval { command( 'config', '--get-all', $k ) }; + chomp(@config); # Replace all \n\r on the end + $self->{ignore_regex} = '(?:'.join('|', @config).')'; $k = "svn-remote.$repo_id.include-paths"; - $v = eval { command_oneline('config', '--get', $k) }; - $self->{include_regex} = $v; + @config = eval { command( 'config', '--get-all', $k ) }; + chomp(@config); # Replace all \n\r on the end + $self->{include_regex} = '(?:'.join('|', @config).')'; $k = "svn-remote.$repo_id.preserve-empty-dirs"; - $v = eval { command_oneline('config', '--get', '--bool', $k) }; + my $v = eval { command_oneline('config', '--get', '--bool', $k) }; if ($v && $v eq 'true') { $_preserve_empty_dirs = 1; $k = "svn-remote.$repo_id.placeholder-filename"; From patchwork Fri Sep 11 08:00:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Derrick Stolee via GitGitGadget X-Patchwork-Id: 11769901 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 534BB92C for ; Fri, 11 Sep 2020 08:00:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 30BB4221E3 for ; Fri, 11 Sep 2020 08:00:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T0PWnXeL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725774AbgIKIA3 (ORCPT ); Fri, 11 Sep 2020 04:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbgIKIAW (ORCPT ); Fri, 11 Sep 2020 04:00:22 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69D7EC061573 for ; Fri, 11 Sep 2020 01:00:22 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id s12so10483776wrw.11 for ; Fri, 11 Sep 2020 01:00:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:mime-version :content-transfer-encoding:fcc:to:cc; bh=pPDfLHRxkN+T0ZkCN2q3sC7QK/7yb2OeYdmEKT/El1w=; b=T0PWnXeLxEc6zbP6zOV/aZBKfzm60In45SMD21yRgM5G09tems0M9yss9amCLykPKm WlBeE5ghSUYZAVHpePu6TAkeZBvvDwXrV7v6SP2c2KXkEUbldPeMGAYoMDqnwrkaiJ+5 IrxhPdRm+Om9GMSjEVKtZRsxBNYAz6yH1P1E+4CUvgow4AdDKXPdWig1ojMixYgv7sKm JYkUtrwnqTvb6CxP+pk8TRVe2tkeVYru9pFlZuvgMmcQyB/xnDeS/JnJqmu/F7AwfTzx TmNlykegY2ii8uAoTijdothd7hqOMYebtnjKsvSdtq4uZ0tBEydpvamHpRY8WnMmUmvH T5SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:mime-version:content-transfer-encoding:fcc:to:cc; bh=pPDfLHRxkN+T0ZkCN2q3sC7QK/7yb2OeYdmEKT/El1w=; b=b8Ya6sPIye/eLVv+fPZ11BuEb6EOubI4PcbbbNdehzGLvY4u4sU/AVp1w3ZhLLtJil s9SEvPHcP4A/U7HPUUV6Kt6fwn0d/vLqBjcY/znmDeV/8D9aPbsnyEwjjKyr6y8XzPNi CDasi6JUgJfB71qzfTmHhFIdUkOShxPryb6w6W/hYa1nIreR1+r4DOnSC4LV/0A2wxM5 NzS7m0ySeVvx1RccQ4ku8EnLj6wdn+4Rrnx6M6x8KHNczdtMOQkfGP1FZYZoQXgrW+UZ qMrZMWampbdSKTMAyydDBgrAAIlOyiFzL66tcOQwCByCwQmKpJb0p/nH3ZMNW7wTKRai En9g== X-Gm-Message-State: AOAM532ASZixaHYfCmjb9ma0U81MhsCI0coujSq/sNA3kVaRDfP0I+ys /osldPIK5f3Ijxsb/Kv1I84mll6TsKs= X-Google-Smtp-Source: ABdhPJz6TX9QKVCEu8ItGXkCCgA7OJpSc6aBbhRnt9W7Rq8xwrjysYow31S3H2s5BRgqR180KI7U6Q== X-Received: by 2002:a5d:4591:: with SMTP id p17mr748679wrq.408.1599811220918; Fri, 11 Sep 2020 01:00:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 185sm2795363wma.18.2020.09.11.01.00.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 01:00:20 -0700 (PDT) Message-Id: <282e524547a4998c131a8162b72a33f6129e637b.1599811217.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Lukas via GitGitGadget" Date: Fri, 11 Sep 2020 08:00:17 +0000 Subject: [PATCH 2/2] sv: added: Skip commit if all files are ignored MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Lukas Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Lukas I used the ignore-paths option to ignore a lot of stuff I don’t need. The ignore pattern works well, but it could and up in empty commits. So just the message without any modifications / changes. The patch below skip a commit if all changes are ignored by the ignore-paths option. In order to use this feature I includes the option to read configuration for ignore-path, include-paths in several lines. So that the user is not limited by the max. char. per line definition. Signed-off-by: Lukas Pupka-Lipinski --- perl/Git/SVN.pm | 21 +++++++++++++++++++++ perl/Git/SVN/Fetcher.pm | 30 ++++++++++++++++++++++++++++++ perl/Git/SVN/Ra.pm | 2 ++ 3 files changed, 53 insertions(+) diff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm index 4b28b87784..fa87687306 100644 --- a/perl/Git/SVN.pm +++ b/perl/Git/SVN.pm @@ -1188,6 +1188,22 @@ sub find_parent_branch { return undef; } +############################################################ + +=item do_fetch() + +Fetch an Commit and returns a log entry + +Input: $path - array of strings (Paths) in a commit + $rev - Revision number + +Output: $log_entry if successfull + null if skipped + (die) on fetch error + +=cut + +############################################################ sub do_fetch { my ($self, $paths, $rev) = @_; my $ed; @@ -1212,6 +1228,11 @@ sub do_fetch { } $ed = Git::SVN::Fetcher->new($self); } + my $skip = $ed->is_empty_commit($paths); + if ($skip){ + print "skip commit $rev\n"; + return; + } unless ($self->ra->gs_do_update($last_rev, $rev, $self, $ed)) { die "SVN connection failed somewhere...\n"; } diff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm index 96b14538b0..c31343b6e6 100644 --- a/perl/Git/SVN/Fetcher.pm +++ b/perl/Git/SVN/Fetcher.pm @@ -139,6 +139,36 @@ sub is_path_ignored { return 0; } +############################################################ + +=item is_empty_commit() + +Return 1 if all given $paths are ignored, so that this commit end up in an empty commit + +Input: $path - array of strings (Paths) in a commit + +Output: { 1 if true, 0 if false } + +=cut + +############################################################ +sub is_empty_commit { + my ( $self, $paths ) = @_; + my $path; + my $ignored; + unless ( defined( $self->{include_regex} ) ) { + return 0; + } + + foreach $path ( keys %$paths ) { + $ignored = $self->is_path_ignored($path); + if ( !$ignored ) { + return 0; + } + } + return 1; +} + sub set_path_strip { my ($self, $path) = @_; $self->{path_strip} = qr/^\Q$path\E(\/|$)/ if length $path; diff --git a/perl/Git/SVN/Ra.pm b/perl/Git/SVN/Ra.pm index 56ad9870bc..63be69dc12 100644 --- a/perl/Git/SVN/Ra.pm +++ b/perl/Git/SVN/Ra.pm @@ -475,6 +475,8 @@ sub gs_fetch_loop_common { my $log_entry = $gs->do_fetch($paths, $r); if ($log_entry) { $gs->do_git_commit($log_entry); + }else{ + next; } $Git::SVN::INDEX_FILES{$gs->{index}} = 1; }