Modify

Opened 14 years ago

Closed 14 years ago

#7242 closed enhancement (fixed)

[PATCH] Trac 0.12 compatibility + other improvements

Reported by: Mikael Relbe Owned by: Ryan J Ollos
Priority: normal Component: ChangeLogMacro
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

I have modified the plugin and adapted it to Trac 0.12 and made it multi-repo aware. I also couldn't resist in implementing some other requested improvements. In short:

  • Multi-repo aware for Trac 0.12 (#7062)
  • Revision ranges can now be stated (#327)
  • Changelog are put in a definition list (#3919)

The log indents nicely when stated in a list:

Last changes:
 * Default repo:
   [[ChangeLog(/)]]
 * otherrepo:
   [[ChangeLog(otherrepo:/)]]

I hope you don't mind me providing this patch, it may look like the plugin is completely re-written, but it's not. I've done this by applying successive changes, before supplying this ticket, all in good faith.

Please be critical to the patch as I am not a very experienced Python coder. I wouldn't be surprised if the parameter decoding can be made simpler/smarter.

I have not tested this on Trac 0.11, the plugin should be broken using Trac 0.11 due to the multi-repo capability (I have not studied the Trac 0.11 code).

I also updated the documentation:

Write repository change log to output.

The !ChangeLog macro writes a log of the last changes of a repository at a
given path. Following variants are possible to use:
{{{
1. [[ChangeLog([reponame:]path)]]
2. [[ChangeLog([reponame:]path@rev)]]
3. [[ChangeLog([reponame:]path@rev, limit)]]
4. [[ChangeLog([reponame:]path@from-to)]]
5. [[ChangeLog([reponame:]path@rev, limit, rev)]]
}}}

 1. Default repository is used if reponame is left out. To show the last five changes of the default repository:
{{{
[[ChangeLog(/)]]
}}}
   To show the last five changes of the trunk folder in a named repo:
{{{
[[ChangeLog(otherrepo:/trunk)]]
}}}
 2. The ending revision can be set. To show the last five changes up to revision 99:
{{{
[[ChangeLog(otherrepo:/trunk@99)]]
}}}
 3. The limit can be set by an optional parameter. To show the last 10 changes, up to revision 99:
{{{
[[ChangeLog(otherrepo:/trunk@99, 10)]]
}}}
 4. A range of revisions can be logged.
{{{
[[ChangeLog(otherrepo:/trunk@90-99)]]
}}}
    To lists all changes:
{{{
[[ChangeLog(otherrepo:/trunk@1-HEAD)]]
}}}
    HEAD can be left out:
{{{
[[ChangeLog(otherrepo:/trunk@1-)]]
}}}
 5. For backwards compatibility, revision can be stated as a second parameter instead:
{{{
[[ChangeLog(otherrepo:/trunk, 10, 99)]]
}}}

limit and rev may be keyword arguments.
{{{
[[ChangeLog(otherrepo:/trunk, limit=10, rev=99)]]
}}}

Attachments (3)

t7242_multirepo+others_r7928.patch (7.2 KB) - added by Mikael Relbe 14 years ago.
Patch for #7242 to apply on r7928
t7242_multirepo-and-others_r7928.patch (7.2 KB) - added by Mikael Relbe 14 years ago.
Replaces former patch
t7242_multirepo-and-others_r7928_2-tsvn.patch (6.2 KB) - added by Mikael Relbe 14 years ago.
Made with TSVN, replaces all former patches, apply on r7928

Download all attachments as: .zip

Change History (21)

Changed 14 years ago by Mikael Relbe

Patch for #7242 to apply on r7928

comment:1 Changed 14 years ago by Mikael Relbe

I forgot to state that the datetime format is changed to ISO-format. (I cannot find out how to use locale settings. Someone have any clue?)

comment:2 Changed 14 years ago by Mikael Relbe

Variant 5. in the documentation is badly stated: it should be:

5. [[ChangeLog([reponame:]path, limit, rev)]]

i.e. rev is not appended to path (path@rev) in this case, which makes more sense to the end-user for backwards compatibility.

(However, if rev is stated as both path@rev and as a third parameter at the same call, path@rev takes precedence. No need to document that, I think.)

comment:3 Changed 14 years ago by Mikael Relbe

Unfortunately, I seem to have chosen a very bad file name for the provided patch -- it cannot be downloaded here. I will therefore replace it and give it a better name. Sorry for this.

Changed 14 years ago by Mikael Relbe

Replaces former patch

comment:4 Changed 14 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to anonymous
Status: newassigned

Thanks for doing this! I will get this into the repository this weekend.

comment:5 Changed 14 years ago by Mikael Relbe

Thank you for accepting the patch -- makes me very happy :)

Unfortunately, there's a glitch in the documentation of variant 5.

The patch states on lines 56-57: "5. For backwards compatibility... second parameter...", but should say third parameter

Sorry for this.

comment:6 Changed 14 years ago by Ryan J Ollos

Sorry that I haven't gotten to this yet. I'm referring the reporter of #7347 to this ticket, so hopefully we'll get another tester on the new version.

comment:7 Changed 14 years ago by anonymous

Owner: changed from anonymous to Ryan J Ollos
Status: assignednew

comment:8 Changed 14 years ago by Ryan J Ollos

Planning to add this over the weekend and backport features to 0.11 so that tickets can be closed. I added you to the list of contributors on the project's wiki page.

comment:9 in reply to:  8 ; Changed 14 years ago by Lars Stavholm

Replying to rjollos:

Planning to add this over the weekend and backport features to 0.11 so that tickets can be closed. I added you to the list of contributors on the project's wiki page.

The patch seems not to be working properly:

patching file changelog/ChangeLogMacro.py
Hunk #4 failed at 9.
Hunk #7 succeeded at 23 with fuzz 1.
Hunk #10 succeeded at 75 with fuzz 1.
Hunk #12 failed at 108.
2 out of 15 hunks failed -- saving rejects to file changelog/ChangeLogMacro.py.rej

In addition I get a traceback when using the macro:

2010-11-18 21:28:37,076 Trac[formatter] ERROR: Macro ChangeLog(/trunk, 3) failed: 
Traceback (most recent call last):
  File "/usr/lib64/python2.6/site-packages/trac/wiki/formatter.py", line 717, in _macro_formatter
    return macro.process(args, in_paragraph=True)
  File "/usr/lib64/python2.6/site-packages/trac/wiki/formatter.py", line 304, in process
    text = self.processor(text)
  File "/usr/lib64/python2.6/site-packages/trac/wiki/formatter.py", line 291, in _macro_processor
    text)
  File "build/bdist.linux-x86_64/egg/changelog/ChangeLogMacro.py", line 87, in expand_macro
    path = repo.normalize_path(path)
AttributeError: 'NoneType' object has no attribute 'normalize_path'

What's the story?

comment:10 in reply to:  9 ; Changed 14 years ago by Mikael Relbe

Replying to stava@linadd.org:

The patch seems not to be working properly:

The patch was made with TortoiseSVN, if my memory doesn't fail me. Could that be the reason?

comment:11 in reply to:  10 Changed 14 years ago by anonymous

Replying to mrelbe:

Replying to stava@linadd.org:

The patch seems not to be working properly:

The patch was made with TortoiseSVN, if my memory doesn't fail me. Could that be the reason?

Shouldn't matter which svn client one uses. It's more likely a mismatch between trunk and the patch. Is there anyway somebody could regenerate a patch for Trac 0.12.1 against the current trunk? I really would love to see the ChangeLog macro working on my site again.

comment:12 in reply to:  10 Changed 14 years ago by Mikael Relbe

Replying to mrelbe:

The patch was made with TortoiseSVN, if my memory doesn't fail me. Could that be the reason?

My memory did fail me, the patch was made with TortoiseHg... I will upload a new patch produced by TortoiseSVN instead.

Changed 14 years ago by Mikael Relbe

Made with TSVN, replaces all former patches, apply on r7928

comment:13 Changed 14 years ago by Ryan J Ollos

(In [9462]) Applied patch in #7242 from mrelbe. Refs #7242.

comment:14 Changed 14 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to anonymous
Status: newassigned

I feel bad that I have left this sit here for so long!

I went ahead and applied the patch to the trunk, but have not yet had time to test it out. If you guys have a chance to test, please let me know.

comment:15 Changed 14 years ago by Ryan J Ollos

Owner: changed from anonymous to Ryan J Ollos
Status: assignednew

comment:16 in reply to:  15 Changed 14 years ago by Lars Stavholm

Replying to rjollos:

Works fine now!

The patch applies cleanly now, and the macro works as expected.

Tnx! /L

comment:17 Changed 14 years ago by Ryan J Ollos

Description: modified (diff)

comment:18 Changed 14 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.