a bug in "hg convert" with subversion sources?

Giorgos Keramidas keramida at ceid.upatras.gr
Thu Feb 11 15:21:27 CST 2010


On Thu, 11 Feb 2010 01:09:50 +0200, Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
> The convert extension gets confused and thinks the file was entirely
> removed!
>

> : 74 Tell the compiler these structures are aligned to a byte boundary.
> : source: svn:ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f/head at 203613
> : bin/pax/Makefile
> : bin/pax/cpio.h
> : bin/pax/tar.h
>
> This revision should have _patched_ bin/pax/Makefile instead of removing it.

This is because I accidentally modified the file as 'root' and then run
convert as 'keramida' locally.  The localrepo.memctx() code tries to
write the file and gets a permission denied error, but error=False when
convert calls it from putcommit().

This results in something like this being printed in self.ui.debug() output:

: OSError or IOError for bin/pax/Makefile: [Errno 13] Permission denied: '/hg/bsd/head/.hg/store/data/bin/pax/_makefile.i'
: marking bin/pax/Makefile as deleted
: ...
: keramida at kobe:/hg/bsd$ ls -ld /hg/bsd/head/.hg/store/data/bin/pax/_makefile.i
: -rw-r--r--  1 root  users  - 927  7 Φεβ 17:39 /hg/bsd/head/.hg/store/data/bin/pax/_makefile.i

The following patch fixes the conversion for me.  What happened was that
I ran 'hg convert' as 'root' in the past, but forgot to chown the entire
.hg/ subdirectory to 'keramida'.  Now that the specific file was touched
by an svn commit the error=False code marked it as 'deleted' rather than
aborting the netire convert commit.

--- crew patch begins here ---
# HG changeset patch
# User Giorgos Keramidas <keramida at ceid.upatras.gr>
# Date 1265922942 -7200
# Node ID 2db58f2d91a58b278cd926111089766c8e84460a
# Parent  50fb1fe143ff14ef4de63c6bd31523bfc7499470
convert: abort on errors during hg.sink.memctx() operation

When there is an error during a commit to a mercurial sink,
e.g. because permissions inhibit the commit from being safely
stored in the destination repository, abort the commit rather
than marking the files as 'deleted'.

diff -r 50fb1fe143ff -r 2db58f2d91a5 hgext/convert/hg.py
--- a/hgext/convert/hg.py	Wed Feb 10 20:08:18 2010 +0100
+++ b/hgext/convert/hg.py	Thu Feb 11 23:15:42 2010 +0200
@@ -165,7 +165,7 @@
             p2 = parents.pop(0)
             ctx = context.memctx(self.repo, (p1, p2), text, files.keys(),
                                  getfilectx, commit.author, commit.date, extra)
-            self.repo.commitctx(ctx)
+            self.repo.commitctx(ctx, error=True)
             text = "(octopus merge fixup)\n"
             p2 = hex(self.repo.changelog.tip())
 
--- crew patch ends here ---

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100211/f935320f/attachment.pgp>


More information about the Mercurial-devel mailing list