2

Here is the workflow.

  1. User has created a branch from default to do work for bug 123.
  2. User does some work, including a lot of commits WITHOUT a BugzID:123 in the messages.
  3. User then merges this branch into default WITH a BugzID:123 in the message.
  4. User pushes to central repo

Fogbugz mercurial integration does not pick up the files that were modified/added from the branch. It only picks up the files that may have been modified due to a manual merge.

Is this intended behavior? We typically tag or create a named branch with the bug id in it so we don't really want to HAVE to have the BugzID:123 in every single commit.

If not, is there something I'm missing. Normal commit/push workflow off default seems to work fine and always has the files I expect.

I thought about modifying the fogbugz.py file to recursively go through all the parent changesets not default, but this seems like a brute force option for something I expect to work already.

flag
I agree...this would be a good feature to add, since adding the case ID to every commit for a case with a lot of work in it adds a lot of work on the developer. – cdeszaq Aug 27 2010 at 13:00
This case prompted me to request this feature: kiln.stackexchange.com/questions/1992/… – cdeszaq Aug 27 2010 at 13:04

2 Answers

2

For those interested, I have modified the fogbugz.py file to get files from merged branches into the fogbugz system. It's still a work in progress, but it works for us.

def process(self, node=None):
    """Begins processing on the given node"""
    ctxNew = self.repo.changectx(node)
    ctxOld = self.repo.changectx(ctxNew.rev() - 1)
    ids = self.extract_bug_ids(ctxNew)
    if not ids:
        return
    for bugId in ids:
        for filename in ctxNew.files():
            newRev = ctxNew.rev()
            oldRev = 0
            # FogBugz wants the new and old rev.  We actually only
            # need the new one for Mercurial, but placate FogBugz's
            # CVS-centric view anyway
            try:
                oldRev = ctxOld.filectx(filename).rev()
            except:
                pass
            self.submit(bugId, filename, oldRev, newRev)
        self.extract_files_recursive(ctxNew, bugId) #this is the new line, I didn't want to disturb the whole code base

Then somewhere in the class

def extract_files_recursive(self, ctx, bugId):
    ccparents = ctx.parents()
    if len(ccparents) == 1:
        parent = ccparents[0]
        branch = parent.branch()
        if branch == "default":
            return
    for parentCtx in ccparents:
        branch = parentCtx.branch()
        if branch != "default":
            for filename in parentCtx.files():
                newRev = parentCtx.rev()
                oldRev = 0
                # FogBugz wants the new and old rev.  We actually only
                # need the new one for Mercurial, but placate FogBugz's
                # CVS-centric view anyway
                try:
                    oldRev = ctxOld.filectx(filename).rev()
                except:
                    pass
                self.submit(bugId, filename, oldRev, newRev)
            self.extract_files_recursive(parentCtx, bugId)
link|flag
1

I agree that this would potentially be quite useful (thanks for filing the feature request!), but IMVHO, if you only have a single case open for an entire branch with many changesets, you probably haven't specified the work to be completed sufficiently (see Joel's article on EBS...specifically the "Break 'er down" section).

Having one parent case for the branch's work (e.g. "Add feature X") and multiple subcases is probably closer to the workflow I usually use. This way each changeset can have a bugzid with only a few of them sharing any single bugzid. I think the granularity is helpful...especially when I come back to look at a change that was made 6 months ago.

This is just my personal view though...which might not be applicable/useful at all. :)

link|flag
I agree that the more common (and probably more useful) way to do it is with a parent-case having the branch and then the sub-case work chunks end up as commits to that branch. In all cases, however, being able to quickly branch from a case would be a huge improvement. – cdeszaq Aug 27 2010 at 17:19
Does your post on the kiln knowledge exchange fully cover the branch-from-case feature request? kiln.stackexchange.com/questions/1992/… – adambox Aug 30 2010 at 15:42
Even with properly decomposed units of work, a common scenario would be revisions related to problems found in code reviews, usability testing, etc. In our environment, it is these revisions where the case ID is most often omitted from the changeset comments. – Steve Coffee Oct 12 2010 at 6:01
@Steve when I'm making changes as a result of a code review I usually include two case ids: the case id of the underlying bug (so the follow-up change will show up in the "Checkins" popup for that case), and the case id of the code review itself. – db Oct 12 2010 at 14:59
I think what Steve is (validly) saying is that this case id is omitted sometimes by accident, sometimes by laziness. Either way it is undesirable and we'd like the tool to help out - isn't that the point of having tools to do tedious stuff for us? – David Mitchell Oct 26 2010 at 12:13

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.