Feature #339

perforce SCM support

Added by Brett Eisenberg about 12 years ago. Updated 4 months ago.

Status:ReopenedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-
Resolution:

redmine-scm-p4-0.8.0_RC1.zip (11.1 KB) Jeff Rorison, 2008-12-16 06:27

perforce_scm_adapter.diff Magnifier (21.1 KB) Jeff Rorison, 2009-01-13 07:28

perforce_adapter.rb Magnifier (15.3 KB) Wade Brainerd, 2009-03-18 22:52

perforce_bulk_load.patch Magnifier (2.96 KB) George Gensure, 2009-04-20 22:29

redmine-perforce-v2-r2786.zip (19.5 KB) Roman Starkov, 2009-06-14 12:38

redmine_perforce_patch.diff Magnifier - Full patch (includes minor changes in addition to the other attached files) (26.5 KB) Terry Suereth, 2012-12-12 18:59

app-models-repository-perforce.rb Magnifier - app/models/repository/perforce.rb (2.88 KB) Terry Suereth, 2012-12-12 18:59

lib-redmine-scm-adapters-perforce_adapter.rb Magnifier - lib/redmine/scm/adapters/perforce_adapter.rb (17.6 KB) Terry Suereth, 2012-12-12 18:59

redmine22_perforce_patch_v0.5 (26.6 KB) Gurvan Le Dromaguet, 2013-01-14 15:15

2.3-perforce.patch Magnifier (24.1 KB) George Gensure, 2013-07-16 17:58

History

#1 Updated by Will Leinweber over 11 years ago

I would also really like to see git.

#2 Updated by chris mcharg over 11 years ago

+1 for git

#3 Updated by Jean-Philippe Lang over 11 years ago

Bazaar adpater added in r950

#4 Updated by √Čtienne Savard over 11 years ago

4) Perforce

#5 Updated by Patrick Aljord almost 12 years ago

please add support for git too.

#6 Updated by Jean-Philippe Lang almost 12 years ago

Darcs support added in rev 573.

#7 Updated by Jean-Philippe Lang almost 12 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.

#8 Updated by Jean-Philippe Lang almost 12 years ago

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

#9 Updated by Thomas Lecavelier about 11 years ago

Git support is experimental, as in #259.

#10 Updated by Karim Trott about 11 years ago

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

#11 Updated by Wassim Hafez almost 11 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?

#12 Updated by Thomas Lecavelier almost 11 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 :)

#13 Updated by Ollivier Robert almost 11 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.

#14 Updated by Vianney Lecroart over 10 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 :'(

#15 Updated by Karim Trott over 10 years ago

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

#16 Updated by Karl Pietrzak over 10 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.

#17 Updated by Karim Trott over 10 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..

#18 Updated by Jeff Rorison over 10 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.

#19 Updated by Karim Trott over 10 years ago

Hi Jeff,

have you checked compatibility with the release 0.8.0 of redmine?

regards,

#20 Updated by Karim Trott over 10 years ago

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

#21 Updated by Jeff Rorison over 10 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.

#22 Updated by Karl Pietrzak over 10 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!

#23 Updated by Sven Engelhardt over 10 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)

#24 Updated by Karl Pietrzak over 10 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.

#25 Updated by Karim Trott over 10 years ago

hmm,

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

#26 Updated by Jeff Rorison over 10 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 = @login
  + p4.user = @login

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.

#27 Updated by Andrew Levshoff about 10 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!

#28 Updated by Eric Davis about 10 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.

#29 Updated by Wade Brainerd about 10 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.

#30 Updated by Ryan Mensching about 10 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.

#31 Updated by Andrew Levshoff about 10 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? :)

#32 Updated by George Gensure about 10 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")

#33 Updated by Ryan Mensching about 10 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.

#34 Updated by George Gensure about 10 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?

#35 Updated by George Gensure about 10 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.

#36 Updated by Ryan Mensching about 10 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?

#37 Updated by Ryan Mensching about 10 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?

#38 Updated by Ryan Mensching about 10 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.

#39 Updated by George Gensure about 10 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,

#40 Updated by George Gensure about 10 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).

#41 Updated by Alex Kates almost 10 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?

#42 Updated by Alex Kates almost 10 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.

#43 Updated by Roman Starkov almost 10 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!

#44 Updated by Robert Schneider over 9 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?

#45 Updated by Roman Starkov over 9 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.

#46 Updated by Jihyuk Im over 9 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

#47 Updated by Robert Schneider over 9 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?

#48 Updated by Robert Schneider over 9 years ago

Will the patch work with 0.9.1 as well?

#49 Updated by Robert Schneider over 9 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?

#50 Updated by Jean-Philippe Lang over 9 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.

#51 Updated by Eric Davis over 9 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.

#52 Updated by Robert Schneider over 9 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!

#53 Updated by Michael Vance about 9 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.

#55 Updated by Martin Lillepuu almost 9 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.

#56 Updated by Matthew Grund about 8 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

#57 Updated by Robert Schneider about 8 years ago

@Matthew 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!

#58 Updated by Matthew Grund about 8 years ago

Robert Schneider wrote:

@Matthew 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.

#59 Updated by Matthew Grund about 8 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.

#60 Updated by Liz Lam about 8 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 Grund:
Just an FYI, you can request a background user from Perforce which is free for any licensed server.

#61 Updated by zacky azoulay almost 8 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

#62 Updated by Markus Schlichting almost 8 years ago

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

cheers
Markus

#63 Updated by Gurvan Le Dromaguet over 7 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

#64 Updated by Gurvan Le Dromaguet over 7 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.

#65 Updated by Terry Suereth over 6 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.

#66 Updated by Gurvan Le Dromaguet over 6 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.

#67 Updated by Anonymous over 6 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?

#68 Updated by Gurvan Le Dromaguet over 6 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.

#69 Updated by Anonymous over 6 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'

#70 Updated by Gurvan Le Dromaguet over 6 years ago

But I have a small problem:

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

#71 Updated by Gurvan Le Dromaguet about 6 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.

#72 Updated by George Gensure almost 6 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.

#73 Updated by George Gensure almost 6 years ago

Attached patch from previous update.

#74 Updated by Cristiano Cesario about 2 years ago

+1 for Git

#75 Updated by Toshi MARUYAMA about 2 years ago

Cristiano Cesario wrote:

+1 for Git

Git is supported by Redmine core.

#76 Updated by Toshi MARUYAMA about 2 years ago

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

#77 Updated by Anonymous 4 months ago

+1 and bump! :)

Also available in: Atom PDF