Contents conflict from fast-import when files were renamed

Eli Zaretskii eliz at gnu.org
Sat Mar 26 10:33:36 UTC 2011


I have a shared bzr repository where I track a remote git repo (of the
idutils package) using fast-import.  In that bzr repo I have 2
branches: `trunk' into which I import with "bzr fast-import", and
`mytrunk', where I have some local changes (e.g., additional files not
present in `trunk').

Today, I updated `trunk' with "bzr fast-import", which went
flawlessly, and then said "cd mytrunk; bzr merge ../trunk".  This
produced 2 conflicts:

  +N  doc/idutils.texi.OTHER
  +N  lisp/idutils.el.OTHER
  ...
  Contents conflict in doc/idutils.texi
  Contents conflict in lisp/idutils.el
  2 conflicts encountered.

These conflicts are already strange, since the diffs between these
files are in a single Copyright line (2011 was added to copyright
years in the upstream).  I tried to resolve them anyway, but that
failed:

  bzr resolve --action=take-other doc/idutils.texi
  bzr: ERROR: Tree transform is malformed [('duplicate', 'new-2', 'new-48', u'idutils.texi')]

(Btw, the docs says to submit a bug report about this kind of failure;
should I, given what's below?)

"bzr mv", which should be identical according to docs, also failed:

  bzr mv doc/idutils.texi.OTHER doc/idutils.texi
  bzr: ERROR: Could not move idutils.texi.OTHER => idutils.texi: doc/idutils.texi is already versioned.

The reason for this is probably the fact that in the upstream these
two files were originally called doc/id-utils.texi and
doc/id-utils.el.  They were renamed to idutils.* in the git repo, but
because git doesn't track renames, in the fast-import'ed `trunk'
branch it looks like the original files were deleted and then added
under the new names:

  bzr st -c 177
  removed:
    doc/id-utils.texi
    lisp/id-utils.el
  added:
    doc/idutils.texi
    lisp/idutils.el

So in the `mytrunk' branch I manually restored their history in
revision 431, like this:

  bzr revert -r176 doc/id-utils.texi
  bzr rm doc/idutils.texi
  bzr mv doc/id-utils.texi doc/idutils.texi
  bzr commit

and similarly for lisp/idutils.el, as shown by "bzr status":

  bzr st -c 431
  removed:
    doc/idutils.texi
    lisp/idutils.el
  added:
    doc/idutils.texi
    lisp/idutils.el

So in `mytrunk' I have now this history:

  bzr st -r 176.. doc/idutils.texi lisp/idutils.el
  renamed:
    doc/id-utils.texi => doc/idutils.texi
    lisp/id-utils.el => lisp/idutils.el

I guess this made these files have different IDs, thus the conflicts.

My question is: how can I resolve this kind of conflict, without
losing the full history of these two renamed files?  Also, shouldn't
the fast-import plugin provide a way of generating bzr renames while
importing from git repositories in such cases, in the first place?



More information about the bazaar mailing list