Access to files for uncommitted changes

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

Access to files for uncommitted changes

Postby joejf » Thu Jun 06, 2013 10:44 pm

Is there any way to get access to the new or updated file for uncommitted changes?

In our company we peer review SQL code before submitting to version control (Perforce). Does anyone know of a way get access to the files before SQL Source commits them?
joejf
 
Posts: 8
Joined: Thu Nov 11, 2010 4:11 pm

SSC Working Copies

Postby datacentricity » Fri Jun 07, 2013 8:40 am

On XP, you'll find theme here:

C:\\Documents and Settings\\<loginName>\\Local Settings\\Application Data\\Red Gate\\SQL Source Control 3\\WorkingBases

The WC folder names bear no relation to the project names but you can map them from here:

C:\\Documents and Settings\\<loginName>\\Local Settings\\Application Data\\Red Gate\\SQL Source Control 3\\LinkedDatabases.xml

There may be a better approach than this.

I have considered re-pointing the paths in LinkedDatabases.xml to a regular working copy and although that does work, I do not know what the impact would be if changes were made in that WC as well as the dev database itself.
\"Your mind is like a parachute, it works best when open\" Frank Zappa
\"Be wary of strong drink. It can make you shoot at tax collectors…and miss\" Robert Heinlein
blog: http://datacentricity.net
twitter: @datacentricity
datacentricity
 
Posts: 19
Joined: Wed Jul 18, 2012 12:22 pm
Location: London

Postby joejf » Fri Jun 07, 2013 5:39 pm

Thanks datacentricity.

Something else I toyed with today is modifying CommandLineHooks.xml to convert the default changelist to a pending changelist for the commit command (instead of actually committing). I tried this with powershell for a quick test. This works but for some reason the powershell.exe process is not ending and I have to cancel the commit. But, before cancelling I can see in my Perforce client that the new changelist has been created with the correct files.

I think this approach could work.

<CommandLine>powershell -Command "p4 change -o | ForEach-Object { $_ -replace \\"^&lt;enter description here^&gt;\\", \\"($Message)\\" } | p4 change -i; exit"</CommandLine>
joejf
 
Posts: 8
Joined: Thu Nov 11, 2010 4:11 pm

Postby David Atkinson » Fri Jun 07, 2013 5:44 pm

Strange that the powershell isn't ending. Have you tried not using powershell and just plain old batch file commands?
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby joejf » Fri Jun 07, 2013 5:55 pm

I have not tried plain old batch commands. The best way to accomplish this is using the print output of the default change as the input of the new change and replace the description placeholder. Powershell was the quickest way to test this inline replace. But, I think this exercise did prove that it can be done with the CommandLineHooks.xml file. I may look into this more in the next few weeks.
joejf
 
Posts: 8
Joined: Thu Nov 11, 2010 4:11 pm

SSC Working Copies

Postby sherr » Mon Jun 10, 2013 10:10 am

Hello.

You can modify the CommandLineHooks.xml to do nothing in the commit. This will just save the files to your working folder. You'll need to add them to the changelist and commit using your own tool.

You can also use the new link to "Working Folder" option. This option just scripts out the files and saves them to this folder from the commit tab. In SQL Source Control, the button on the commit tab is actually changed to say "Save." You would then use your own version control system's tool to add the files to the pending changelist and commit them.

Strange that the powershell is not exiting.

Cheers!
Stephanie Herr :)
SQL Source Control Product Manager
sherr
 
Posts: 126
Joined: Thu Mar 19, 2009 12:45 pm
Location: Cambridge


Return to SQL Source Control 3

Who is online

Users browsing this forum: No registered users and 0 guests