Commavee

from John Minnihan, founder of Freepository.

You are currently browsing the Source Control category.

Tech Tip: Multi-line Perl regex pattern match

Yesterday, I encountered an analysis issue that appeared to be resolvable with a simple pattern replacement technique.  This turned out to be a bit more complex than estimated, as the pattern spanned multiple lines and I struggled to get the regex constructed to match this use case.

I finally figured it out, and although the overall problem remains unresolved (it has many layers), this particular part works well.  My error was in how I viewed use of  /s and /m as mutually exclusive; they aren’t of course, and I have made that mistake one other time over the years.   I also hadn’t set the input record separator ($/) to paragraph read mode.   I’m posting details here to document my specific usage.

Assumptions:

  • A literal pattern exists that is present in multiple places in a file
  • The literal pattern spans multiple lines in the file
  • Literal pattern is

    • Node-path: branches/%%BRANCHES%%
    • Node-kind: dir
    • Node-action: add
  • Perl is being used to read the file and current line of file is $line
  • Objective is to delete all occurrences of this pattern from the file one $line at a time

Here’s how I did that:

[read the file & crawl thru the lines]

$/ = ”;

$line =~ s/^Node-path:\sbranches\/%%BRANCHES%%.*?^Node-kind:\sdir.*?^Node-action:\sadd.*?//sm;

Tags: , ,

Popularity: 49% [?]

Posted 2 weeks, 2 days ago.

Comments

Don’t install TortoiseSVN v 1.6.2?

A friend of mine forwarded this to me a few days ago; I filed it away under ‘refer to later’.   Later just arrived, as I saw someone tweet about a TortoiseSVN issue on Vista.

I’m relaying this here in the hope that it saves folks the hassle of figuring it out themselves.

I [installed TortoiseSVN 1.6.2] this morning, and it just failed silently, After digging out some logs etc, I found the very helpful Microsoft message "Application did not start because its side-by-side configuration was not correct"
That has to be one of the most non-enlightening error messages of all time.

I had come across that myself before with ScreenCap, and I was able to figure out that it has some mysterious connection to the .NET framework. However, my work-around was pretty ugly, and not useful in this case.

My recovery for tortoise is that I had to uninstall the new version, restart 3 times to make sure that windows forgot about it it, and then install the older (1.6.1) version.

From previous experience with this side-by-side nonsense, this seems to be Vista specific because I’ve never seen that message in an XP machine. Interestingly enough, I didn’t see a bug report on the tortoise site, but I only did a cursory look through the list.

Tags: , ,

Popularity: 12% [?]

Posted 1 month, 2 weeks ago.

Comments

A Branching Strategy

 

Executive Summary

To support increased responsiveness to business needs, an enterprise is considering a move to monthly site releases. 

Increased frequency of releases places additional demands upon the engineering, QA and release teams with regard to developing, maintaining, testing, and tracking multiple lines of development.  The challenge to the enterprise is how to balance the engineering team’s need for ongoing development, which is often experimental in nature and uncertain in outcome (the “what”), with those of the business whose focus is more schedule-driven, and thus highly dependent upon calendar time (the “when”).

Continue Reading…

Popularity: 3% [?]

Posted 10 months, 2 weeks ago.

Comments

Collabnet Purchases SourceForge EE

Today Collabnet announced an agreement to purchase SourceForge Enterprise Edition:

http://biz.yahoo.com/e/070425/lnux8-k.html

Let the consolidation war begin.

Continue Reading…

Popularity: 2% [?]

Posted 2 years, 2 months ago.

Comments

Subversion vs. Perforce

I was recently asked to compare Subversion (SVN) to Perforce, and explain why I would choose to implement SVN rather than Perforce as a replacement for an existing CVS installation.

Continue Reading…

Popularity: 44% [?]

Posted 2 years, 3 months ago.

Comments