Page MenuHomePhabricator

Allow herald rules to filter on branch/tag creation in Subversion
Closed, WontfixPublic

Description

Was trying to avoid triggering audits for copy-only commits, so I tried to use the changed file contents condition. Didn't seem to work (possibly because of SVN properties?) Would be nice to be able to do this.

[11:45] <sshannin> I'm trying to create a Herald rule that triggers on most commits, excluding branches or tags. Anybody have a suggestion on how to do this? I'm using the "any changed file contents" regex with ["/.+/", "/.+/"] to filter commits with no change, but it still seems to trigger
[12:03] <aik099> sshannin, what is your repo type, svn?
[12:05] <sshannin> aik099: indeed
[12:05] <aik099> and there is already a "Commit's branches" condition when you're creating a Herald rule.
[12:06] <aik099> so you can create a heard rule with "Commit's branches" contains
[12:06] <aik099> with no action taken
[12:06] <sshannin> I guess I was unclear on what that did; I thought it was to filter on certain branches vs. creating a branch or tag
[12:06] <aik099> and then specify that rule in main herald rule with "when another Hearald rule doesn't match"
[12:07] <aik099> sshannin, why you need to skip certain branches via herald rule?
[12:08] <sshannin> I don't need to. I'm trying to trigger on cases where file content is only copied
[12:10] <sshannin> (or actually in this case, trying to avoid triggering on copy-only commits)
[12:11] <aik099> and you're triggering (not triggering) audits for these commits?
[12:11] <aik099> in SVN some files can be copied and other no within same commit, so if 1 file is copied this doesn't mean that whole commit content is copied as well.
[12:12] <sshannin> correct
[12:12] <sshannin> that's why I was trying to filter with Any Changed File Contents
[12:13] <sshannin> as in if even a single character of a single file changed, trgger. otherwise don't
[12:13] <aik099> and you have large % of this copy-only commits VS commits that needs to be audited?
[12:14] <sshannin> enough that I'm annoyed enough to pursue this :p
[12:15] <aik099> currently Herald doesn't have any condition that would allow to tell that "all of commit files" have "something matching", so no luck in here I guess
[12:15] <sshannin> Am I misunderstanding the Any Changed File Contents though?
[12:15] <aik099> if not a secret, then why there are copies at all in regular workflow ?
[12:16] <aik099> I only copy from base project when creating new project.
[12:16] <sshannin> branches and tags
[12:16] <aik099> then review only "trunk"
[12:16] <aik099> and don't try to use SVN branches as git branches, because this would create mess
[12:16] <aik099> and then when branch will be merged to trunk you'll review it
[12:17] <sshannin> but I want to review the commits on the branch, just not the actual creation of the branch
[12:17] <sshannin> yes, I did consider that; was just trying to fit it into current workflow
[12:17] <aik099> maybe you can match with "any changed filename matches" "(branches|tags)[^/]+$
[12:17] <sshannin> I'm just surprised still that the File Contents conditions is matching
[12:18] <aik099> then you'll be filtering out all commits which cause creation of branch or tag because they will have commit on top branch/tag folder
[12:18] <aik099> however if SVN properties are changed in a branch/tag, then these commits will match as well
[12:18] <sshannin> ahhh, good call, I bet it's the props

Event Timeline

sshannin raised the priority of this task from to Needs Triage.
sshannin updated the task description. (Show Details)
sshannin added projects: Herald, Subversion.
sshannin added a subscriber: sshannin.
epriestley triaged this task as Wishlist priority.Dec 16 2014, 5:32 PM
epriestley added a subscriber: epriestley.

Copying a file creates a new file, so this is working as expected. The diff is not empty: it adds all the copied files.

In particular, "Changed Files" will include all the content, because all of the files have changed -- they were previously empty, and now they have a lot of content.

epriestley renamed this task from Allow herald rules to filter on branch/tag creation to Allow herald rules to filter on branch/tag creation in Subversion.Dec 16 2014, 5:33 PM
kaya removed a subscriber: kaya.
epriestley claimed this task.

We haven't seen other requests for this in a year, and our behavior is technically correct and I think it is broadly reasonable.

This request also does not describe a root use case, per the modern documentation in Contributing Feature Requests.

You can write a custom Herald field like "Is branch/tag creation in SVN?" which implements whatever logic you want as an extension; D14685 may be a reasonable starting point if you choose to pursue this.