issue2088: questions about subrepo implementation

David Wolever david at wolever.net
Tue May 11 09:17:32 CDT 2010


Hey,
I'd like to write a patch for issue2088 ("hg archive doesn't archive
subrepos"), and I'd just like to check that implementation will be  
roughly
correct.

Basically, I assume that the fix would involve changing this loop:

     for f in ctx:
         ff = ctx.flags(f)
         write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data)

To look more like this (modulo syntax):

     ctxs = [ ('', ctx) ]

     for path in ctx.substate: # is this the best way to enumerate  
subrepos?
         subrepo = ctx.sub(path)
         ctx = subrepo.current_ctx() # what's the correct way to do  
this?
         ctxs.push((subrepo.path, ctx))
         write_hg_archival_metadata(subrepo)

     for base_path, ctx in ctxs:
         for f in ctx:
             ff = ctx.flags(f)
             path = base_path + f
             write(path, 'x' in ff and 0755 or 0644, 'l' in ff,  
ctx[f].data)

So, am I on the right track?

And can someone fill me in on the API calls I don't know?

Thanks,
David



More information about the Mercurial-devel mailing list