Changeset 4e1d17772b9e…
Parent b5749d971187…
by Andrew Pritchard <andrewp@fogcreek.com>
Changes to 4 files · Browse files at 4e1d17772b9e Showing diff from parent b5749d971187 Diff from another changeset...
@@ -138,12 +138,7 @@ mc = ctx.manifest()
mp1 = ctx.parents()[0].manifest()
mp2 = ctx.parents()[1].manifest()
- for f in mp1:
- if f not in mc:
- files.add(f)
- for f in mp2:
- if f not in mc:
- files.add(f)
+ files |= (set(mp1) | set(mp2)) - set(mc)
for f in mc:
if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None):
files.add(f)
@@ -219,12 +214,7 @@ mc = ctx.manifest()
mp1 = ctx.parents()[0].manifest()
mp2 = ctx.parents()[1].manifest()
- for f in mp1:
- if f not in mc:
- files.add(f)
- for f in mp2:
- if f not in mc:
- files.add(f)
+ files |= (set(mp1) | set(mp2)) - set(mc)
for f in mc:
if mc[f] != mp1.get(f, None) or mc[f] != mp2.get(f, None):
files.add(f)
@@ -296,8 +286,7 @@ renamed = lfutil.standin(renamed[0])
return context.memfilectx(f, lfiletohash[srcfname], 'l' in
- fctx.flags(),
- 'x' in fctx.flags(), renamed)
+ fctx.flags(), 'x' in fctx.flags(), renamed)
else:
try:
fctx = ctx.filectx(f)
|
@@ -144,6 +144,8 @@ return None
class largefiles_dirstate(dirstate.dirstate):
+ def __getitem__(self, key):
+ return super(largefiles_dirstate, self).__getitem__(unixpath(key))
def normal(self, f):
return super(largefiles_dirstate, self).normal(unixpath(f))
def remove(self, f):
@@ -152,6 +154,8 @@ return super(largefiles_dirstate, self).add(unixpath(f))
def drop(self, f):
return super(largefiles_dirstate, self).drop(unixpath(f))
+ def forget(self, f):
+ return super(largefiles_dirstate, self).forget(unixpath(f))
def openlfdirstate(ui, repo):
'''
@@ -195,7 +199,7 @@ raise
else:
if curhash == hash:
- lfdirstate.normal(unixpath(bigfile))
+ lfdirstate.normal(bigfile)
else:
lfdirstate.normallookup(bigfile)
@@ -215,7 +219,7 @@ modified.append(lfile)
else:
clean.append(lfile)
- lfdirstate.normal(unixpath(lfile))
+ lfdirstate.normal(lfile)
lfdirstate.write()
finally:
wlock.release()
|
|
@@ -33,23 +33,16 @@ # matcher which matches only the normal files and running the original
# version of add.
def override_add(orig, ui, repo, *pats, **opts):
- lf = opts.pop('large', None)
+ large = opts.pop('large', None)
lfsize = opts.pop('lfsize', None)
+ if not lfsize and lfutil.islfilesrepo(repo):
+ lfsize = ui.config(lfutil.longname, 'size', default='10')
if lfsize:
try:
lfsize = int(lfsize)
except ValueError:
- raise util.Abort(_('size must be an integer, was %s\n') % lfsize)
- else:
- if os.path.exists(repo.wjoin(lfutil.shortname)):
- lfsize = ui.config(lfutil.longname, 'size', default='10')
- if lfsize:
- try:
- lfsize = int(lfsize)
- except ValueError:
- raise util.Abort(_('largefiles.size must be integer, was %s\n')
- % lfsize)
+ raise util.Abort(_('largefiles: size must be an integer, was %s\n') % lfsize)
lfmatcher = None
if os.path.exists(repo.wjoin(lfutil.shortname)):
@@ -80,7 +73,7 @@ if exact and nfile:
continue
if exact or (not lfile and not nfile):
- if lf or (lfsize and os.path.getsize(repo.wjoin(f)) >= \
+ if large or (lfsize and os.path.getsize(repo.wjoin(f)) >= \
lfsize * 1024 * 1024) or (lfmatcher and lfmatcher(f)):
lfnames.append(f)
if ui.verbose or not exact:
@@ -100,10 +93,10 @@ lfutil.writestandin(repo, standinname, hash='',
executable=lfutil.getexecutable(repo.wjoin(f)))
standins.append(standinname)
- if lfdirstate[lfutil.unixpath(f)] == 'r':
- lfdirstate.normallookup(lfutil.unixpath(f))
+ if lfdirstate[f] == 'r':
+ lfdirstate.normallookup(f)
else:
- lfdirstate.add(lfutil.unixpath(f))
+ lfdirstate.add(f)
lfdirstate.write()
bad += [lfutil.splitstandin(f) for f in lfutil.repo_add(repo,
standins) if f in m.files()]
@@ -219,7 +212,7 @@ while currentdir and not os.listdir(repo.wjoin(currentdir)):
os.rmdir(repo.wjoin(currentdir))
currentdir = os.path.split(currentdir)[0]
- lfdirstate.remove(lfutil.unixpath(f))
+ lfdirstate.remove(f)
lfdirstate.write()
forget = [lfutil.standin(f) for f in forget]
@@ -244,12 +237,12 @@ repo.lfstatus = False
def override_verify(orig, ui, repo, *pats, **opts):
- lf = opts.pop('large', False)
+ large = opts.pop('large', False)
all = opts.pop('lfa', False)
contents = opts.pop('lfc', False)
result = orig(ui, repo, *pats, **opts)
- if lf:
+ if large:
result = result or lfcommands.verifylfiles(ui, repo, all, contents)
return result
@@ -275,7 +268,7 @@ lfutil.hashfile(repo.wjoin(lfile)):
mod = True
else:
- lfdirstate.normal(lfutil.unixpath(lfile))
+ lfdirstate.normal(lfile)
lfdirstate.write()
if mod:
raise util.Abort(_('uncommitted local changes'))
@@ -479,12 +472,12 @@ os.makedirs(destlfiledir)
if rename:
os.rename(srclfile, destlfile)
- lfdirstate.remove(lfutil.unixpath(os.path.relpath(srclfile,
- repo.root)))
+ lfdirstate.remove(os.path.relpath(srclfile,
+ repo.root))
else:
util.copyfile(srclfile, destlfile)
- lfdirstate.add(lfutil.unixpath(os.path.relpath(destlfile,
- repo.root)))
+ lfdirstate.add(os.path.relpath(destlfile,
+ repo.root))
lfdirstate.write()
except util.Abort, e:
if str(e) != 'no files to copy':
@@ -848,10 +841,10 @@ try:
lfdirstate = lfutil.openlfdirstate(ui, repo)
for f in forget:
- if lfdirstate[lfutil.unixpath(f)] == 'a':
- lfdirstate.drop(lfutil.unixpath(f))
+ if lfdirstate[f] == 'a':
+ lfdirstate.drop(f)
else:
- lfdirstate.remove(lfutil.unixpath(f))
+ lfdirstate.remove(f)
lfdirstate.write()
lfutil.repo_remove(repo, [lfutil.standin(f) for f in forget],
unlink=True)
|
@@ -160,7 +160,7 @@ modified.append(lfile)
else:
clean.append(lfile)
- lfdirstate.normal(lfutil.unixpath(lfile))
+ lfdirstate.normal(lfile)
lfdirstate.write()
else:
tocheck = unsure + modified + added + clean
@@ -261,17 +261,16 @@ if os.path.exists(self.wjoin(lfile)):
lfutil.updatestandin(self,
lfutil.standin(lfile))
- lfdirstate.normal(lfutil.unixpath(lfile))
+ lfdirstate.normal(lfile)
for lfile in lfdirstate:
if not os.path.exists(
repo.wjoin(lfutil.standin(lfile))):
- path = lfutil.unixpath(lfile)
try:
# Mercurial >= 1.9
- lfdirstate.drop(path)
+ lfdirstate.drop(lfile)
except AttributeError:
# Mercurial <= 1.8
- lfdirstate.forget(path)
+ lfdirstate.forget(lfile)
lfdirstate.write()
return orig(text=text, user=user, date=date, match=match,
@@ -303,15 +302,14 @@ lfile = lfutil.splitstandin(standin)
if lfdirstate[lfile] <> 'r':
lfutil.updatestandin(self, standin)
- lfdirstate.normal(lfutil.unixpath(lfile))
+ lfdirstate.normal(lfile)
else:
- path = lfutil.unixpath(lfile)
try:
# Mercurial >= 1.9
- lfdirstate.drop(path)
+ lfdirstate.drop(lfile)
except AttributeError:
# Mercurial <= 1.8
- lfdirstate.forget(path)
+ lfdirstate.forget(lfile)
lfdirstate.write()
# Cook up a new matcher that only matches regular files or
|
Loading...