Mercurial > public > mercurial-scm > hg
comparison mercurial/patch.py @ 27485:60183975b5bc
patch: use absolute_import
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 21 Dec 2015 21:33:52 -0800 |
parents | 14b184263846 |
children | f7f3958d39c0 |
comparison
equal
deleted
inserted
replaced
27484:0d7635dca691 | 27485:60183975b5bc |
---|---|
4 # Copyright 2007 Chris Mason <chris.mason@oracle.com> | 4 # Copyright 2007 Chris Mason <chris.mason@oracle.com> |
5 # | 5 # |
6 # This software may be used and distributed according to the terms of the | 6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. | 7 # GNU General Public License version 2 or any later version. |
8 | 8 |
9 from __future__ import absolute_import | |
10 | |
11 import cStringIO | |
9 import collections | 12 import collections |
10 import cStringIO, email, os, errno, re, posixpath, copy | 13 import copy |
11 import tempfile, zlib, shutil | 14 import email |
12 | 15 import errno |
13 from i18n import _ | 16 import os |
14 from node import hex, short | 17 import posixpath |
15 import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error | 18 import re |
16 import pathutil | 19 import shutil |
20 import tempfile | |
21 import zlib | |
22 | |
23 from .i18n import _ | |
24 from .node import ( | |
25 hex, | |
26 short, | |
27 ) | |
28 from . import ( | |
29 base85, | |
30 copies, | |
31 diffhelpers, | |
32 encoding, | |
33 error, | |
34 mdiff, | |
35 pathutil, | |
36 scmutil, | |
37 util, | |
38 ) | |
17 | 39 |
18 gitre = re.compile('diff --git a/(.*) b/(.*)') | 40 gitre = re.compile('diff --git a/(.*) b/(.*)') |
19 tabsplitter = re.compile(r'(\t+|[^\t]+)') | 41 tabsplitter = re.compile(r'(\t+|[^\t]+)') |
20 | 42 |
21 class PatchError(Exception): | 43 class PatchError(Exception): |
1444 d | 1466 d |
1445 -lastline | 1467 -lastline |
1446 | 1468 |
1447 ''' | 1469 ''' |
1448 | 1470 |
1449 import crecord as crecordmod | 1471 from . import crecord as crecordmod |
1450 newhunks = [] | 1472 newhunks = [] |
1451 for c in hunks: | 1473 for c in hunks: |
1452 if isinstance(c, crecordmod.uihunk): | 1474 if isinstance(c, crecordmod.uihunk): |
1453 # curses hunks encapsulate the record hunk in _hunk | 1475 # curses hunks encapsulate the record hunk in _hunk |
1454 c = c._hunk | 1476 c = c._hunk |