def _shelvecreatedcommit(repo, node, name): info = {'node': nodemod.hex(node)} shelvedfile(repo, name, 'shelve').writeinfo(info) bases = list(mutableancestors(repo[node])) shelvedfile(repo, name, 'hg').writebundle(bases, node) # Create a matcher so that prefetch doesn't attempt to fetch the entire # repository pointlessly. match = scmutil.matchfiles(repo, repo[node].files()) with shelvedfile(repo, name, patchextension).opener('wb') as fp: cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True), match=match)
def _shelvecreatedcommit(ui, repo, node, name, tr): shelvedfile(repo, name, 'oshelve').writeobsshelveinfo({ 'node': nodemod.hex(node) }) if util.safehasattr(cmdutil, 'exportfile'): # Mercurial 4.6 and later cmdutil.exportfile(repo.unfiltered(), [node], shelvedfile(repo, name, patchextension).opener('wb'), opts=mdiff.diffopts(git=True)) else: # Mercurial 4.5 and earlier cmdutil.export(repo.unfiltered(), [node], fp=shelvedfile(repo, name, patchextension).opener('wb'), opts=mdiff.diffopts(git=True))
def _getpatches(repo, revs, **opts): """return a list of patches for a list of revisions Each patch in the list is itself a list of lines. """ ui = repo.ui prev = repo[b'.'].rev() for r in revs: if r == prev and (repo[None].files() or repo[None].deleted()): ui.warn(_(b'warning: working directory has uncommitted changes\n')) output = stringio() cmdutil.exportfile(repo, [r], output, opts=patch.difffeatureopts(ui, opts, git=True)) yield output.getvalue().split(b'\n')
def _shelvecreatedcommit(repo, node, name): bases = list(mutableancestors(repo[node])) shelvedfile(repo, name, 'hg').writebundle(bases, node) with shelvedfile(repo, name, patchextension).opener('wb') as fp: cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True))