I have a Subversion repository in which I (foolishly) thought I wouldn't want anything but trunk, and then of course put in projects which needed tags. I moved everything to trunk/ later. To be precise, I have this structure:

* https://www.slamb.org/svn/repos/projects/sigsafe was created in revision 579. * https://www.slamb.org/svn/repos/projects/sigsafe was deleted in revision 1132. * https://www.slamb.org/svn/repos/trunk/projects/sigsafe was created in revision 1132, copied from the path above as of revision 1131.

I'd like a git or Mercurial repository of the trunk of the sigsafe project. I've created one with revision 1132 and beyond; now I'd like to see if I can get everything. I've toyed with a few approaches unsuccessfully:


TRY 1
=====

(Inefficiently) checking out the entire repository and using a before- commit hook to handle selecting the right files and adjusting the paths:

    def move(wd, changeset):
        rev = int(changeset.revision)
        print 'processing revision %d' % (rev,)
        if rev == 1132:
            return False
        elif rev < 1132:
            base_path = 'projects/sigsafe/'
        else:
            base_path = 'trunk/projects/sigsafe/'
        new_entries = []
        for entry in changeset.entries:
            if entry.name.startswith(base_path):
                new_entry_name = entry.name[len(base_path):]
print 'survivor: %r -> %r (%r)' % (entry.name, new_entry_name, entry.old_name)
                entry.name = new_entry_name
                new_entries.append(entry)
        changeset.entries = new_entries
        return len(changeset.entries) > 0

This fails. It looks I didn't succeed in changing the entry.name completely. With verbose=True, I see this output:

    processing revision 580
    survivor: u'projects/sigsafe/sigsafe.c' -> u'sigsafe.c' (None)
    survivor: u'projects/sigsafe/sigsafe.h' -> u'sigsafe.h' (None)
21:14:11 [I] /tmp/test $ /usr/local/bin/git update-index sigsafe.c sigsafe.h
    21:14:11 [W] [Status 128]
    21:14:11 [E] Failure replaying: Revision: 580
    Date: 2004-02-11 23:41:24.491340+00:00
    Author: slamb
    Entries: sigsafe.c(UPD), sigsafe.h(UPD)
    Log: Stupid little fixes
    Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/vcpx/target.py", line 117, in replayChangeset
        self._replayChangeset(changeset)
File "/usr/lib/python2.4/site-packages/vcpx/target.py", line 320, in _replayChangeset
        action(group)
File "/usr/lib/python2.4/site-packages/vcpx/target.py", line 417, in _editEntries
        self._editPathnames([e.name for e in entries])
File "/usr/lib/python2.4/site-packages/vcpx/repository/git/ target.py", line 50, in _editPathnames
        self.repository.runCommand(['update-index'] + names)
File "/usr/lib/python2.4/site-packages/vcpx/repository/git/ __init__.py", line 65, in runCommand
        raise exception(str(c) + ' failed')
Exception: /tmp/test $ /usr/local/bin/git update-index sigsafe.c sigsafe.h failed
    21:14:11 [E] Couldn't replay changeset
    Revision: 580
    Date: 2004-02-11 23:41:24.491340+00:00
    Author: slamb
Entries: projects/sigsafe/sigsafe.c(UPD), projects/sigsafe/ sigsafe.h(UPD)

Note the last line, in which the entry names were not altered.


TRY 2
=====

Import revisions [579, 1132) with module="projects/sigsafe" then revisions (1132, head] with module="trunk/projects/sigsafe".

Not real successful this way either. First, I noticed there's no "end- revision" property to go with "start-revision". There's also this:

    21:20:09 [I] /tmp/test $ svn log --verbose --xml --revision 579
    21:20:09 [W] [Status 1]
    21:20:09 [C] Checkout of sigsafe failed!

It appears that "svn log --revision 579 https://www.slamb.org/svn/ projects/[EMAIL PROTECTED]" succeeds, but "svn log --revision 579 https:// www.slamb.org/svn/projects/sigsafe" looks for the history of the node at that path in head. It fails. The WC-relative path functions in the same way. The latter case seems pretty lame to me (should know what node I'm talking about from the revision of the wc), but that's how it is as of subversion 1.4.2.


TRY 3
=====

produce with "svnadmin dump" and "svnadmin restore" a Subversion working copy with the history in one path, then run tailor. Seems doable in concept, but "svndumpfilter" doesn't have options for adjusting paths - just including and excluding them - so I'd need to roll my own tool.


Any ideas?

Best regards,
Scott

--
Scott Lamb <http://www.slamb.org/>
_______________________________________________
Tailor mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/tailor

Reply via email to