Tags are really fiddly to type without mistakes and almost as hard to select because word selection usually ignores hyphens.
So it would be great if this command could take the two most recent tags on the repository as default values if none are given.
Patch coming.
Really nice utility btw -- I was about to write the same sort of thing and good thing I thought to search first! :D
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | i1253356-16.patch | 3.32 KB | attiks |
| #15 | grn.default-tags.patch | 2.49 KB | jcnventura |
| #10 | 1253356-10.grn_.default-tags.patch | 2.36 KB | joachim |
| #1 | 1253356.grn_.default-tags.patch | 1.16 KB | joachim |
Comments
Comment #1
joachim commentedHere's the patch :)
Comment #2
dave reidWouldn't this need to add an error if tag1 is defined but tag2 is not for parameters?
Comment #3
joachim commentedOh yeah, you're right.
Of course, if the parameters were reversed to NEW OLD, we could allow just NEW to be specified and take OLD to be one back.
Comment #4
wim leersSubscribing. Excellent improvement.
Comment #5
joachim commentedCould we get feedback from the maintainer about whether we can reverse the parameters?
Comment #6
Grayside commentedDo it. 90% use case is to build a changelog from the previous tag (or to start of repo) to the current tag. Second parameter can be an optional specified treeish. Much better, IMO.
So is this still Needs Review, or were the above reactions RTBC-but-wait-scope-shift? comments?
/New Maintainer has Spoken
Comment #7
joachim commentedSumming up recent comments and some thoughts I've had on them:
> Of course, if the parameters were reversed to NEW OLD, we could allow just NEW to be specified and take OLD to be one back.
I'm going to disagree with myself and say that's silly. Standard unix ordering is OLD NEW, and that's true for the git log command too.
> Wouldn't this need to add an error if tag1 is defined but tag2 is not for parameters?
Yes, probably. This is the easiest way to go:
- rn tag1 tag2 (log commits from tag1 through to tag2)
- rn (log commits from the previous tag to the current one)
Now if we really wanted to align this with how git log works, it would be this:
- rn tag1..tag2 (log commits from tag1 through to tag2)
- rn tag1 (log commits from the beginning to tag1)
- rn
Unfortunately, the form with no tags at all wouldn't align with git log (which produces everything if given no commits or branch ids). So I'm not sure it's worth implementing the '..' in between tags.
Which brings us back to needing to add an error when there's exactly one tag given, because we don't support it.
Comment #8
Grayside commentedWhy don't we support it? We can compute any parameters we need for git log. This tool kind of presumes a vague familiarity with git, but does not require knowledge of it.
Consistency I understand, we can have:
* old new
* <calculated previous> new
* <calculated previous to previous> <calculated previous>
Comment #9
petsagouris commentedTrying to make the proposition clearer:
#8 suggests:
Note: please try and use the <start> and <end> when referring to those arguments.
A decision has been made to refer to them like that. So let's not stray from that please :)
Comment #10
joachim commentedHere's that bit implemented.
Still needs work because all I get is:
Comment #11
attiks commentedsee #1494488: git version 1.7.9, --reverse mandatory for the error, i assume it's the same git version.
i applied the patch and ran
drush rn --reverseand it returned the latest changes between the last two tagsComment #12
moshe weitzman commentedSounds like this is RTBC. Go grayside!
Comment #13
jcnventuraHow can this be RTBC if it only works when using an option of another patch?
Comment #14
jcnventuraActually, it works fine without --reverse when using the patch in #10.
I haven't applied #1494488: git version 1.7.9, --reverse mandatory.
Comment #15
jcnventuraAfter using this for a while, I saw some room for improvement... I keep several branches in parallel, and using this without args was using the most advanced branch always. I modified the code to fetch the current branch and only search in tags of the same pattern. Also, it was assuming you had more than 1 tag in the list, which can easily be the case if the tag list is restricted by the current branch.
This patch was created with diff, not git diff, so no need to apply with -p1.
Comment #16
attiks commentedThis works for me without the patch from (http://drupal.org/node/1494488#comment-5769416), but ...
The --reverse tag is ignored on my system, the output with and without the tags is always in the same order. To debug I added
drush_print_r(sprintf("%s log -s --pretty=format:%%s%s %s..%s", $git, $reverse, $tag1, $tag2));behind$reverse = drush_get_option('reverse', FALSE) ? ' --reverse' : '';so i could see what gets executed.While running those commands on the command line, the --reverse works ;p
After applying the patch from http://drupal.org/node/1494488#comment-5769416 the --reverse is working again. So it's probably related to the drush version.
Included a patch that combines both patches.
Comment #17
attiks commentedcan somebody give feedback please
Comment #18
attiks commentedI still need to use this patch with the latest dev version
Comment #19
jcnventurahttp://drupalcode.org/project/grn.git/commit/fe186f3
Comment #20
wim leersHurray! :)