Modify

Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#13271 closed defect (fixed)

PlantUML macro path parameter cannot reference a file in a repo other than the default

Reported by: james.close Owned by: Ryan J Ollos
Priority: normal Component: PlantUmlMacro
Severity: normal Keywords: MultipleRepository
Cc: Álvaro Iradier Trac Release: 1.2

Description

System:

PlantUML: 2.0dev-r14362
Trac: 1.2.2
Server: Apache/2.4.7 (Ubuntu)
Database: PostgreSQL 9.3.14 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4, 64-bit
OS: Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-100-generic x86_64)
Repository 1 (Default): Subversion version 1.8.8 (r1568071).
Repository 2 mygitrepo: git version 1.9.1

With two repos set-up as above (default SVN) second is git.

Referencing a PlantUML file from the second repo does not work.

# This works fine with the default repo:
{{{#!PlantUml path="/Some/Path/In/Default/Repo/To/The/PlantUMLFile.plant"

}}}   

# This does not work:
{{{#!PlantUml path="mygitrepo/Some/Path/In/Second/Repo/To/The/PlantUMLFile.plant@branch"

}}}  
# Returns the error:
# File not found in repository: mygitrepo/Some/Path/To/The/GitPlantUMLFile@branch
  

I believe the issue is around the code for splitting the path does not remove the "mygitrepo" element of the path before searching for the file. I have a workaround by changing the code in macro.py line 199 to:

path, rev = _split_path(src_path)
if not repos.has_node(path, rev):
    # JC 12 Sep 2017 - Bug fix
    # maybe the path has the reponame at the start strip it out!
    pos = path.find('/')
    if pos != -1:
        path = path[pos:]
if repos.has_node(path, rev):
    node = repos.get_node(path, rev)
    content = node.get_content().read()
    exists = True

Attachments (0)

Change History (11)

comment:1 Changed 7 years ago by Ryan J Ollos

Owner: changed from Álvaro Iradier to Ryan J Ollos
Status: newaccepted

comment:2 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: acceptedclosed

In 16809:

TracPlantUml 2.2dev: Fix incorrect handling of repository-relative path

Fixes #13271.

comment:3 Changed 7 years ago by Ryan J Ollos

In 16810:

2.2dev: Use NoSuchNode exception for error handling

Refs #13271.

comment:4 Changed 7 years ago by Ryan J Ollos

If you can confirm it's working I'll publish the latest to pypi:TracPlantUml.

comment:5 Changed 7 years ago by james.close

I can confirm that the fix is working on my environment.

I see your fix is the "proper" way of doing it I had not read this in the RepositoryManager API

Returns:

a (reponame, repos, path) triple, where path is the remaining part of path once the reponame has been truncated, if needed.

Thanks for the quick turn around!

comment:6 Changed 7 years ago by Ryan J Ollos

In 16814:

TracPlantUml 2.2: Tag version 2.2

Refs #13271.

comment:7 Changed 7 years ago by Ryan J Ollos

Thanks for feedback. Latest version is on pypi.

comment:8 Changed 6 years ago by Jon Holstrom

Oh boy, I have tried everything here. Still not working for local svn repo

comment:9 in reply to:  8 Changed 6 years ago by Ryan J Ollos

Replying to clubturbo:

Oh boy, I have tried everything here. Still not working for local svn repo

Please ask on MailingList and explain what you mean by "not working".

comment:10 Changed 6 years ago by Jon Holstrom

No biggie, the discussion was on PlantUML displaying

{{{#!plantuml path="/path/to/repository"
...
}}}

{{{#!plantuml path="/repos/path/to/repository@rev"
...
}}}

&

[[PlantUml(/path/to/repository)]]
[[PlantUml(/path/to/repository@rev)]]

Of which I can't get working.

I did get

{{{#!PlantUml
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml
}}}

Working as it should.

Really no biggie. I am working up a means to test all this with https://pharo.org/ and see what gives there.

Last edited 6 years ago by Jon Holstrom (previous) (diff)

comment:11 Changed 6 years ago by Ryan J Ollos

I've tested the following examples:

[[PlantUml(/proj1/trunk/dir with space/plantuml_example)]]

[[PlantUml(/proj1/trunk/dir with space/plantuml_example@219)]]

[[PlantUml(/proj1/trunk/dir with space/plantuml_example@220)]]

{{{#!plantuml path="/proj1/trunk/dir with space/plantuml_example"
}}}

{{{#!plantuml path="/proj1/trunk/dir with space/plantuml_example@219"
}}}

{{{#!plantuml path="/proj1/trunk/dir with space/plantuml_example@220"
}}}

Are you using a repository-scoped path?

Please show a concrete example in which it doesn't work so I can look for hints as to what the problem might be.

Make sure you've installed the latest from trunk (2.3dev) or pypi (2.2).

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.