Index: vcpx/target.py
===================================================================
--- vcpx/target.py	(revision 1544)
+++ vcpx/target.py	(revision 1654)
@@ -550,5 +550,6 @@
                             rmtree(absnew)
 
-                        rename(absnew + '-TAILOR-HACKED-TEMP-NAME', absnew)
+                        if exists(absnew + '-TAILOR-HACKED-TEMP-NAME'):
+                            rename(absnew + '-TAILOR-HACKED-TEMP-NAME', absnew)
 
     def _renamePathname(self, oldname, newname):
Index: vcpx/repository/git/target.py
===================================================================
--- vcpx/repository/git/target.py	(revision 1653)
+++ vcpx/repository/git/target.py	(revision 1654)
@@ -277,5 +277,16 @@
                         "Cannot rename since actual target not found: %s" % newnametmp)
 
-                self.repository.runCommand(['mv', oldname, newname])
+                if exists(oldpath):
+                    # Under normal operation, just git-mv the old name to the new
+                    # name.  Git will notice the changes too.
+                    self.repository.runCommand(['mv', oldname, newname])
+                else:
+                    # If a revision renames directory A/ to B/, plus file A/a to
+                    # B/b, *and if* A -> B happened already, then the superclass
+                    # already made B/b.  We cannot git-mv B/a to B/b since B/a is
+                    # gone.  The workaround is git-add B/b-TAILOR-HACKED-TEMP-NAME,
+                    # then git-mv it to B/b.
+                    self.repository.runCommand(['add', newnametmp])
+                    self.repository.runCommand(['mv', newnametmp, newname])
 
     def _prepareTargetRepository(self):
Index: vcpx/repository/p4/source.py
===================================================================
--- vcpx/repository/p4/source.py	(revision 1647)
+++ vcpx/repository/p4/source.py	(revision 1655)
@@ -106,10 +106,13 @@
 
                 log = p4.filelog(path+'#'+str(f['rev']), maxRevs=1)
-                note = log[0]['revs'][0]['notes'][0]
-                m = self.branchRE.match(note)
-                if m:
-                    old = m.group('path')
-                    branched[old] = e
-                    self.log.info('Branch %r to %r' % (old, name))
+
+                # rev['notes'] may be empty
+                notes = log[0]['revs'][0]['notes']
+                if len(notes) > 0:
+                    m = self.branchRE.match(notes[0])
+                    if m:
+                        old = m.group('path')
+                        branched[old] = e
+                        self.log.info('Branch %r to %r' % (old, name))
 
         for f in desc['files']:
