If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
I am trying to compare two folders with different versions of the same project. The files names contain the original file names along with the version number ie:
CLIPPING_REGIONS_70_S.ADA => CLIPPING_REGIONS_56_S.ADA
CLIPPING_REGIONS_71_B.ADA => CLIPPING_REGIONS_57_B.ADA
I have tried in the Folder Compare mode to force these files to correctly compare by using the following Alignment Override:
^([A-Z0-9_]+)_[0-9]+_([B|S])\.ADA=$1.+$2\.ADA
No luck.
Any Ideas to get the file names to align?
The changing version number needs to be part of the "with right"mask. While Regular Expressions can be used to Find/Left a changing version number, any text that does not match $1 or $2 exactly would need to be explicitly included in the Right side. The Right Side's dropdown of RegEx is limited to the Tagged Expressions.
The Alignment Overrides allows masking to match the matching part of the name, such as (stuff) with $1. However, any differences in file names needs to be explicitly defined. The 'matching' side does not support additional masking, it only supports $1, $2, and up, so anything that isn't a found match from the Find side needs to be explicitly typed in. If you have randomly changing characters in the Replace With side, then we won't be able to match on them arbitrarily.
The wish list request still seems to be open after that many years!
Correct me if i'm wrong, but all it would take is something like this:
1. create left hand string from left hand file name using regex, filling $1 (and maybe $2, $3 ...)
2. create right hand string from right hand file name using (full) regex semantics (with ref. to $1, $2, ... allowed)
3. match the two created strings and use to align
Because this sort of solution still does not exist in Version 4, I can see no reason to upgrade until it does work.
PS. of course there could be more elegant or powerful solutions but first follow the KISS philosophy.
Rolf
Thanks for the feedback. Enhancing our Alignment Override feature is something on our wishlist. Given the complexity of Regular Expression support, even the KISS solution is non-trivial to implement. If you would like to post example cases of folder structure and file names you are trying to align, and how you would like to define an Override to perform that task, I can add these notes to our entry on the subject. This would help expand our test cases that our developers use while investigating features like this.
I think a good suggestion might be to add more replacement tags that allow different matching behavior that exactly equal. My recurring example is I'd like to compare files from folders that look like this:
fileA_1234.txt --> fileA_5678.txt.
fileB_2345.txt --> fileB_6789.txt
So I'd like to make the right side be (file\w)_\d+.txt and the left side something like $1_<as many digits as matched on the other side>.txt
This replacement field I'd like to ignore in the comparison. They are actually timestamps or other auto-generated content, and for the purposes of the compare, I don't care what their values are.
So, the suggestion is a set of new replacement tokens, ala:
$^1 -- the first pattern on right does NOT match here
$?1 -- the right pattern doesn't matter--it can be in left or not
$n1 -- the right pattern contents don't matter, but the length does. Left must have the same # of chars in this position and still
match the rest of the left side.
You could go crazy with this, but this and maybe 1 or 2 more I think would capture the lion's share of what's been asked for. For me, $n1 is what I need:
right: file(\w)_(\d+).txt Left: file$1_$n2.txt
Incidentally, I'd also recommend you allow "($1)" in the left for cases where the next left pattern char is ambiguous. For instance, I could have used the above patterns:
right: file(\w_)1234.txt Left: file$15678.txt
In this case, $15 is ambiguous, unless there's a hard limit of 9 replacement tokens. But if left could be file($1)5678.txt, we're all good.
Thanks for the feedback. Our Alignment Overrides don't currently support defining a mask to 'hide' the different text, but it's on our wishlist to enhance this behavior. I'll add your notes to our wishlist entry on the subject.
With the current feature set, any different text in the Replace With section would need to be explicitly defined and does not support a mask.
You can do that by defining an override that uses "foo*" as the "Align left file" and "bar*" as the "with right file", leaving the "Regular Expression" checkbox unchecked.
The Alignment Override supports specific different text, so if the version number is known, you can define it as:
*1.0.0.* = *1.0.1.*
This would cause any files matching the pattern of your example to align. The thread you found is specific for defining the equal mask and also masking the different text (to help with arbitrary version numbers), which we don't currently support.
Yes, I am specifically asking about arbitrary version numbers.
It is not practical to redefine the patterns when the versions change, since we have many different artifacts with version numbers that constantly evolve. In many cases the version numbers also include timestamp information, for example, 1.0.1-SNAPSHOT.20170101235959.
We use Maven to generate versioned artifcats, so I imagine that we are not alone in needing to compare versioned filenames.
In your post you mentioned adding support for arbitrary version numbers to a "wishlist".
Can you provide a timeline for implementation of this feature?
We have a wishlist of customer requests. They do not have a specific timeline, but is a list that developers visit for ideas for future features and enhancements. Arbitrary character handling in the Alignment Override is a nice feature to tackle, but is also a pretty big enhancement and not likely one we'll be able to tackle soon.
Comment