Project

General

Profile

Actions

Feature #339

open

perforce SCM support

Added by Brett Eisenberg over 17 years ago. Updated over 2 years ago.

Status:
Reopened
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Files

redmine-scm-p4-0.8.0_RC1.zip (11.1 KB) redmine-scm-p4-0.8.0_RC1.zip Jeff Rorison, 2008-12-16 06:27
perforce_scm_adapter.diff (21.1 KB) perforce_scm_adapter.diff Jeff Rorison, 2009-01-13 07:28
perforce_adapter.rb (15.3 KB) perforce_adapter.rb Wade Brainerd, 2009-03-18 22:52
perforce_bulk_load.patch (2.96 KB) perforce_bulk_load.patch George Gensure, 2009-04-20 22:29
redmine-perforce-v2-r2786.zip (19.5 KB) redmine-perforce-v2-r2786.zip Roman Starkov, 2009-06-14 12:38
redmine_perforce_patch.diff (26.5 KB) redmine_perforce_patch.diff Full patch (includes minor changes in addition to the other attached files) Terry Suereth, 2012-12-12 18:59
app-models-repository-perforce.rb (2.88 KB) app-models-repository-perforce.rb app/models/repository/perforce.rb Terry Suereth, 2012-12-12 18:59
lib-redmine-scm-adapters-perforce_adapter.rb (17.6 KB) lib-redmine-scm-adapters-perforce_adapter.rb lib/redmine/scm/adapters/perforce_adapter.rb Terry Suereth, 2012-12-12 18:59
redmine22_perforce_patch_v0.5 (26.6 KB) redmine22_perforce_patch_v0.5 Gurvan Le Dromaguet, 2013-01-14 15:15
2.3-perforce.patch (24.1 KB) 2.3-perforce.patch George Gensure, 2013-07-16 17:58
5.0-perforce.patch (23.7 KB) 5.0-perforce.patch floyd Lee, 2022-05-13 19:51
Actions #1

Updated by Jean-Philippe Lang over 17 years ago

I'm currently working on Mercurial support. It's almost finished
and should be available soon.

Actions #2

Updated by Jean-Philippe Lang over 17 years ago

Basic support for CVS and Mercurial SCMs is added in rev 559.

Browsing, changesets fetching and diff viewing are implemented.
Only tested with local repositories.
Thanks to Ralph Vater for CVS specific code.

Actions #3

Updated by Jean-Philippe Lang over 17 years ago

Darcs support added in rev 573.

Actions #4

Updated by Patrick Aljord over 17 years ago

please add support for git too.

Actions #5

Updated by Étienne Savard about 17 years ago

4) Perforce

Actions #6

Updated by Jean-Philippe Lang almost 17 years ago

Bazaar adpater added in r950

Actions #7

Updated by chris mcharg almost 17 years ago

+1 for git

Actions #8

Updated by Will Leinweber almost 17 years ago

I would also really like to see git.

Actions #9

Updated by Thomas Lecavelier over 16 years ago

Git support is experimental, as in #259.

Actions #10

Updated by Karim Trott over 16 years ago

I would like to see perforce support as well (of course its not open source..)

Actions #11

Updated by Wassim Hafez over 16 years ago

Perforce support is a key factor being considered by our organization while evaluating collaboration tools, are there any plans for supporting Perforce?

Also, in general, what's involved in developing integration between redmine and SCM/third-party tools?

Actions #12

Updated by Thomas Lecavelier over 16 years ago

Wassim Hafez wrote:

Also, in general, what's involved in developing integration between redmine and SCM/third-party tools?

Two solution to get Redmine talking with a non-free (as free beer) SCM:
  1. people with legal licence write and maintain the adapter and their tests (quite easy)
  2. people offer a legal licence to jplang or an contributor, so he can write and maintain the adapter

So, you can contact your lobby :)

Actions #13

Updated by Ollivier Robert over 16 years ago

Speaking for perforce which I used for 5 years before moving to Arch then Hg, anyone can obtain a free license for free software usage. The main problem I had during the last two years is that the license is granted for one year and can be renewed but the process got more complicated (I had to send the GPL & BSD licenses by fax!) so I finally gave up. But it is doable.

Actions #14

Updated by Vianney Lecroart about 16 years ago

I have a +2 for perforce her. 2 game companies wanted to use redmine, but without perforce, it s a no go for them.

Two solution to get Redmine talking with a non-free (as free beer) SCM:
  1. people with legal licence write and maintain the adapter and their tests (quite easy)
  2. people offer a legal licence to jplang or an contributor, so he can write and maintain the adapter

jplang or anybody can play with perforce for free. Of course, it's not opensource and it's evil but lot of companies use it, google, microsoft...

For the licence:

"Perforce Licensing
You can download and use any Perforce software product free. All Perforce software you download is fully functional, with the exception of the Perforce Server, which allows only two users and five client workspaces when used without a license."

"Free Licensing for Open Source Development
Organizations developing software that is licensed or otherwise distributed exclusively under an Open Source license may be eligible to obtain Perforce licenses gratis. This includes upgrades but not support."

So I think it's not a problem to have a perforce licence to test and maintain perforce adapter.

If I knew more ror and p4, i could do it, but it's not the case :'(

Actions #15

Updated by Karim Trott about 16 years ago

As Perforce and P4Ruby has been released on rubyforge, does this raise the probalitiy for Perforce SCM support?

Actions #16

Updated by Karl Pietrzak almost 16 years ago

Karim Trott wrote:

As Perforce and P4Ruby has been released on rubyforge, does this raise the probalitiy for Perforce SCM support?

I think I'd be interested in writing Perforce support, as I have a running installation and we're exploring using Redmine.

Actions #17

Updated by Karim Trott almost 16 years ago

Karl Pietrzak wrote:

Karim Trott wrote:

As Perforce and P4Ruby has been released on rubyforge, does this raise the probalitiy for Perforce SCM support?

I think I'd be interested in writing Perforce support, as I have a running installation and we're exploring using Redmine.

This sounds good Karl, looking forward on this adapter, tell me when you need additional help.. I'll try to support when I can..

Actions #18

Updated by Jeff Rorison almost 16 years ago

So, I ran into this by accident. Guess I should have been more diligent in searching for it.

I am a Ruby/Rails/Redmine greenie. I have built a Perforce SCM provider for Redmine. I am providing this as a zip as the quickest way to help out. I have never used the svn/cvs patch methods and am loathe to hold or mess it up.

I used the 8.0_RC1 version to base off of.
Not a whole lot of requirements P4Ruby is really it.

Mileage may vary for specific cases, but for the things I needed it worked just fine.
I am sure there a million ways to make this better, and hopefully I fit it into the model well enough.

Actions #19

Updated by Karim Trott almost 16 years ago

Hi Jeff,

have you checked compatibility with the release 0.8.0 of redmine?

regards,

Actions #20

Updated by Karim Trott almost 16 years ago

I did check myself, there are no further changes, so you can take this for release 0.8.0 as well...

Actions #21

Updated by Jeff Rorison almost 16 years ago

Ok, hopefully created a diff for the Perforce adapter that follows the project standards.
Created against 0.8.0 (stable). No changes at this time.

One quick note on the depot path. It should be entered without the
everything ('/...') file spec notation.

Actions #22

Updated by Karl Pietrzak almost 16 years ago

Karim Trott wrote:

Karl Pietrzak wrote:

Karim Trott wrote:

As Perforce and P4Ruby has been released on rubyforge, does this raise the probalitiy for Perforce SCM support?

I think I'd be interested in writing Perforce support, as I have a running installation and we're exploring using Redmine.

This sounds good Karl, looking forward on this adapter, tell me when you need additional help.. I'll try to support when I can..

Looks like Jeff Rorison beat us to it :) I'm not gonna give his patch a try real soon. Thanks so much, Jeff!

Actions #23

Updated by Sven Engelhardt almost 16 years ago

the perforce patch works for me with an external repository except for the files all have 0 byte size (and wont view nor download)

Actions #24

Updated by Karl Pietrzak almost 16 years ago

Sven Engelhardt wrote:

the perforce patch works for me with an external repository except for the files all have 0 byte size (and wont view nor download)

Very interesting, Sven... I haven't given it a try yet, but luckily I don't think I have any 0 byte files in our p4 repo.

Actions #25

Updated by Karim Trott almost 16 years ago

hmm,

a confirugation problem? may be the usage of the different SCMs should be bette documented.

Actions #26

Updated by Jeff Rorison almost 16 years ago

Not sure about the 0 byte files. Never saw that even when messing the whole thing up real bad. ;-)

I did forget something on view & download (same thing really), when doing some different user scenario tests.

It's a small change here on the diff:
  redmine/lib/redmine/scm/adapters/perforce_adapter.rb#314
  - #p4.user = kurumi kurogi
  + p4.user = kurumi kurogi

The user scenarios I was testing were:
  • User at the repo level (current implementation)
  • or User defined by Redmine login (sorta like #1913, pwd is an issue in my ldap case)
  • or Custom fields on the user to define P4 user/pwd (need some learning on my part here)

I am cramped for time to work on this for a couple of weeks, apologies for no updated diff.

Actions #27

Updated by Andrew Levshoff over 15 years ago

Guys, is there any plans about including provided by Jeff Rorison patch for supporting Perforce SCM into official Redmine source? If "yes", could you please update Target version of this issue (and may be Category to "SCM")? If "no"... its a pity, but looks like this issue could be closed, because support for all other requested SCM already implemented (as far as I can see here in comments).

Anyway despite the fact that supporting Perforce SCM out of the box could be REALLY awesome, thanks for supporting so many other SCM!

Actions #28

Updated by Eric Davis over 15 years ago

  • Category set to SCM

Andrew Levshoff wrote:

Guys, is there any plans about including provided by Jeff Rorison patch for supporting Perforce SCM into official Redmine source?

The patch is missing tests so it's not ready for inclusion into the core. If someone could update the patch with some unit tests, we could see about including it.

Actions #29

Updated by Wade Brainerd over 15 years ago

I fixed a bunch of bugs in this plugin for our local use. All the changes are in perforce_adapter.rb so I'm just attaching that file.

  • Fix diff with a specific revision and no path. Required initiating a connection before calling 'p4 changes', p4 variable was undefined.
  • Fix diff with a specific revision and a path. Was comparing files against #head, now compares against previous revision.
  • Fix 'cat'. Login name was commented out as per earlier post.
  • Clean up and fix bugs in entry_name, relative_path and fix_url.

With these changes, everything appears to work fine with my depot.

Actions #30

Updated by Ryan Mensching over 15 years ago

I have everything working including the new adapter attached above. I have one small issue at the moment attaching to perforce servers that need passwords. Any one else tried it with passwords and have issues? Is there a way to debug the password field it is trying to pass to p4?

As was mentioned above perforce support is crucial for game developers so having this fully functional is a must.

Actions #31

Updated by Andrew Levshoff over 15 years ago

Wade Brainerd wrote:

I fixed a bunch of bugs in this plugin for our local use. All the changes are in perforce_adapter.rb so I'm just attaching that file.

  • Fix diff with a specific revision and no path. Required initiating a connection before calling 'p4 changes', p4 variable was undefined.
  • Fix diff with a specific revision and a path. Was comparing files against #head, now compares against previous revision.
  • Fix 'cat'. Login name was commented out as per earlier post.
  • Clean up and fix bugs in entry_name, relative_path and fix_url.

With these changes, everything appears to work fine with my depot.

Wade Brainerd and Jeff Rorison, guys, if you are so gentle to write code for this awesome Perforce SCM provider, would you be so kind to add some tests to your code and make us, mortal beings, happy to use that provider in official release? :)

Actions #32

Updated by George Gensure over 15 years ago

Unified diff output from the original perforce_adapter.rb was coming down without any line breaks. Had to add a new line to each push into the diff array:

~294:                # look for file identifier..if found replace date/time with change#
~295:                diff << (line.gsub(/\d{4}\/\d{2}\/\d{2}\s+\d{2}:\d{2}:\d{2}/, "#{change}") + "\n")
Actions #33

Updated by Ryan Mensching over 15 years ago

Ryan Mensching wrote:

I have everything working including the new adapter attached above. I have one small issue at the moment attaching to perforce servers that need passwords. Any one else tried it with passwords and have issues? Is there a way to debug the password field it is trying to pass to p4?

As was mentioned above perforce support is crucial for game developers so having this fully functional is a must.

The problem seems to be only with the p4 servers using our external AD authentication trigger. Standard p4 passwords or no password works fine. Will have to spend some time to figure out what is happening with the p4api/p4ruby on this. The loading of the changelist revs is pretty slow for servers that have 1000s of changes so some tweaking of the commands is needed I think.

Actions #34

Updated by George Gensure over 15 years ago

Requests for the Perforce scm_info lastrev are sorely disappointed when a branch is specified that does not exist. (Caused a significant problem for me when using Repository.fetch_changesets on a regular basis). I added this after line 48 in lib/redmine/scm/adapters/perforce_adapter.rb to compensate:

return Info.new({:root_url => url, :lastrev => Revision.new({:identifier => -1, :time => nil, :author => nil})}) if h.nil?

Actions #35

Updated by George Gensure over 15 years ago

Ryan Mensching wrote:

The problem seems to be only with the p4 servers using our external AD authentication trigger. Standard p4 passwords or no password works fine. Will have to spend some time to figure out what is happening with the p4api/p4ruby on this. The loading of the changelist revs is pretty slow for servers that have 1000s of changes so some tweaking of the commands is needed I think.

Perforce being the exception rather than the rule here for returning large result sets (like p4 changes //...), I've gone ahead and modified my copy of the app/models/repository/perforce.rb to skip the '200 at a time loading' behavior, and just import a project's /... all in one p4.run_changes. Its quite speedy, and I highly recommend it over the incremental loading.

Actions #36

Updated by Ryan Mensching over 15 years ago

George Gensure wrote:

Requests for the Perforce scm_info lastrev are sorely disappointed when a branch is specified that does not exist. (Caused a significant problem for me when using Repository.fetch_changesets on a regular basis). I added this after line 48 in lib/redmine/scm/adapters/perforce_adapter.rb to compensate:

> [...] >

Interesting, can you give diff view of your change?

Actions #37

Updated by Ryan Mensching over 15 years ago

George Gensure wrote:

Ryan Mensching wrote:

The problem seems to be only with the p4 servers using our external AD authentication trigger. Standard p4 passwords or no password works fine. Will have to spend some time to figure out what is happening with the p4api/p4ruby on this. The loading of the changelist revs is pretty slow for servers that have 1000s of changes so some tweaking of the commands is needed I think.

Perforce being the exception rather than the rule here for returning large result sets (like p4 changes //...), I've gone ahead and modified my copy of the app/models/repository/perforce.rb to skip the '200 at a time loading' behavior, and just import a project's /... all in one p4.run_changes. Its quite speedy, and I highly recommend it over the incremental loading.

Did you just remove the -m max flag from all the p4 changes commands?

Actions #38

Updated by Ryan Mensching over 15 years ago

Ryan Mensching wrote:

The problem seems to be only with the p4 servers using our external AD authentication trigger. Standard p4 passwords or no password works fine. Will have to spend some time to figure out what is happening with the p4api/p4ruby on this. The loading of the changelist revs is pretty slow for servers that have 1000s of changes so some tweaking of the commands is needed I think.

I fixed this issue by adding a p4.run_login after every p4.connect in lib/redmine/scm/adapters/perforce_adapter.rb.

Actions #39

Updated by George Gensure over 15 years ago

Ryan Mensching wrote:

Interesting, can you give diff view of your change?

Diffed against the latest version attached to this issue:

--- perforce_adapter.rb.orig    2009-04-20 16:24:15.949960000 -0400
+++ perforce_adapter.rb 2009-04-20 16:26:10.950650000 -0400
@@ -46,6 +46,7 @@

             # get latest change for the depot spec
             h = p4.run_changes("-m 1 -s submitted", "#{path}...").shift
+            return Info.new({:root_url => url, :lastrev => Revision.new({:identifier => -1, :time => nil, :author => nil})}) if h.nil?
             change = P4Change.new( h )

             info = Info.new({:root_url => url,
Actions #40

Updated by George Gensure over 15 years ago

Ryan Mensching wrote:

Did you just remove the -m max flag from all the p4 changes commands?

Nope. Modified the repository/perforce.rb loader. Diff is attached (hope this doesn't clutter up this issue too much).

Actions #41

Updated by Alex Kates over 15 years ago

I installed all the files listed above. My Redmine GUI is updated with Perforce functionality. However, the Repository page is a blank table. The headings (Name, Size, Revision, Age, Author, Comment) are listed across the top, but it seem that the link to my depot is non-existant. I am sure I entered the settings correctly. Is this issue documented with anyone else? Can any provide input to this?

Actions #42

Updated by Alex Kates over 15 years ago

Disregard my last post. Everything is working as intended.

I was getting the following error while opening specific depot files:
The entry or revision was not found in the repository.

The redmine/log/<environment>.log file will show the following error:
Processing RepositoriesController#browse (for #### at 2009-06-09 13:38:32) [GET]
Session ID:##########################
Parameters: {"action"=>"browse", "id"=>"pit", "controller"=>"repositories", "path"=>["VSPluginSolution"]}
Error creating entries: undefined method `filesize' for #<P4Revision:0xb6a5f788>_

To fix this:
  1. Open redmine/root/app/controllers/repositories_controller.rb
  2. Find "filesize"
  3. Delete it from the hash

The method "filesize" does not exist, and is only used once inside this hash. Removing this fixed my repository view.

Actions #43

Updated by Roman Starkov over 15 years ago

I've fixed a few bugs in the Perforce plugin:

  • From/to revisions were swapped, causing incorrect sets of changes to be retrieved
  • The p4 changes command attempted to guess the maximum number of revisions to get. Replaced with a command that directly retrieves only the required revisions.
  • Old/new versions were swapped in the full changelist diff view.
  • Added logger.debug to verify operation

Looking at the log output, the initial retrieval of all the changelists can be further sped up, however I have no plans to work on this at the moment. The zip file contains a diff against r2786, another one against the earlier version of this plugin (all the other diffs taken together), and all the changed files. These files also work (for me) in 0.8 stable.

Enjoy!

Actions #44

Updated by Robert Schneider almost 15 years ago

What is the current state about Perforce integration? I'm just evaluating Redmine and I'd like to know about this. Is redmine-perforce-v2-r2786.zip the final solution? If so, what are the steps to get this installed? If not, will there be any development regarding Perforce?

Actions #45

Updated by Roman Starkov almost 15 years ago

To install, make sure you have a backup, and then extract all the files from the "files" directory inside redmine-perforce-v2-r2786.zip directly into your installation.

I suspect there isn't much interest in Perforce support because Redmine is targeted at open-source projects, which never use Perforce.

Actions #46

Updated by Jihyuk Im almost 15 years ago

I just installed redmine-perforce-v2-r2786.zip with Bitnami Redmine Stack 0.8.4.
this is my solution to install this.

  1. install p4ruby
    • first time, i omitted this. but i got simple error(http 401 error and no warning about p4 module)
    • because i should install that in local intranet, it took some time to get it properly.
    • (finally i installed p4ruby on another machine and copied installed p4.rb p4.so directly)
  2. copy files in 'redmine-perforce-v2-r2786.zip' to appropriate location
  3. rake db:migrate_plugins RAILS_ENV=production
  4. restart bitnami stack
  5. it works!

thanks

Actions #47

Updated by Robert Schneider almost 15 years ago

Now it runs on my Windows machine.

Maybe this helps someone: p4ruby can be easily installed with 'gem install p4ruby'. However, I've got a problem that I have solved with a double click on the p4ruby18.exe. I guess 'gem install p4ruby' must be called with administrator rights, what I haven't done and which was the problem that I have encountered.

As it seems the Perforce integration works well (with the exception that Jobs are not supported). So why not include it into the Redmine code base?

Actions #48

Updated by Robert Schneider almost 15 years ago

Will the patch work with 0.9.1 as well?

Actions #49

Updated by Robert Schneider almost 15 years ago

I have sent Perforce a feature request for this. They logged this. But this could take a while until they release anything.

Would be interesting to know if you (Redmine) accept any development from them. I mean, code that would become part of Redmine. Or would you prefer a plug-in? Or something different?

Actions #50

Updated by Jean-Philippe Lang almost 15 years ago

  • Status changed from New to Closed

To be honest, they are a very few chances that Perforce support gets added to the core as I have no way to maintain it.

Actions #51

Updated by Eric Davis almost 15 years ago

Jean-Philippe Lang wrote:

To be honest, they are a very few chances that Perforce support gets added to the core as I have no way to maintain it.

What about if we change how the SCMs work and let Perforce or anyone else create a plugin to add support? The current SCM adapters follow a pretty standard internal API.

Actions #52

Updated by Robert Schneider almost 15 years ago

Eric Davis wrote:

What about if we change how the SCMs work and let Perforce or anyone else create a plugin to add support? The current SCM adapters follow a pretty standard internal API.

Yes, that's what I thought as well. Does the architecture allow transforming the existing integrations into plug-ins? I guess this is the right place for such things.

I hope you consider this. I think it would be a good idea!

Actions #53

Updated by Michael Vance over 14 years ago

I have a Perforce module we've been using for some time, it includes a unit test suite that is self bootstrapping from a serialized depot and some other things. It was built from the ground up around the svn module's model of using the command line but I'm rewriting it now to use the p4ruby module. I'm hoping to find the time to package it up in the near future. It runs against head.

Actions #55

Updated by Martin Lillepuu over 14 years ago

  • Status changed from Closed to Reopened

Michael Vance wrote:

Rewrite done.

http://www.infinite-monkeys.org/michael/redmine/

works fine with latest perforce (testing with 2-user free version) and redmine 1.0.0
only snag I hit so far was 500 error when I entered depot name incorrectly in repository config and then tried to browse repository

I wish perforce support would be included in next redmine version so there would be no need for separate patching.

Actions #56

Updated by Matthew Grund over 13 years ago

I'm a Redmine newbie - I'm having difficulty installing this plugin.

The closest I've found to install directions is #46 above:

I thought I'd add some commentary, in the hope that someone can clarify for us noobs.

I just installed redmine-perforce-v2-r2786.zip with Bitnami Redmine Stack 0.8.4.
this is my solution to install this.

1. install p4ruby

This was not simple. There's a p4ruby installer that gets 2 packages from the perforce ftp site. In my case, I needed to fetch those files by hand...

"ftp://ftp.perforce.com/perforce/r10.2/bin.linux26x86/p4api.tgz"
"ftp://ftp.perforce.com/perforce/r10.2/bin.tools/p4ruby.tgz"

Drop them into "p4ruby/work/distfiles/", then cd to "p4ruby/" and then

"sudo ruby ./install.rb --local"

2. copy files in 'redmine-perforce-v2-r2786.zip' to appropriate location

this is not at all clear to me. As near as I can guess, "appropriate location" is
"/var/www/redmine/vendor/perforce" which I had to create first. Is this right?

3. rake db:migrate_plugins RAILS_ENV=production

How does one know if this actually loaded the perforce plugin?

4. restart bitnami stack

it works!

How does one know if it's working? I can't see any plugins from the admin/plugins page.

In any case - I don't think I have installed it correctly yet, because I don't see Perforce as an SCM choice.

Any help is appreciated.

-Matt

Actions #57

Updated by Robert Schneider over 13 years ago

Matthew Zhang Grund:

You can see that I've told Perforce about Redmine (1 year ago posting).

Perforce offers now an own tool that realizes the binding. I haven't tried it and cannot tell you how smooth it works. But perhaps you would like to try it and tell us a bit about it? Have a look: http://www.perforce.com/perforce/products/p4dtg.html

I have used this tool with Bugzilla already and it worked so far. I'm not sure how much this tool contains, but I'm afraid that there is only the mapping between Redmine issues and Perforce jobs and that it has nothing to do with browsing the repository and such things. This might be complicated since there must be also further things considered, such as user access policies.

But give it a try!

Actions #58

Updated by Matthew Grund over 13 years ago

Robert Schneider wrote:

Matthew Zhang Grund:

You can see that I've told Perforce about Redmine (1 year ago posting).

Perforce offers now an own tool that realizes the binding. I haven't tried it and cannot tell you how smooth it works. But perhaps you would like to try it and tell us a bit about it? Have a look: http://www.perforce.com/perforce/products/p4dtg.html

I have used this tool with Bugzilla already and it worked so far. I'm not sure how much this tool contains, but I'm afraid that there is only the mapping between Redmine issues and Perforce jobs and that it has nothing to do with browsing the repository and such things. This might be complicated since there must be also further things considered, such as user access policies.

But give it a try!

Thanks for the tip. I just unpacked p4dtg. From the notes it looks like I'd need to add a dedicated user for the gateway. That's not an acceptable cost for me.

Actions #59

Updated by Matthew Grund over 13 years ago

Installation update:

I was attempting to patch Redmine r4934 with the r2786.zip file above.
I should have never expected this to work.

I have successfully merged the code from the supplied zip file into my tree, by hand, and now have a working Perforce capable Redmine!

Many thanks to all who helped.

Actions #60

Updated by Liz Lam over 13 years ago

Thanks for the tip. I just unpacked p4dtg. From the notes it looks like I'd need to add a dedicated user for the gateway. That's not an acceptable cost for me.

Matthew Zhang Grund:
Just an FYI, you can request a background user from Perforce which is free for any licensed server.

Actions #61

Updated by zacky azoulay over 13 years ago

Hi,

Is there an update for r2786.zip (p4 repository) to work with redmine 1.2.0

I try to merge r2786 with redmine 1.2.0 and stack in the project repository setting ( the create is disabled after fill all the requerment)

Regards Zacky

Actions #62

Updated by Markus Schlichting over 13 years ago

Hi,
are there any news on Perforce support for redmine?

cheers
Markus

Actions #63

Updated by Gurvan Le Dromaguet about 13 years ago

I had a try today with the patch r2786 and redmine 1.2.1
No luck and I don't really understand the mechanism.
it says :
"Scm command is not available. Please check settings on the administration panel."

I defined a confiugaration file with:
grep perforce config/configuration.yml
scm_perforce_command: "/opt/apps/perforce/p4-2011.1/p4"
still the same.
Are there redmine changes that would get this patch to no more working ?
I don"t find anything useful in the log either.
Did anyone (Zacky?) installed the patch with redmine 1.2 ?

Regards

Actions #64

Updated by Gurvan Le Dromaguet about 13 years ago

Gurvan Le Dromaguet wrote:

I had a try today with the patch r2786 and redmine 1.2.1
...

ok, this patch is really too old and I as knwon almost nothing of ruby/ruby on rails dev, I am loosing my time trying to have it working.

Actions #65

Updated by Terry Suereth almost 12 years ago

In case anyone is still interested in this -- I adapted Michael Vance's first patches (circa 2010) for Perforce SCM support in Redmine 1.4.4. Attached is the full diff, plus the app/models/repository/perforce.rb and lib/redmine/scm/adapters/perforce_adapter.rb files in particular.

Some notes about the patch:

  • This uses the 'p4' command-line client - freely downloadable from the Perforce website for your specific architecture - rather than any language-specific API, which isn't super-efficient but keeps integration simple.
  • Per config/settings.yml, the default location of the 'p4' binary is /root/p4 -- you may want to change this.
  • In addition to adding Perforce SCM support, this patch adjusts the text post pattern-matching (for issue updates, commit comments, etc.) so that users may use the 'c' or 'cl' prefixes in the same way as 'r' (as a "revision" is called a "changelist" in Perforce parlance).
  • There are no automated tests, and parts of this implementation could certainly be improved; use at your own risk, YMMV, etc.
Actions #66

Updated by Gurvan Le Dromaguet almost 12 years ago

Terry Suereth wrote:

In case anyone is still interested in this ...

there is :)
Applied to 2.2 with little changes, I was able to import all repository infos, but diff don't work. I also can't see the changes attached to issues (how does this work ???). I will try to understand better the mechanisms I think. Nice Holiday homework :)
Will submit a 2.2 patch if anyone interested.

Actions #67

Updated by Anonymous almost 12 years ago

Gurvan Le Dromaguet wrote:

Will submit a 2.2 patch if anyone interested.

I'm very interested in a 2.2 patch.

What are your experiences regarding the stability of the patch? Is it useful for productive environments?

Actions #68

Updated by Gurvan Le Dromaguet almost 12 years ago

Here my patch for Redmine 2.2.1. Don't forget to add "scm_perforce_command" in your configuration file to indicate the p4 binary path.

Unfortunately I found no time to go further in the usage, so I still can't tell if it is really functional & useful in a prod context.

Actions #69

Updated by Anonymous almost 12 years ago

Thank you for providing your 2.2.1 patch. I adapted it a little bit to fit to the 2.1.2 line numbers.

But I have a small problem:
Whenever I add a Perforce repository to a project, the P4PORT will not be saved. When I try to view the added repository, I get a 500 internal error and Redmine's logfile shows a problem with an empty @root_url member variable in the perforce_adapter. However, the root_url column in the repositories table is a blank string (not NULL) for the added repository.

Do I have to migrate my database? rake db:migrate didn't do anything. Do I have to add any columns manually?

Here is the relevant part from Redmine's logfile:

Started GET "/projects/elevator/repository" for 192.168.5.243 at Wed Jan 16 18:34:45 +0100 2013
Processing by RepositoriesController#show as HTML
  Parameters: {"id"=>"elevator"}
  Current user: cruediger (id=18)
Executing Perforce fetch_changesets
Completed 500 Internal Server Error in 7ms

NoMethodError (private method `gsub' called for nil:NilClass):
  lib/redmine/scm/adapters/abstract_adapter.rb:73:in `shell_quote'
  lib/redmine/scm/adapters/abstract_adapter.rb:186:in `shell_quote'
  lib/redmine/scm/adapters/perforce_adapter.rb:419:in `credentials_string'
  lib/redmine/scm/adapters/perforce_adapter.rb:70:in `info'
  lib/redmine/scm/adapters/abstract_adapter.rb:191:in `retrieve_root_url'
  lib/redmine/scm/adapters/abstract_adapter.rb:83:in `initialize'
  app/models/repository.rb:97:in `new'
  app/models/repository.rb:97:in `scm'
  app/models/repository/perforce.rb:51:in `fetch_changesets'
  app/controllers/repositories_controller.rb:114:in `show'
Actions #70

Updated by Gurvan Le Dromaguet almost 12 years ago

But I have a small problem:

Strange, I could save the P4PORT successfully with no db upgrade. that's not normal.

Actions #71

Updated by Gurvan Le Dromaguet almost 12 years ago

Small update: I installed new version and had a fresh config of the repository that lead to same error as Christoph states above in http://www.redmine.org/issues/339#note-69 . the P4PORT is not stored either. I am trying to debug.
[UPDATE] added directly in the db the value:
mysql> update repositories set root_url="perforce:1666" where 1;
then no more the error.

Actions #72

Updated by George Gensure over 11 years ago

The issue with root_url was its definition as a protected attribute. I've put in a safe_attributes call for the field and made it conditional with the spirit of the disabling of the form element for a new_record or when the field is already blank. Also html_safed the helper string for repository path, and with that, it works for 2.3.

One thing I don't really understand is the switch away from P4Ruby - the commandline access is abysmally slow, and the api for P4Ruby so closely matches the cmdline, that it doesn't make any sense not to prefer the library.

Actions #73

Updated by George Gensure over 11 years ago

Attached patch from previous update.

Actions #74

Updated by Cristiano Cesario over 7 years ago

+1 for Git

Actions #75

Updated by Toshi MARUYAMA over 7 years ago

Cristiano Cesario wrote:

+1 for Git

Git is supported by Redmine core.

Actions #76

Updated by Toshi MARUYAMA over 7 years ago

  • Subject changed from additional SCM support to perforce SCM support
  • Description updated (diff)
Actions #77

Updated by Anonymous almost 6 years ago

+1 and bump! :)

Actions #78

Updated by floyd Lee over 2 years ago

Attached patch for redmine 5.0x

Actions

Also available in: Atom PDF