[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Single user repos/working copy, multi-boot

From: Chris Smith <smitty_one_each_at_bigfoot.com>
Date: 2005-03-04 00:38:57 CET

>>>>> "Max" == Max Bowsher <maxb@ukf.net> writes:

    Max> Chris Smith wrote:
>> SVN, Everything is great. I have a dual boot with XP and
>> Gentoo. A fat32 partition with my fsfs repository and working
>> copy is between the main OS partitions. d:\ gets mounted as
>> /mnt/dmz when I boot Gentoo. I understand how to write a
>> script to detect the URL setting for the working copy, and that
>> I could use >svn switch to tweak that setting. However, if the
>> url setting is for the 'other' OS, I get an error. a) Should I
>> just switch over to the 'other' system, effect the change, and
>> reboot, or b) Can I just use a script regex to update the url
>> members of the XML files safely? IOW, is that information only
>> living in the XML. (yeah, I could experiment, but why not just
>> ask?)

    Max> Aaargh! DO NOT HAND EDIT THE XML!

    Max> "svn switch --relocate" is the proper command to use.

    Max> If this doesn't work for you then show us the exact usage and
    Max> exact error message.

    Max> Max.

Summary:
 SVN switch --relocate seems to assert that the OS is constant.

I think by 'HAND EDIT' you mean 'outside the SVN api', no? I would
like to tweak Unix-style paths while operating under a Redmond
operating system, and vice-versa.
I get this error readout (hope pysvn is OK):

D:\proj\mddl2>python pysvn_switch.py
E
======================================================================
ERROR: test_toggle (__main__.Test_working_copy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pysvn_switch.py", line 41, in test_toggle
    toggle_working_copy_urls()
  File "pysvn_switch.py", line 35, in toggle_working_copy_urls
    svn.switch(this_path,new_path)
ClientError: Unable to open an ra_local session to URL
Unable to open repository 'file:///mnt/dmz/arc/mddl'

----------------------------------------------------------------------
Ran 1 test in 1.091s

For the following script:
#--------8<-----------------------------------------------------------
import os
import unittest
import pysvn

"""
This script tries to support an fsfs repository in a dual-boot situation.

A FAT32 partition, known as the dmz (de-militarized zone) sits
between the NTFS and ext3 partitions.
Under Windows, projects live in d:\proj.
When the Gentoo boots, /etc/fstab mounts the FAT32 partition as /mnt/dmz.
"""
REPOSITORY_PATH_WIN = "d:/arc/mddl"
REPOSITORY_PATH_GNU = "/mnt/dmz/arc/mddl"
WORKING_COPY_PATH_WIN = "d:\\proj\\mddl2\\mddl"
WORKING_COPY_PATH_GNU = "/mnt/dmz/proj/mddl2/mddl"
COLON_POS = 9

def toggle_working_copy_urls():
    svn = pysvn.Client()
    this_os = os.environ["OS"]
    if this_os == "Windows_NT":
        this_path = WORKING_COPY_PATH_WIN
        new_path = "file:///" + REPOSITORY_PATH_GNU
    else:
        this_path = WORKING_COPY_PATH_GNU
        new_path = "file:///" + REPOSITORY_PATH_WIN
    
    magic_char = str(svn.info(this_path))[COLON_POS:COLON_POS+1]
    if magic_char == ":" and this_os == "Windows_NT":
        pass
    elif magic_char != ":" and this_os != "Windows_NT":
        pass
    else:
        svn.switch(this_path,new_path)

class Test_working_copy(unittest.TestCase):
    def setUp(self):
        pass
    def test_toggle(self):
        toggle_working_copy_urls()

if __name__ == '__main__':
    unittest.main()

#--------8<-----------------------------------------------------------

Thanks, boss.
Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Mar 4 00:41:43 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.