[PATCH 5 of 6] patch: add mempatching support

Bill Barry after.fallout at gmail.com
Mon Apr 19 19:26:45 CDT 2010


Awesome!!!
/me looks forward to hg 1.6

Augie Fackler wrote:
> +    def readlines(self, fname):
> +        if fname not in self.parentctx:
> +            raise IOError(errno.ENOENT, 'Cannot find %r to patch' % fname)
> +        # TODO(durin42): refactor so we can skip StringIO here
> +        lr = linereader(cStringIO.StringIO(self.parentctx[fname].data()),
> +                        self.eolmode != 'strict')
> +        self.eol = lr.eol
> +        return list(lr)
What do you mean with this TODO (perhaps I am not understanding bits of 
the code here)? I am trying to understand what can be refactored so that 
the instantiation can be skipped (self.parentctx[fname].data() is a byte 
array isn't it?).
> +def memapplydiff(ui, fp, ctx, strip=1, eolmode='strict'):
> +    """Apply a diff in memory to ctx.
> +
> +    If the diff doesn't apply cleanly, this will raise a PatchError,
> +    since reject files can't be sanely written.
> +    """
>   
What affect would this have on some potential future integration with a 
wiggle type program?


More information about the Mercurial-devel mailing list