##// END OF EJS Templates
Merge with crew-stable
Patrick Mezard -
r9598:a981ddb1 merge default
parent child Browse files
Show More
@@ -115,7 +115,11 b' class logstream(object):'
115 115
116 116 def __iter__(self):
117 117 while True:
118 entry = pickle.load(self._stdout)
118 try:
119 entry = pickle.load(self._stdout)
120 except EOFError:
121 raise util.Abort(_('Mercurial failed to run itself, check'
122 ' hg executable is in PATH'))
119 123 try:
120 124 orig_paths, revnum, author, date, message = entry
121 125 except:
@@ -292,14 +292,23 b' class patchfile(object):'
292 292 self.hunks = 0
293 293
294 294 def readlines(self, fname):
295 if os.path.islink(fname):
296 return [os.readlink(fname)]
295 297 fp = self.opener(fname, 'r')
296 298 try:
297 299 return list(linereader(fp, self.eol is not None))
298 300 finally:
299 301 fp.close()
300 302
301 def writelines(self, fname, lines):
302 fp = self.opener(fname, 'w')
303 def writelines(self, fname, lines):
304 # Ensure supplied data ends in fname, being a regular file or
305 # a symlink. updatedir() will -too magically- take care of
306 # setting it to the proper type afterwards.
307 islink = os.path.islink(fname)
308 if islink:
309 fp = cStringIO.StringIO()
310 else:
311 fp = self.opener(fname, 'w')
303 312 try:
304 313 if self.eol and self.eol != '\n':
305 314 for l in lines:
@@ -308,6 +317,8 b' class patchfile(object):'
308 317 fp.write(l)
309 318 else:
310 319 fp.writelines(lines)
320 if islink:
321 self.opener.symlink(fp.getvalue(), fname)
311 322 finally:
312 323 fp.close()
313 324
@@ -399,7 +410,7 b' class patchfile(object):'
399 410 self.rej.append(h)
400 411 return -1
401 412
402 if isinstance(h, githunk):
413 if isinstance(h, binhunk):
403 414 if h.rmfile():
404 415 self.unlink(self.fname)
405 416 else:
@@ -665,12 +676,12 b' class hunk(object):'
665 676 def new(self, fuzz=0, toponly=False):
666 677 return self.fuzzit(self.b, fuzz, toponly)
667 678
668 class githunk(object):
669 """A git hunk"""
679 class binhunk:
680 'A binary patch file. Only understands literals so far.'
670 681 def __init__(self, gitpatch):
671 682 self.gitpatch = gitpatch
672 683 self.text = None
673 self.hunk = []
684 self.hunk = ['GIT binary patch\n']
674 685
675 686 def createfile(self):
676 687 return self.gitpatch.op in ('ADD', 'RENAME', 'COPY')
@@ -684,12 +695,6 b' class githunk(object):'
684 695 def new(self):
685 696 return [self.text]
686 697
687 class binhunk(githunk):
688 'A binary patch file. Only understands literals so far.'
689 def __init__(self, gitpatch):
690 super(binhunk, self).__init__(gitpatch)
691 self.hunk = ['GIT binary patch\n']
692
693 698 def extract(self, lr):
694 699 line = lr.readline()
695 700 self.hunk.append(line)
@@ -717,18 +722,6 b' class binhunk(githunk):'
717 722 len(text), size)
718 723 self.text = text
719 724
720 class symlinkhunk(githunk):
721 """A git symlink hunk"""
722 def __init__(self, gitpatch, hunk):
723 super(symlinkhunk, self).__init__(gitpatch)
724 self.hunk = hunk
725
726 def complete(self):
727 return True
728
729 def fix_newline(self):
730 return
731
732 725 def parsefilename(str):
733 726 # --- filename \t|space stuff
734 727 s = str[4:].rstrip('\r\n')
@@ -875,10 +868,6 b' def iterhunks(ui, fp, sourcefile=None, t'
875 868 create = afile == '/dev/null' or gpatch and gpatch.op == 'ADD'
876 869 remove = bfile == '/dev/null' or gpatch and gpatch.op == 'DELETE'
877 870 current_hunk = hunk(x, hunknum + 1, lr, context, create, remove)
878 if remove:
879 gpatch = changed.get(afile[2:])
880 if gpatch and gpatch.mode[0]:
881 current_hunk = symlinkhunk(gpatch, current_hunk)
882 871 except PatchError, err:
883 872 ui.debug(err)
884 873 current_hunk = None
@@ -28,3 +28,7 b" hg glog --template 'branch={branches} {r"
28 28 hg branches | sed 's/:.*/:/'
29 29 hg tags -q
30 30 cd ..
31
32 echo '% test hg failing to call itself'
33 HG=foobar hg convert svn-repo B-hg 2>&1 | grep -v foobar
34
@@ -48,3 +48,6 b' default 10:'
48 48 old 9:
49 49 old2 8:
50 50 tip
51 % test hg failing to call itself
52 initializing destination B-hg repository
53 abort: Mercurial failed to run itself, check hg executable is in PATH
@@ -1,12 +1,31 b''
1 1 a -> a not a symlink
2 % test replacing a file with a symlink
2 3 a -> b
3 4 popping symlink.patch
4 5 now at: base.patch
5 6 applying symlink.patch
6 7 now at: symlink.patch
7 8 a -> b
9 % test updating a symlink
10 a -> c
11 popping updatelink
12 now at: symlink.patch
13 applying updatelink
14 patching file a
15 a
16 now at: updatelink
17 a -> c
18 % test replacing a symlink with a file
19 popping replacelinkwithfile
20 now at: addlink
21 applying replacelinkwithfile
22 now at: replacelinkwithfile
23 sss
24 % test symlink removal
8 25 popping removesl.patch
9 now at: symlink.patch
26 now at: replacelinkwithfile
10 27 applying removesl.patch
11 28 now at: removesl.patch
12 29 C b
30 C c
31 C s
General Comments 0
You need to be logged in to leave comments. Login now