Implementing convert setrevmap (for p4.py)

Tom Widmer tom.widmer at googlemail.com
Mon Aug 3 07:01:09 CDT 2009


Frank A. Kingswood wrote:
> Hallo!
> 
> Tom pointed out that convert/p4.py does not implement setrevmap and 
> therefore is not easily used incrementally.
> The documentation is pretty light on this. How is it supposed to work?
> 
> I see setrevmap is called only once at the start of a conversion but it 
> gets used in filemap.py as well.

Looking at the code again, I was wrong - incremental support is handled 
generically for all source types. Just running a conversion twice should 
work to convert any new revisions that weren't converted last time 
(subject to the --rev constraint). If you use 'p4.startrev' to indicate 
the starting revision of the increment, that will break the incremental 
import, since it will mark startrev as not having any parents, whereas 
you really want the parent to be the last revision of the previous 
increment. Maybe that's what you were doing wrong - don't specify 
startrev for successive increments (or, you should specify the exact 
same startrev for _all_ increments of your import, to allow you to 
perform an incremental shallow conversion).

e.g. if you want your shallow conversion from rev A, you do:

Initial increment:
hg convert --p4.startrev=A source dest

Pick up new changes (successive increments):
hg convert --p4.startrev=A source dest

(exactly the same command with the same startrev, except that dest 
already contains previous increments)

Apologies if my earlier advice was wrong!

Tom



More information about the Mercurial mailing list