Modify

Opened 4 years ago

Closed 4 years ago

#7242 closed enhancement (fixed)

[PATCH] Trac 0.12 compatibility + other improvements

Reported by: mrelbe Owned by: rjollos
Priority: normal Component: ChangeLogMacro
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

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 mrelbe 4 years ago.
Patch for #7242 to apply on r7928
t7242_multirepo-and-others_r7928.patch (7.2 KB) - added by mrelbe 4 years ago.
Replaces former patch
t7242_multirepo-and-others_r7928_2-tsvn.patch (6.2 KB) - added by mrelbe 4 years ago.
Made with TSVN, replaces all former patches, apply on r7928

Download all attachments as: .zip

Change History (21)

Changed 4 years ago by mrelbe

Patch for #7242 to apply on r7928

comment:1 Changed 4 years ago by mrelbe

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 4 years ago by mrelbe

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 4 years ago by mrelbe

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 4 years ago by mrelbe

Replaces former patch

comment:4 Changed 4 years ago by rjollos

  • Owner changed from rjollos to anonymous
  • Status changed from new to assigned

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

comment:5 Changed 4 years ago by mrelbe

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 4 years ago by rjollos

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 4 years ago by anonymous

  • Owner changed from anonymous to rjollos
  • Status changed from assigned to new

comment:8 follow-up: Changed 4 years ago by 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.

comment:9 in reply to: ↑ 8 ; follow-up: Changed 4 years ago by stava@…

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 ; follow-ups: Changed 4 years ago by 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?

comment:11 in reply to: ↑ 10 Changed 4 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 4 years ago by mrelbe

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 4 years ago by mrelbe

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

comment:13 Changed 4 years ago by rjollos

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

comment:14 Changed 4 years ago by rjollos

  • Owner changed from rjollos to anonymous
  • Status changed from new to assigned

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 follow-up: Changed 4 years ago by rjollos

  • Owner changed from anonymous to rjollos
  • Status changed from assigned to new

comment:16 in reply to: ↑ 15 Changed 4 years ago by stava@…

Replying to rjollos:

Works fine now!

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

Tnx! /L

comment:17 Changed 4 years ago by rjollos

  • Description modified (diff)

comment:18 Changed 4 years ago by rjollos

  • Resolution set to fixed
  • Status changed from new to closed

Add Comment

Modify Ticket

Action
as closed The owner will remain rjollos.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.