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

Comments

joachim’s picture

Status: Active » Needs review
StatusFileSize
new1.16 KB

Here's the patch :)

dave reid’s picture

Wouldn't this need to add an error if tag1 is defined but tag2 is not for parameters?

joachim’s picture

Oh 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.

wim leers’s picture

Subscribing. Excellent improvement.

joachim’s picture

Could we get feedback from the maintainer about whether we can reverse the parameters?

Grayside’s picture

Do 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

joachim’s picture

Summing 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.

Grayside’s picture

Why 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>

petsagouris’s picture

Status: Needs review » Needs work

Trying to make the proposition clearer:
#8 suggests:

drush rn <start> <end>  // all arguments provided.
drush rn <end>          // the <start> is calculated. As "one before <end>"
drush rn                // both <end> and <start> are calculated. As "latest" and "one before latest"

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 :)

joachim’s picture

StatusFileSize
new2.36 KB

Here's that bit implemented.

Still needs work because all I get is:

git log returned an error.                                                            [error]
attiks’s picture

Status: Needs work » Reviewed & tested by the community

see #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 --reverse and it returned the latest changes between the last two tags

moshe weitzman’s picture

Sounds like this is RTBC. Go grayside!

jcnventura’s picture

Status: Reviewed & tested by the community » Needs work

How can this be RTBC if it only works when using an option of another patch?

jcnventura’s picture

Status: Needs work » Reviewed & tested by the community

Actually, it works fine without --reverse when using the patch in #10.

I haven't applied #1494488: git version 1.7.9, --reverse mandatory.

jcnventura’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.49 KB

After 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.

attiks’s picture

StatusFileSize
new3.32 KB

This 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.

attiks’s picture

can somebody give feedback please

attiks’s picture

I still need to use this patch with the latest dev version

jcnventura’s picture

Issue summary: View changes
Status: Needs review » Fixed
wim leers’s picture

Hurray! :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.