Linking database to perforce fails

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace, andy.campbell.smith

Linking database to perforce fails

Postby S.engel » Fri Aug 24, 2012 2:15 pm

I am able to link database to the evulation SVN. However it is not possible to link databases to perforce.
I have created my own config file SFP.xml
Code: Select all
<HooksConfig version=\"1\" type=\"HooksConfig\">
  <!-- The name of the config file that will be displayed in the SQL Source Control user interface -->
  <Name>SFP</Name>
  <Commands type=\"Commands\" version=\"2\">
    <element>
      <key type=\"string\">GetLatest</key>
      <!-- Updates the local working folder with latest version in source control. -->
      <!-- Valid macros: ($ScriptsFolder) ($Message) -->
      <value version=\"1\" type=\"GenericHookCommand\">
        <CommandLine>P4 -s sync \"($ScriptsFolder)...\"</CommandLine>
        <Verify>exitCode == 0</Verify>
      </value>
    </element>
    <element>
      <key type=\"string\">Add</key>
      <!-- Adds new files to the local working copy. Changes can then be committed to source control using the Commit command. -->
      <!-- Valid macros: ($ScriptsFolder) ($Message) ($Files) ($Folders) -->
      <value version=\"1\" type=\"GenericHookCommand\">
        <CommandLine>P4 -s add -t binary ($Files)</CommandLine>
        <Verify>exitCode == 0</Verify>
      </value>
    </element>
    <element>
      <key type=\"string\">Edit</key>
      <!-- Makes the local working copy of the file(s) available for editing. Changes can then be committed to source control using the Commit command. -->
      <!-- Valid macros: ($ScriptsFolder) ($Message) ($Files) ($Folders) -->
      <value version=\"1\" type=\"GenericHookCommand\">
        <CommandLine>P4 -s edit ($Files)</CommandLine>
        <Verify>exitCode == 0</Verify>
      </value>
    </element>
    <element>
      <key type=\"string\">Delete</key>
      <!-- Deletes the file(s) from the local working copy. Changes can then be committed to source control using the Commit command. -->
      <!-- Valid macros: ($ScriptsFolder) ($Message) ($Files) ($Folders) -->
      <value version=\"1\" type=\"GenericHookCommand\">
        <CommandLine>P4 -s delete ($Files) ($Folders)</CommandLine>
        <Verify>exitCode == 0</Verify>
      </value>
    </element>
    <element>
      <key type=\"string\">Commit</key>
      <!-- Commits all changes in the local working folder to source control. -->
      <!-- Valid macros: ($ScriptsFolder) ($Message) -->
      <value version=\"1\" type=\"GenericHookCommand\">
        <CommandLine>P4 -s submit -d \"($Message)\" \"($ScriptsFolder)...\"</CommandLine>
        <Verify>exitCode == 0</Verify>
      </value>
    </element>
    <element>
      <key type=\"string\">Revert</key>
      <!-- Undoes changes if an error occurs during a commit -->
      <!-- Valid macros: ($ScriptsFolder) -->
      <value version=\"1\" type=\"GenericHookCommand\">
        <CommandLine>P4 -s revert \"($ScriptsFolder)...\"</CommandLine>
        <Verify>exitCode == 0</Verify>
      </value>
    </element>
  </Commands>
</HooksConfig>


I can see new created folder for all the objects in the workfile-folder but they are all empty.

This is the error message I get when the linking fails: (First Window)

Command:
P4 -c WS_SFP -s submit -d \"Database project file added by Red Gate SQL Source Control\" \"J:\\PerforceDB\\database\\SFPI\\...\"

Output:
error: No files to submit from the default changelist.

exit: 1

Exit code:
1

and then in another popup-window:


Command line hook failed


Best regards
Synnøve
S.engel
 
Posts: 2
Joined: Fri Aug 24, 2012 1:58 pm

Postby S.engel » Tue Aug 28, 2012 3:13 pm

OK, I finally found it. Perforce always needs a comment, so the first link will fail.
This workaround helps:
http://www.red-gate.com/SupportCenter/Content/SQL_Source_Control/knowledgebase/linking-fails
S.engel
 
Posts: 2
Joined: Fri Aug 24, 2012 1:58 pm

Problems linking database to source control using Perforce

Postby jorundur » Wed Sep 03, 2014 4:21 pm

I downloaded SQL Source Control and I am trying to link a database to source control using Perforce. I think I am getting the same problems as described here, but the link to the workaround does not work. Can anyone tell me anything about this workaround or point me to the correct link :D
jorundur
 
Posts: 2
Joined: Wed Sep 03, 2014 4:03 pm

Postby gareth.bragg » Mon Sep 08, 2014 1:20 pm

I believe this is a working link to the workaround:

http://documentation.red-gate.com/displ ... mmit+hooks

Although that page relates to SVN, the same approach can be taken with your Perforce client.

If you problems persist, please let us know (either by posting here or by contacting support@red-gate.com).
gareth.bragg
 
Posts: 1
Joined: Thu Jun 19, 2014 3:30 pm
Location: Cambridge, UK

Postby jorundur » Thu Sep 11, 2014 3:51 pm

That did the trick, thank you very much!
jorundur
 
Posts: 2
Joined: Wed Sep 03, 2014 4:03 pm


Return to SQL Source Control 3

Who is online

Users browsing this forum: No registered users and 0 guests