Ticket #163 (new defect)

Opened 5 years ago

Last modified 5 years ago

Failed Git target nested renames [PATCH]

Reported by: jhs Owned by: lele
Priority: major Milestone: VersionOne
Component: git Version: 0.9
Keywords: git rename disjunct Cc: jhs@…

Description

The Git target (and possibly the SynchronizableTargetWorkingDir? class do not handle renaming correctly when a single commit both renames a directory, and also renames a file within that directory. For example:

$ mkdir bzrproj
$ cd bzrproj
$ bzr init
$ mkdir Original-Dir
$ touch Original-Dir/Original-File
$ bzr add
$ bzr ci -m 'Original layout'
$ bzr mv Original-Dir New-Dir
$ bzr mv New-Dir/Original-File New-Dir/New-File
$ bzr ci -m 'New layout'
$ cd ..
$ cat > tailor.conf <<EOF
[project]
source = bzr:proj
target = git:proj
start-revision = INITIAL
state-file = tailor.state

[bzr:proj]
repository = bzrproj
subdir = bzr-source

[git:proj]
subdir = git-target
EOF

$ tailor --configfile tailor.conf
18:29:58 [C] Couldn't replay changeset:
Revision: jhs@proven-corporation.com-20080627111847-zib8z61z29w3m3ek
Date: 2008-06-27 18:18:47.900000+07:00
Author: Jason Smith <jhs@proven-corporation.com>
Entries: New-Dir[DIR](REN from Original-Dir), New-Dir/New-File(REN from New-Dir/Original-File)
Log: New layout
18:29:58 [C] Upstream change application failed: /tmp/j/git-target $ git mv New-Dir/Original-File New-Dir/New-File failed
18:29:58 [C] Something unexpected!
Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/vcpx/tailor.py", line 156, in __call__
    self.update()
  File "build/bdist.linux-i686/egg/vcpx/tailor.py", line 120, in update
    applyable=self._applyable, applied=self._applied)
  File "build/bdist.linux-i686/egg/vcpx/dualwd.py", line 102, in applyPendingChangesets
    applied=applied)
  File "build/bdist.linux-i686/egg/vcpx/source.py", line 136, in applyPendingChangesets
    replay(c)
  File "build/bdist.linux-i686/egg/vcpx/dualwd.py", line 113, in replayChangeset
    self.target.replayChangeset(changeset)
  File "build/bdist.linux-i686/egg/vcpx/target.py", line 134, in replayChangeset
    self._replayChangeset(changeset)
  File "build/bdist.linux-i686/egg/vcpx/target.py", line 336, in _replayChangeset
    action(group)
  File "build/bdist.linux-i686/egg/vcpx/target.py", line 502, in _renameEntries
    self._renamePathname(e.old_name, e.name)
  File "build/bdist.linux-i686/egg/vcpx/repository/git/target.py", line 279, in _renamePathname
    self.repository.runCommand(['mv', oldname, newname])
  File "build/bdist.linux-i686/egg/vcpx/repository/git/__init__.py", line 77, in runCommand
Exception: /tmp/j/git-target $ git mv New-Dir/Original-File New-Dir/New-File failed

I have attached a couple of patches (both require my patches from #162 and #161) which fixes the problem for me.

Attachments

002-tailor_git_target_disjunct_rename_exceptions.patch Download (1.3 KB) - added by jhs 5 years ago.
Just make the exceptions easier to understand
003-tailor_git_target_disjunct_nested_renames.patch Download (2.0 KB) - added by jhs 5 years ago.
Correct the nested renames for git target

Change History

Changed 5 years ago by jhs

Just make the exceptions easier to understand

Changed 5 years ago by jhs

Correct the nested renames for git target

comment:1 Changed 5 years ago by lele

Applied respectively as [1653] and [1654]. I wish I could test them...

Note: See TracTickets for help on using tickets.