1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 17:27:31 +00:00

Merge pull request #3441 from ThomasWaldmann/backports

Backports to 1.1
This commit is contained in:
TW 2017-12-15 01:59:10 +01:00 committed by GitHub
commit 4ac6ee221a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 22 additions and 4 deletions

View file

@ -42,6 +42,9 @@ The (short) hostname of the machine.
.B {fqdn}
The full name of the machine.
.TP
.B {reverse-fqdn}
The full name of the machine in reverse domain name notation.
.TP
.B {now}
The current local date and time, by default in ISO\-8601 format.
You can also supply your own \fI\%format string\fP, e.g. {now:%Y\-%m\-%d_%H:%M:%S}

View file

@ -169,6 +169,9 @@ placeholders:
{fqdn}
The full name of the machine.
{reverse-fqdn}
The full name of the machine in reverse domain name notation.
{now}
The current local date and time, by default in ISO-8601 format.
You can also supply your own `format string <https://docs.python.org/3.4/library/datetime.html#strftime-and-strptime-behavior>`_, e.g. {now:%Y-%m-%d_%H:%M:%S}

View file

@ -651,6 +651,8 @@ def write_examples(self, write, command):
examples = examples.replace(usage_include, '')
examples = examples.replace('Examples\n~~~~~~~~', '')
examples = examples.replace('Miscellaneous Help\n------------------', '')
examples = examples.replace('``docs/misc/prune-example.txt``:', '``docs/misc/prune-example.txt``.')
examples = examples.replace('.. highlight:: none\n', '') # we don't support highlight
examples = re.sub('^(~+)$', lambda matches: '+' * len(matches.group(0)), examples, flags=re.MULTILINE)
examples = examples.strip()
if examples:

View file

@ -63,7 +63,7 @@ static uint32_t table_base[] =
0xc5ae37bb, 0xa76ce12a, 0x8150d8f3, 0x2ec29218, 0xa35f0984, 0x48c0647e, 0x0b5ff98c, 0x71893f7b
};
#define BARREL_SHIFT(v, shift) ( ((v) << shift) | ((v) >> ((32 - shift) & 0x1f)) )
#define BARREL_SHIFT(v, shift) ( ((v) << (shift)) | ((v) >> ((32 - (shift)) & 0x1f)) )
size_t pagemask;

View file

@ -71,7 +71,7 @@ static int hash_sizes[] = {
#define EMPTY _htole32(0xffffffff)
#define DELETED _htole32(0xfffffffe)
#define BUCKET_ADDR(index, idx) (index->buckets + (idx * index->bucket_size))
#define BUCKET_ADDR(index, idx) (index->buckets + ((idx) * index->bucket_size))
#define BUCKET_MATCHES_KEY(index, idx, key) (memcmp(key, BUCKET_ADDR(index, idx), index->key_size) == 0)

View file

@ -2093,6 +2093,9 @@ def do_break_lock(self, args, repository):
{fqdn}
The full name of the machine.
{reverse-fqdn}
The full name of the machine in reverse domain name notation.
{now}
The current local date and time, by default in ISO-8601 format.
You can also supply your own `format string <https://docs.python.org/3.4/library/datetime.html#strftime-and-strptime-behavior>`_, e.g. {now:%Y-%m-%d_%H:%M:%S}
@ -2202,7 +2205,12 @@ def do_help(self, parser, commands, args):
else:
commands[args.topic].print_help()
else:
parser.error('No help available on %s' % (args.topic,))
msg_lines = []
msg_lines += ['No help available on %s.' % args.topic]
msg_lines += ['Try one of the following:']
msg_lines += [' Commands: %s' % ', '.join(sorted(commands.keys()))]
msg_lines += [' Topics: %s' % ', '.join(sorted(self.helptext.keys()))]
parser.error('\n'.join(msg_lines))
return self.exit_code
def do_subcommand_help(self, parser, args):

View file

@ -661,9 +661,11 @@ def format_line(format, data):
def replace_placeholders(text):
"""Replace placeholders in text with their values."""
current_time = datetime.now()
fqdn = socket.getfqdn()
data = {
'pid': os.getpid(),
'fqdn': socket.getfqdn(),
'fqdn': fqdn,
'reverse-fqdn': '.'.join(reversed(fqdn.split('.'))),
'hostname': socket.gethostname(),
'now': DatetimeWrapper(current_time.now()),
'utcnow': DatetimeWrapper(current_time.utcnow()),