# HG changeset patch # User Martin Geisler # Date 1336390858 -7200 # Node ID 4878914b02ab06c798a02f9d4e899a800e270589 # Parent 7f76c97361e002ff500998ff051fd2c94b469685# Parent 46e9ed223d2c8d1fc1b1b64c7f2dab795f5d690d merge with stable diff -r 46e9ed223d2c -r 4878914b02ab contrib/check-code.py --- a/contrib/check-code.py Sun May 06 23:58:04 2012 +0900 +++ b/contrib/check-code.py Mon May 07 13:40:58 2012 +0200 @@ -199,6 +199,7 @@ "always assign an opened file to a variable, and close it afterwards"), (r'(?i)descendent', "the proper spelling is descendAnt"), (r'\.debug\(\_', "don't mark debug messages for translation"), + (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"), ], # warnings [ diff -r 46e9ed223d2c -r 4878914b02ab hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py Sun May 06 23:58:04 2012 +0900 +++ b/hgext/largefiles/overrides.py Mon May 07 13:40:58 2012 +0200 @@ -781,6 +781,47 @@ archiver.done() +def hgsubrepoarchive(orig, repo, ui, archiver, prefix): + rev = repo._state[1] + ctx = repo._repo[rev] + + lfcommands.cachelfiles(ui, repo._repo, ctx.node()) + + def write(name, mode, islink, getdata): + if lfutil.isstandin(name): + return + data = getdata() + + archiver.addfile(prefix + repo._path + '/' + name, mode, islink, data) + + for f in ctx: + ff = ctx.flags(f) + getdata = ctx[f].data + if lfutil.isstandin(f): + path = lfutil.findfile(repo._repo, getdata().strip()) + if path is None: + raise util.Abort( + _('largefile %s not found in repo store or system cache') + % lfutil.splitstandin(f)) + f = lfutil.splitstandin(f) + + def getdatafn(): + fd = None + try: + fd = open(os.path.join(prefix, path), 'rb') + return fd.read() + finally: + if fd: + fd.close() + + getdata = getdatafn + + write(f, 'x' in ff and 0755 or 0644, 'l' in ff, getdata) + + for subpath in ctx.substate: + sub = ctx.sub(subpath) + sub.archive(repo.ui, archiver, prefix) + # If a largefile is modified, the change is not reflected in its # standin until a commit. cmdutil.bailifchanged() raises an exception # if the repo has uncommitted changes. Wrap it to also check if diff -r 46e9ed223d2c -r 4878914b02ab hgext/largefiles/uisetup.py --- a/hgext/largefiles/uisetup.py Sun May 06 23:58:04 2012 +0900 +++ b/hgext/largefiles/uisetup.py Mon May 07 13:40:58 2012 +0200 @@ -100,6 +100,7 @@ extensions.wrapfunction(hg, 'merge', overrides.hgmerge) extensions.wrapfunction(archival, 'archive', overrides.overridearchive) + extensions.wrapfunction(hgsubrepo, 'archive', overrides.hgsubrepoarchive) extensions.wrapfunction(cmdutil, 'bailifchanged', overrides.overridebailifchanged) diff -r 46e9ed223d2c -r 4878914b02ab hgext/rebase.py --- a/hgext/rebase.py Sun May 06 23:58:04 2012 +0900 +++ b/hgext/rebase.py Mon May 07 13:40:58 2012 +0200 @@ -182,7 +182,7 @@ branch = repo[None].branch() dest = repo[branch] else: - dest = repo[destf] + dest = scmutil.revsingle(repo, destf) if revf: rebaseset = repo.revs('%lr', revf) @@ -201,7 +201,7 @@ root = None if not rebaseset: - repo.ui.debug('base is ancestor of destination') + repo.ui.debug('base is ancestor of destination\n') result = None elif not keepf and list(repo.revs('first(children(%ld) - %ld)', rebaseset, rebaseset)): @@ -618,7 +618,7 @@ if commonbase == dest: samebranch = root.branch() == dest.branch() if samebranch and root in dest.children(): - repo.ui.debug('source is a child of destination') + repo.ui.debug('source is a child of destination\n') return None # rebase on ancestor, force detach detach = True diff -r 46e9ed223d2c -r 4878914b02ab mercurial/cmdutil.py --- a/mercurial/cmdutil.py Sun May 06 23:58:04 2012 +0900 +++ b/mercurial/cmdutil.py Mon May 07 13:40:58 2012 +0200 @@ -1481,7 +1481,7 @@ def badfn(path, msg): if path in names: return - if path in repo[node].substate: + if path in ctx.substate: return path_ = path + '/' for f in names: @@ -1489,14 +1489,14 @@ return ui.warn("%s: %s\n" % (m.rel(path), msg)) - m = scmutil.match(repo[node], pats, opts) + m = scmutil.match(ctx, pats, opts) m.bad = badfn - for abs in repo[node].walk(m): + for abs in ctx.walk(m): if abs not in names: names[abs] = m.rel(abs), m.exact(abs) # get the list of subrepos that must be reverted - targetsubs = [s for s in repo[node].substate if m(s)] + targetsubs = [s for s in ctx.substate if m(s)] m = scmutil.matchfiles(repo, names) changes = repo.status(match=m)[:4] modified, added, removed, deleted = map(set, changes) diff -r 46e9ed223d2c -r 4878914b02ab mercurial/patch.py --- a/mercurial/patch.py Sun May 06 23:58:04 2012 +0900 +++ b/mercurial/patch.py Mon May 07 13:40:58 2012 +0200 @@ -1040,12 +1040,13 @@ hunk.append(l) return l.rstrip('\r\n') - line = getline(lr, self.hunk) - while line and not line.startswith('literal '): + while True: line = getline(lr, self.hunk) - if not line: - raise PatchError(_('could not extract "%s" binary data') - % self._fname) + if not line: + raise PatchError(_('could not extract "%s" binary data') + % self._fname) + if line.startswith('literal '): + break size = int(line[8:].rstrip()) dec = [] line = getline(lr, self.hunk) diff -r 46e9ed223d2c -r 4878914b02ab mercurial/phases.py --- a/mercurial/phases.py Sun May 06 23:58:04 2012 +0900 +++ b/mercurial/phases.py Mon May 07 13:40:58 2012 +0200 @@ -113,7 +113,7 @@ f = repo.sopener('phaseroots') try: for line in f: - phase, nh = line.strip().split() + phase, nh = line.split() roots[int(phase)].add(bin(nh)) finally: f.close() diff -r 46e9ed223d2c -r 4878914b02ab mercurial/tags.py --- a/mercurial/tags.py Sun May 06 23:58:04 2012 +0900 +++ b/mercurial/tags.py Mon May 07 13:40:58 2012 +0200 @@ -181,7 +181,7 @@ for line in cachelines: if line == "\n": break - line = line.rstrip().split() + line = line.split() cacherevs.append(int(line[0])) headnode = bin(line[1]) cacheheads.append(headnode) diff -r 46e9ed223d2c -r 4878914b02ab tests/test-largefiles.t --- a/tests/test-largefiles.t Sun May 06 23:58:04 2012 +0900 +++ b/tests/test-largefiles.t Mon May 07 13:40:58 2012 +0200 @@ -1111,4 +1111,37 @@ abort: uncommitted changes in subrepo subrepo (use --subrepos for recursive commit) [255] + +Add a normal file to the subrepo, then test archiving + + $ echo 'normal file' > subrepo/normal.txt + $ hg -R subrepo add subrepo/normal.txt + +Lock in subrepo, otherwise the change isn't archived + + $ hg ci -S -m "add normal file to top level" + committing subrepository subrepo + Invoking status precommit hook + M large.txt + A normal.txt + Invoking status precommit hook + M .hgsubstate + $ hg archive -S lf_subrepo_archive + $ find lf_subrepo_archive | sort + lf_subrepo_archive + lf_subrepo_archive/.hg_archival.txt + lf_subrepo_archive/.hgsub + lf_subrepo_archive/.hgsubstate + lf_subrepo_archive/a + lf_subrepo_archive/a/b + lf_subrepo_archive/a/b/c + lf_subrepo_archive/a/b/c/d + lf_subrepo_archive/a/b/c/d/e.large.txt + lf_subrepo_archive/a/b/c/d/e.normal.txt + lf_subrepo_archive/a/b/c/x + lf_subrepo_archive/a/b/c/x/y.normal.txt + lf_subrepo_archive/subrepo + lf_subrepo_archive/subrepo/large.txt + lf_subrepo_archive/subrepo/normal.txt + $ cd .. diff -r 46e9ed223d2c -r 4878914b02ab tests/test-rebase-parameters.t --- a/tests/test-rebase-parameters.t Sun May 06 23:58:04 2012 +0900 +++ b/tests/test-rebase-parameters.t Mon May 07 13:40:58 2012 +0200 @@ -158,12 +158,12 @@ $ cd .. -Rebase with dest == `hg branch` => same as no arguments (from 3 onto 8): +Rebase with dest == branch(.) => same as no arguments (from 3 onto 8): $ hg clone -q -u 3 a a3 $ cd a3 - $ hg rebase --dest `hg branch` + $ hg rebase --dest 'branch(.)' saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob) $ hg tglog