Commit Graph

10 Commits

Author SHA1 Message Date
Joel Brobecker
334fe1aaf4 check_fast_forward: Minor test rewrite to avoid string comparison
This commit modifies a conditional expression to avoid comparing
the output from a git command with the empty string. With Python 3.x,
this wouldn't work unless we decoded the output first or compared
against the empty *byte* string. But since all we're interested in
is knowing whether the output is empty or not, we can use a simple
"truth" test instead, thus avoiding having to worry about the type
of the output entirely.

TN: U530-006
Change-Id: I0067cb6bfb37da4e1782a045beac19d970d7718f
2021-06-05 19:07:41 -07:00
Joel Brobecker
a075b1653e reformat all the code using black
Change-Id: Idbc70777233ab2d40ab59765abb9cbbeeb88ec63
2021-04-18 14:59:01 +04:00
Joel Brobecker
3710a2ce70 fast_forward.py: Make except handler compatible with Python 3.x
This change makes this part of the code compatible with both Python 2.x
and Python 3.x.

Change-Id: I59cbff722c6ede73440aa7d4e24096a9ecf546ef
2020-11-23 14:37:46 +01:00
Joel Brobecker
d1a76a87a8 Change the hooks.non-fast-forward config to match the entire ref name
This lifts a limitation where non-fast-forward updates could only be
allowed for references whose name start with 'refs/heads/' (the
standard namespace for branches). As it happens, GCC is using branch
names in a different namespace. So this commit changes this config
option to match the entire reference name, rather than just the branch
name. There is a break in compatibility for the repositories already
using this configuration, but this change takes care of detecting
this situation and provide an informative message explaining the likely
situation.

Change-Id: I330d15ccef448e815c94a620f008275f1e1914db
TN: T209-002
2020-06-15 11:32:45 -07:00
Joel Brobecker
68a9b53ca5 fast_forward.py: Do not import * from git.
This prevents pyflakes from detecting undefined names.
This also makes it easier during code review to determine where
each symbol comes from.
2013-12-26 14:37:15 +04:00
Joel Brobecker
34185485ed fast_forward.py: fix style violations 2013-12-26 14:34:48 +04:00
Joel Brobecker
51f3cadf6e Convert hooks.allow-non-fast-forward to type tuple. 2012-12-29 19:46:11 +04:00
Joel Brobecker
7f9a9298e9 Create errors.py and move InvalidUpdate there.
The fact that utils.py imports config.py makes it difficult for
config.py to access the InvalidUpdate exception.  So move this
exception to its own package, free of dependencies.

Preparation work for LC27-007.
2012-12-28 13:43:27 +04:00
Joel Brobecker
54776335d7 Rename hooks.allowNonFastForwardOnBranches into hooks.allow-non-fast-forward
For LC27-006.
2012-12-27 15:07:27 +04:00
Joel Brobecker
6ac6d2674a Add initial branch-update support. Update the testsuite accordingly. 2012-05-20 12:19:19 +02:00