Mercurial > hg
comparison mercurial/repair.py @ 20977:a57dcd11be34
repair: make paths in "_bundle()" relative to ".hg"
This patch makes paths below in "_bundle()" relative to ".hg":
- backup directory ("strip-backup"), and
- bundle file under backup directory
"vfs" is passed to "changegroup.writebundle()" to use relative path
directly.
This patch applies "vfs.join()" on the value returned by "_bundle()",
because the caller expect it to return absolute path.
This will be changed by succeeding patch changing the caller side.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sun, 09 Mar 2014 01:03:28 +0900 |
parents | 37cdf1fca1b2 |
children | ad5b61370514 |
comparison
equal
deleted
inserted
replaced
20976:c20f4898631e | 20977:a57dcd11be34 |
---|---|
13 import errno | 13 import errno |
14 | 14 |
15 def _bundle(repo, bases, heads, node, suffix, compress=True): | 15 def _bundle(repo, bases, heads, node, suffix, compress=True): |
16 """create a bundle with the specified revisions as a backup""" | 16 """create a bundle with the specified revisions as a backup""" |
17 cg = changegroup.changegroupsubset(repo, bases, heads, 'strip') | 17 cg = changegroup.changegroupsubset(repo, bases, heads, 'strip') |
18 backupdir = repo.join("strip-backup") | 18 backupdir = "strip-backup" |
19 if not os.path.isdir(backupdir): | 19 vfs = repo.vfs |
20 os.mkdir(backupdir) | 20 if not vfs.isdir(backupdir): |
21 name = os.path.join(backupdir, "%s-%s.hg" % (short(node), suffix)) | 21 vfs.mkdir(backupdir) |
22 name = "%s/%s-%s.hg" % (backupdir, short(node), suffix) | |
22 if compress: | 23 if compress: |
23 bundletype = "HG10BZ" | 24 bundletype = "HG10BZ" |
24 else: | 25 else: |
25 bundletype = "HG10UN" | 26 bundletype = "HG10UN" |
26 return changegroup.writebundle(cg, name, bundletype) | 27 return vfs.join(changegroup.writebundle(cg, name, bundletype, vfs)) |
27 | 28 |
28 def _collectfiles(repo, striprev): | 29 def _collectfiles(repo, striprev): |
29 """find out the filelogs affected by the strip""" | 30 """find out the filelogs affected by the strip""" |
30 files = set() | 31 files = set() |
31 | 32 |