Opened 10 years ago

Last modified 6 years ago

#2376 assigned defect

Strange behaviour when using p4 workspace

Reported by: Nounours Owned by: ttressieres
Priority: normal Component: PerforcePlugin
Severity: major Keywords: 0.5dev
Cc: Kim Rasmussen Trac Release: 0.11


On a Trac v0.11 running the 0.5dev version of the Perforce Plugin :

We have one repository for all our projects, then we restrict the views with workspaces.

Setting the workspace value in the [perforce] section from trac.ini doesn't seem to restrict the contents of the cached repository (I assume it's normal because p4 changesets aren't workspace-bound).

But when i'm trying to browse the repository from Trac web UI, the plugin raises a NoSuchNode exception (maybe because the generated nodePath workspace_name/etc.... isn't stored inside the cached repository). I can browse the repository by entering a real repository path in the URL, as Alas that's not the behaviour I was expecting for.

Is there an easy way to enable repository browsing from workspace_name/ ? Do I need to store the workspace mapped pathes in the cached repository instead of the real pathes ?

Attachments (0)

Change History (5)

comment:1 Changed 10 years ago by ttressieres

Owner: changed from Lewis Baker to ttressieres
Status: newassigned

comment:2 Changed 9 years ago by Kim Rasmussen

Cc: Kim Rasmussen added; anonymous removed

comment:3 Changed 9 years ago by Kim Rasmussen

I have the same problem. To reproduce, I create a new client specification TEST containing a view sections as follows

    //misc/... //whatever/misc/...

Then I set the workspace argument in the [perforce] section to TEST, and issue a resync.

If I then go to the Browse Source section I get a:

Error: No such node

No node //whatever/misc at revision @962

comment:4 Changed 6 years ago by Ingo Müller

Severity: normalmajor

I am experiencing the same problem, and I am trying to track it down. I think the reason of the problem is, that only part of the code works with workspace relative paths, while other parts don't. When they interact, there occur problems.

One of them (might be the only one, but that's the one where I am stuck) is the _getDirInfo function (which is called by by _get_isDirectory, which is called by _get_kind in order to determine whether a certain node is a file or a directory. As _getDirInfo fails, there is no type, so the NoSuchNode exception is raised).

In, the following check is performed:

if fullPath in self._dirs:

fullPath is in working dir format (eg whatever/misc@692), while the paths in self._dirs are in depot format (eg misc@692). Of course, the tests fails although it shouldn't.

I am trying to hack a solution, but as a complete python newbie, I am stuck with a segmentation fault caused by the following code supposed to replace above line:

           # HACK: make workspaces work --ingo
           output = _P4DirsOutputConsumer(self,nodePath.rev)
           print fullPath,output
           if len(output.dirs) is 1:
               fullPath = output.dirs[0].fullPath
           if fullPath in self._dirs:

This should run the P4 "dirs" command with the workspace path, which returns the depot paths, and hence convert one format to the other. Unfortunately, it doesn't work. Can anyone help?

I am changing severity to major, as neither restricting to a subdirectory (#694) nor workspaces work. Feel free to change back.

comment:5 Changed 6 years ago by Ingo Müller

I couldn't get it to work, even after several days of intensive debugging. Fortunetly, I found an alternative, which I just posted on the wiki as well:

Alternatively, trac can access to Perforce through a git wrapper. Here's roughly what you need to do:

  1. Install and set up a git-p4 repository: download, HowTo1, HowTo2
  2. Install GitPlugin and use the git repository you set up above as your new Trac repository.
  3. Create a minutely cronjob that executes "git p4 rebase" for your repository.

Modify Ticket

Change Properties
Set your email in Preferences
as assigned The owner will remain ttressieres.

Add Comment

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

Note: See TracTickets for help on using tickets.