Show More
@@ -441,7 +441,10 b' class baseunionstore(object):' | |||||
441 | i = 0 |
|
441 | i = 0 | |
442 | while i < self.numattempts: |
|
442 | while i < self.numattempts: | |
443 | if i > 0: |
|
443 | if i > 0: | |
444 | retrylog(b're-attempting (n=%d) %s\n' % (i, funcname)) |
|
444 | retrylog( | |
|
445 | b're-attempting (n=%d) %s\n' | |||
|
446 | % (i, pycompat.sysbytes(funcname)) | |||
|
447 | ) | |||
445 | self.markforrefresh() |
|
448 | self.markforrefresh() | |
446 | i += 1 |
|
449 | i += 1 | |
447 | try: |
|
450 | try: |
@@ -1191,7 +1191,11 b' class ServiceInfo(object):' | |||||
1191 | list.append(b'='.join((key, suffix))) |
|
1191 | list.append(b'='.join((key, suffix))) | |
1192 | for item in list: |
|
1192 | for item in list: | |
1193 | result = b''.join( |
|
1193 | result = b''.join( | |
1194 | (result, struct.pack(b'!c', chr(len(item))), item) |
|
1194 | ( | |
|
1195 | result, | |||
|
1196 | struct.pack(b'!c', pycompat.bytechr(len(item))), | |||
|
1197 | item, | |||
|
1198 | ) | |||
1195 | ) |
|
1199 | ) | |
1196 | self.text = result |
|
1200 | self.text = result | |
1197 | else: |
|
1201 | else: |
@@ -5,10 +5,10 b' import os' | |||||
5 |
|
5 | |||
6 | ffi = cffi.FFI() |
|
6 | ffi = cffi.FFI() | |
7 | with open( |
|
7 | with open( | |
8 |
os.path.join(os.path.join(os.path.dirname(__file__), |
|
8 | os.path.join(os.path.join(os.path.dirname(__file__), '..'), 'bdiff.c') | |
9 | ) as f: |
|
9 | ) as f: | |
10 | ffi.set_source( |
|
10 | ffi.set_source( | |
11 |
|
|
11 | "mercurial.cffi._bdiff", f.read(), include_dirs=['mercurial'] | |
12 | ) |
|
12 | ) | |
13 | ffi.cdef( |
|
13 | ffi.cdef( | |
14 | """ |
|
14 | """ |
@@ -5,11 +5,11 b' import os' | |||||
5 |
|
5 | |||
6 | ffi = cffi.FFI() |
|
6 | ffi = cffi.FFI() | |
7 | mpatch_c = os.path.join( |
|
7 | mpatch_c = os.path.join( | |
8 |
os.path.join(os.path.dirname(__file__), |
|
8 | os.path.join(os.path.dirname(__file__), '..', 'mpatch.c') | |
9 | ) |
|
9 | ) | |
10 | with open(mpatch_c) as f: |
|
10 | with open(mpatch_c) as f: | |
11 | ffi.set_source( |
|
11 | ffi.set_source( | |
12 |
|
|
12 | "mercurial.cffi._mpatch", f.read(), include_dirs=["mercurial"] | |
13 | ) |
|
13 | ) | |
14 | ffi.cdef( |
|
14 | ffi.cdef( | |
15 | """ |
|
15 | """ |
@@ -4,7 +4,7 b' import cffi' | |||||
4 |
|
4 | |||
5 | ffi = cffi.FFI() |
|
5 | ffi = cffi.FFI() | |
6 | ffi.set_source( |
|
6 | ffi.set_source( | |
7 |
|
|
7 | "mercurial.cffi._osutil", | |
8 | """ |
|
8 | """ | |
9 | #include <sys/attr.h> |
|
9 | #include <sys/attr.h> | |
10 | #include <sys/vnode.h> |
|
10 | #include <sys/vnode.h> | |
@@ -22,7 +22,7 b' typedef struct val_attrs {' | |||||
22 | off_t datalength; |
|
22 | off_t datalength; | |
23 | } __attribute__((aligned(4), packed)) val_attrs_t; |
|
23 | } __attribute__((aligned(4), packed)) val_attrs_t; | |
24 | """, |
|
24 | """, | |
25 |
include_dirs=[ |
|
25 | include_dirs=['mercurial'], | |
26 | ) |
|
26 | ) | |
27 | ffi.cdef( |
|
27 | ffi.cdef( | |
28 | ''' |
|
28 | ''' |
@@ -1568,7 +1568,7 b' class localrepository(object):' | |||||
1568 | else: |
|
1568 | else: | |
1569 | raise error.ProgrammingError( |
|
1569 | raise error.ProgrammingError( | |
1570 | b"unsupported changeid '%s' of type %s" |
|
1570 | b"unsupported changeid '%s' of type %s" | |
1571 |
% (changeid, pycompat. |
|
1571 | % (changeid, pycompat.bytestr(type(changeid))) | |
1572 | ) |
|
1572 | ) | |
1573 |
|
1573 | |||
1574 | return context.changectx(self, rev, node) |
|
1574 | return context.changectx(self, rev, node) | |
@@ -2086,11 +2086,10 b' class localrepository(object):' | |||||
2086 | tracktags(tr2) |
|
2086 | tracktags(tr2) | |
2087 | repo = reporef() |
|
2087 | repo = reporef() | |
2088 |
|
2088 | |||
2089 | r = repo.ui.configsuboptions( |
|
2089 | singleheadopt = (b'experimental', b'single-head-per-branch') | |
2090 | b'experimental', b'single-head-per-branch' |
|
2090 | singlehead = repo.ui.configbool(*singleheadopt) | |
2091 | ) |
|
|||
2092 | singlehead, singleheadsub = r |
|
|||
2093 | if singlehead: |
|
2091 | if singlehead: | |
|
2092 | singleheadsub = repo.ui.configsuboptions(*singleheadopt)[1] | |||
2094 | accountclosed = singleheadsub.get( |
|
2093 | accountclosed = singleheadsub.get( | |
2095 | b"account-closed-heads", False |
|
2094 | b"account-closed-heads", False | |
2096 | ) |
|
2095 | ) |
@@ -543,7 +543,7 b' class predicatematcher(basematcher):' | |||||
543 |
|
543 | |||
544 |
|
544 | |||
545 | class patternmatcher(basematcher): |
|
545 | class patternmatcher(basematcher): | |
546 | """Matches a set of (kind, pat, source) against a 'root' directory. |
|
546 | r"""Matches a set of (kind, pat, source) against a 'root' directory. | |
547 |
|
547 | |||
548 | >>> kindpats = [ |
|
548 | >>> kindpats = [ | |
549 | ... (b're', br'.*\.c$', b''), |
|
549 | ... (b're', br'.*\.c$', b''), | |
@@ -1152,7 +1152,7 b' class unionmatcher(basematcher):' | |||||
1152 |
|
1152 | |||
1153 |
|
1153 | |||
1154 | def patkind(pattern, default=None): |
|
1154 | def patkind(pattern, default=None): | |
1155 | '''If pattern is 'kind:pat' with a known kind, return kind. |
|
1155 | r'''If pattern is 'kind:pat' with a known kind, return kind. | |
1156 |
|
1156 | |||
1157 | >>> patkind(br're:.*\.c$') |
|
1157 | >>> patkind(br're:.*\.c$') | |
1158 | 're' |
|
1158 | 're' |
@@ -2290,7 +2290,7 b' def _applydiff(' | |||||
2290 | try: |
|
2290 | try: | |
2291 | current_file = patcher(ui, gp, backend, store, eolmode=eolmode) |
|
2291 | current_file = patcher(ui, gp, backend, store, eolmode=eolmode) | |
2292 | except PatchError as inst: |
|
2292 | except PatchError as inst: | |
2293 | ui.warn(str(inst) + b'\n') |
|
2293 | ui.warn(stringutil.forcebytestr(inst) + b'\n') | |
2294 | current_file = None |
|
2294 | current_file = None | |
2295 | rejects += 1 |
|
2295 | rejects += 1 | |
2296 | continue |
|
2296 | continue |
@@ -67,10 +67,10 b' def b85decode(text):' | |||||
67 | acc = acc * 85 + _b85dec[c] |
|
67 | acc = acc * 85 + _b85dec[c] | |
68 | except KeyError: |
|
68 | except KeyError: | |
69 | raise ValueError( |
|
69 | raise ValueError( | |
70 |
|
|
70 | 'bad base85 character at position %d' % (i + j) | |
71 | ) |
|
71 | ) | |
72 | if acc > 4294967295: |
|
72 | if acc > 4294967295: | |
73 |
raise ValueError( |
|
73 | raise ValueError('Base85 overflow in hunk starting at byte %d' % i) | |
74 | out.append(acc) |
|
74 | out.append(acc) | |
75 |
|
75 | |||
76 | # Pad final chunk if necessary |
|
76 | # Pad final chunk if necessary |
@@ -146,7 +146,7 b' class shelvedfile(object):' | |||||
146 | def bundlerepo(self): |
|
146 | def bundlerepo(self): | |
147 | path = self.vfs.join(self.fname) |
|
147 | path = self.vfs.join(self.fname) | |
148 | return bundlerepo.instance( |
|
148 | return bundlerepo.instance( | |
149 | self.repo.baseui, b'bundle://%s+%s' % (self.repo.root, path) |
|
149 | self.repo.baseui, b'bundle://%s+%s' % (self.repo.root, path), False | |
150 | ) |
|
150 | ) | |
151 |
|
151 | |||
152 | def writebundle(self, bases, node): |
|
152 | def writebundle(self, bases, node): | |
@@ -603,8 +603,8 b' def deletecmd(ui, repo, pats):' | |||||
603 | if not pats: |
|
603 | if not pats: | |
604 | raise error.Abort(_(b'no shelved changes specified!')) |
|
604 | raise error.Abort(_(b'no shelved changes specified!')) | |
605 | with repo.wlock(): |
|
605 | with repo.wlock(): | |
606 | try: |
|
606 | for name in pats: | |
607 |
|
|
607 | try: | |
608 | for suffix in shelvefileextensions: |
|
608 | for suffix in shelvefileextensions: | |
609 | shfile = shelvedfile(repo, name, suffix) |
|
609 | shfile = shelvedfile(repo, name, suffix) | |
610 | # patch file is necessary, as it should |
|
610 | # patch file is necessary, as it should | |
@@ -614,11 +614,11 b' def deletecmd(ui, repo, pats):' | |||||
614 | # bundle |
|
614 | # bundle | |
615 | if shfile.exists() or suffix == patchextension: |
|
615 | if shfile.exists() or suffix == patchextension: | |
616 | shfile.movetobackup() |
|
616 | shfile.movetobackup() | |
|
617 | except OSError as err: | |||
|
618 | if err.errno != errno.ENOENT: | |||
|
619 | raise | |||
|
620 | raise error.Abort(_(b"shelved change '%s' not found") % name) | |||
617 | cleanupoldbackups(repo) |
|
621 | cleanupoldbackups(repo) | |
618 | except OSError as err: |
|
|||
619 | if err.errno != errno.ENOENT: |
|
|||
620 | raise |
|
|||
621 | raise error.Abort(_(b"shelved change '%s' not found") % name) |
|
|||
622 |
|
622 | |||
623 |
|
623 | |||
624 | def listshelves(repo): |
|
624 | def listshelves(repo): |
@@ -1906,7 +1906,7 b' def copyfile(src, dest, hardlink=False, ' | |||||
1906 | ) & 0x7FFFFFFF |
|
1906 | ) & 0x7FFFFFFF | |
1907 | os.utime(dest, (advanced, advanced)) |
|
1907 | os.utime(dest, (advanced, advanced)) | |
1908 | except shutil.Error as inst: |
|
1908 | except shutil.Error as inst: | |
1909 | raise error.Abort(str(inst)) |
|
1909 | raise error.Abort(stringutil.forcebytestr(inst)) | |
1910 |
|
1910 | |||
1911 |
|
1911 | |||
1912 | def copyfiles(src, dst, hardlink=None, progress=None): |
|
1912 | def copyfiles(src, dst, hardlink=None, progress=None): |
@@ -259,3 +259,35 b' Test that closing heads can be explicitl' | |||||
259 | abort: rejecting multiple heads on branch "branch_A" |
|
259 | abort: rejecting multiple heads on branch "branch_A" | |
260 | (3 heads: 49003e504178 5254bcccab93 42b9fe70a3c1) |
|
260 | (3 heads: 49003e504178 5254bcccab93 42b9fe70a3c1) | |
261 | [255] |
|
261 | [255] | |
|
262 | ||||
|
263 | ||||
|
264 | Test that config can be overriden as the boolean it is | |||
|
265 | ------------------------------------------------------ | |||
|
266 | ||||
|
267 | $ cat <<EOF >> $TESTTMP/single-head-server/.hg/hgrc | |||
|
268 | > [experimental] | |||
|
269 | > single-head-per-branch = no | |||
|
270 | > EOF | |||
|
271 | ||||
|
272 | Because of previous test, we'll also push c_aL0 and c_aM0. | |||
|
273 | ||||
|
274 | $ hg out -T "{desc}\n" | |||
|
275 | comparing with $TESTTMP/single-head-server | |||
|
276 | searching for changes | |||
|
277 | c_aL0 | |||
|
278 | c_aM0 | |||
|
279 | ||||
|
280 | Let's make a new head and push everythin. The server feedback will mention | |||
|
281 | exactly one new head because c_aM0 is closed. | |||
|
282 | ||||
|
283 | $ hg up 'desc("c_aG0")' | |||
|
284 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
285 | $ mkcommit c_aN0 | |||
|
286 | created new head | |||
|
287 | $ hg push -f | |||
|
288 | pushing to $TESTTMP/single-head-server | |||
|
289 | searching for changes | |||
|
290 | adding changesets | |||
|
291 | adding manifests | |||
|
292 | adding file changes | |||
|
293 | added 3 changesets with 3 changes to 3 files (+1 heads) |
General Comments 0
You need to be logged in to leave comments.
Login now