mirror of
https://github.com/facebook/sapling.git
synced 2025-01-08 14:46:47 +03:00
7d8bebd9c1
# skip-blame because this was mechanically rewritten the following script. I ran it on both *.t and *.py, but none of the *.py changes were proper. All *.t ones appear to be, and they run without addition failures on both Windows and Linux. import argparse import os import re ap = argparse.ArgumentParser() ap.add_argument('path', nargs='+') opts = ap.parse_args() globre = re.compile(r'^(.*) \(glob\)(.*)$') for p in opts.path: tmp = p + '.tmp' with open(p, 'rb') as src, open(tmp, 'wb') as dst: for line in src: m = globre.match(line) if not m or '$LOCALIP' in line or '*' in line: dst.write(line) continue if '?' in line[:-3] or ('?' in line[:-3] and line[-3:] != '(?)'): dst.write(line) continue dst.write(m.group(1) + m.group(2) + '\n') os.unlink(p) os.rename(tmp, p)
38 lines
773 B
Perl
38 lines
773 B
Perl
#require serve
|
|
|
|
$ hg init server
|
|
$ cd server
|
|
$ cat >> .hg/hgrc << EOF
|
|
> [extensions]
|
|
> strip=
|
|
> EOF
|
|
|
|
$ echo 1 > foo
|
|
$ hg commit -A -m 'first'
|
|
adding foo
|
|
$ echo 2 > bar
|
|
$ hg commit -A -m 'second'
|
|
adding bar
|
|
|
|
Produce a bundle to use
|
|
|
|
$ hg strip -r 1
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
saved backup bundle to $TESTTMP/server/.hg/strip-backup/ed602e697e0f-cc9fff6a-backup.hg
|
|
|
|
Serve from a bundle file
|
|
|
|
$ hg serve -R .hg/strip-backup/ed602e697e0f-cc9fff6a-backup.hg -d -p $HGPORT --pid-file=hg.pid
|
|
$ cat hg.pid >> $DAEMON_PIDS
|
|
|
|
Ensure we're serving from the bundle
|
|
|
|
$ (get-with-headers.py localhost:$HGPORT 'file/tip/?style=raw')
|
|
200 Script output follows
|
|
|
|
|
|
-rw-r--r-- 2 bar
|
|
-rw-r--r-- 2 foo
|
|
|
|
|