82 lfutil.standin(path), fileid, filelog |
82 lfutil.standin(path), fileid, filelog |
83 ) |
83 ) |
84 else: |
84 else: |
85 result = orig(lfutil.standin(path), fileid) |
85 result = orig(lfutil.standin(path), fileid) |
86 olddata = result.data |
86 olddata = result.data |
87 result.data = lambda: olddata() + '\0' |
87 result.data = lambda: olddata() + b'\0' |
88 return result |
88 return result |
89 |
89 |
90 ctx.__class__ = lfilesctx |
90 ctx.__class__ = lfilesctx |
91 return ctx |
91 return ctx |
92 |
92 |
123 # some calls in this function rely on the old version of status |
123 # some calls in this function rely on the old version of status |
124 self.lfstatus = False |
124 self.lfstatus = False |
125 ctx1 = self[node1] |
125 ctx1 = self[node1] |
126 ctx2 = self[node2] |
126 ctx2 = self[node2] |
127 working = ctx2.rev() is None |
127 working = ctx2.rev() is None |
128 parentworking = working and ctx1 == self['.'] |
128 parentworking = working and ctx1 == self[b'.'] |
129 |
129 |
130 if match is None: |
130 if match is None: |
131 match = matchmod.always() |
131 match = matchmod.always() |
132 |
132 |
133 wlock = None |
133 wlock = None |
234 if ( |
234 if ( |
235 lfutil.readasstandin(ctx1[standin]) |
235 lfutil.readasstandin(ctx1[standin]) |
236 != lfutil.hashfile(abslfile) |
236 != lfutil.hashfile(abslfile) |
237 ) or ( |
237 ) or ( |
238 checkexec |
238 checkexec |
239 and ('x' in ctx1.flags(standin)) |
239 and (b'x' in ctx1.flags(standin)) |
240 != bool(lfutil.getexecutable(abslfile)) |
240 != bool(lfutil.getexecutable(abslfile)) |
241 ): |
241 ): |
242 modified.append(lfile) |
242 modified.append(lfile) |
243 elif listclean: |
243 elif listclean: |
244 clean.append(lfile) |
244 clean.append(lfile) |
363 def push(self, remote, force=False, revs=None, newbranch=False): |
363 def push(self, remote, force=False, revs=None, newbranch=False): |
364 if remote.local(): |
364 if remote.local(): |
365 missing = set(self.requirements) - remote.local().supported |
365 missing = set(self.requirements) - remote.local().supported |
366 if missing: |
366 if missing: |
367 msg = _( |
367 msg = _( |
368 "required features are not" |
368 b"required features are not" |
369 " supported in the destination:" |
369 b" supported in the destination:" |
370 " %s" |
370 b" %s" |
371 ) % (', '.join(sorted(missing))) |
371 ) % (b', '.join(sorted(missing))) |
372 raise error.Abort(msg) |
372 raise error.Abort(msg) |
373 return super(lfilesrepo, self).push( |
373 return super(lfilesrepo, self).push( |
374 remote, force=force, revs=revs, newbranch=newbranch |
374 remote, force=force, revs=revs, newbranch=newbranch |
375 ) |
375 ) |
376 |
376 |
391 actualfiles = [] |
391 actualfiles = [] |
392 dirs = [] |
392 dirs = [] |
393 regulars = [] |
393 regulars = [] |
394 |
394 |
395 for f in files: |
395 for f in files: |
396 if lfutil.isstandin(f + '/'): |
396 if lfutil.isstandin(f + b'/'): |
397 raise error.Abort( |
397 raise error.Abort( |
398 _('file "%s" is a largefile standin') % f, |
398 _(b'file "%s" is a largefile standin') % f, |
399 hint='commit the largefile itself instead', |
399 hint=b'commit the largefile itself instead', |
400 ) |
400 ) |
401 # Scan directories |
401 # Scan directories |
402 if self.wvfs.isdir(f): |
402 if self.wvfs.isdir(f): |
403 dirs.append(f) |
403 dirs.append(f) |
404 else: |
404 else: |
405 regulars.append(f) |
405 regulars.append(f) |
406 |
406 |
407 for f in dirs: |
407 for f in dirs: |
408 matcheddir = False |
408 matcheddir = False |
409 d = self.dirstate.normalize(f) + '/' |
409 d = self.dirstate.normalize(f) + b'/' |
410 # Check for matched normal files |
410 # Check for matched normal files |
411 for mf in regulars: |
411 for mf in regulars: |
412 if self.dirstate.normalize(mf).startswith(d): |
412 if self.dirstate.normalize(mf).startswith(d): |
413 actualfiles.append(f) |
413 actualfiles.append(f) |
414 matcheddir = True |
414 matcheddir = True |
423 # There may still be normal files in the dir, so |
423 # There may still be normal files in the dir, so |
424 # add a directory to the list, which |
424 # add a directory to the list, which |
425 # forces status/dirstate to walk all files and |
425 # forces status/dirstate to walk all files and |
426 # call the match function on the matcher, even |
426 # call the match function on the matcher, even |
427 # on case sensitive filesystems. |
427 # on case sensitive filesystems. |
428 actualfiles.append('.') |
428 actualfiles.append(b'.') |
429 matcheddir = True |
429 matcheddir = True |
430 # Nothing in dir, so readd it |
430 # Nothing in dir, so readd it |
431 # and let commit reject it |
431 # and let commit reject it |
432 if not matcheddir: |
432 if not matcheddir: |
433 actualfiles.append(f) |
433 actualfiles.append(f) |
456 toupload = set() |
456 toupload = set() |
457 addfunc = lambda fn, lfhash: toupload.add(lfhash) |
457 addfunc = lambda fn, lfhash: toupload.add(lfhash) |
458 lfutil.getlfilestoupload(pushop.repo, lfrevs, addfunc) |
458 lfutil.getlfilestoupload(pushop.repo, lfrevs, addfunc) |
459 lfcommands.uploadlfiles(ui, pushop.repo, pushop.remote, toupload) |
459 lfcommands.uploadlfiles(ui, pushop.repo, pushop.remote, toupload) |
460 |
460 |
461 repo.prepushoutgoinghooks.add("largefiles", prepushoutgoinghook) |
461 repo.prepushoutgoinghooks.add(b"largefiles", prepushoutgoinghook) |
462 |
462 |
463 def checkrequireslfiles(ui, repo, **kwargs): |
463 def checkrequireslfiles(ui, repo, **kwargs): |
464 if 'largefiles' not in repo.requirements and any( |
464 if b'largefiles' not in repo.requirements and any( |
465 lfutil.shortname + '/' in f[0] for f in repo.store.datafiles() |
465 lfutil.shortname + b'/' in f[0] for f in repo.store.datafiles() |
466 ): |
466 ): |
467 repo.requirements.add('largefiles') |
467 repo.requirements.add(b'largefiles') |
468 repo._writerequirements() |
468 repo._writerequirements() |
469 |
469 |
470 ui.setconfig( |
470 ui.setconfig( |
471 'hooks', 'changegroup.lfiles', checkrequireslfiles, 'largefiles' |
471 b'hooks', b'changegroup.lfiles', checkrequireslfiles, b'largefiles' |
472 ) |
472 ) |
473 ui.setconfig('hooks', 'commit.lfiles', checkrequireslfiles, 'largefiles') |
473 ui.setconfig(b'hooks', b'commit.lfiles', checkrequireslfiles, b'largefiles') |