Dulwich.io dulwich / acf3f58
Merge tag 'upstream/0.19.5' into unstable Upstream version 0.19.5 Jelmer Vernooij 1 year, 4 months ago
21 changed file(s) with 198 addition(s) and 135 deletion(s). Raw diff Collapse all Expand all
+0
-7
.coveragerc less more
0 [run]
1 branch = True
2 source = dulwich
3
4 [report]
5 exclude_lines =
6 raise NotImplementedError
+0
-23
.gitignore less more
0 _trial_temp
1 build
2 build-pypy
3 MANIFEST
4 dist
5 apidocs
6 *,cover
7 .testrepository
8 *.pyc
9 *.pyd
10 *.pyo
11 *.so
12 *~
13 *.swp
14 *.swh
15 *.swn
16 *.swo
17 docs/tutorial/index.html
18 dulwich.egg-info/
19 .tox/
20 .idea/
21 .coverage
22 htmlcov/
+0
-23
.mailmap less more
0 Jelmer Vernooij <jelmer@jelmer.uk>
1 Jelmer Vernooij <jelmer@jelmer.uk> <jelmer@jelmer.uk>
2 Jelmer Vernooij <jelmer@jelmer.uk> <jelmer@samba.org>
3 Jelmer Vernooij <jelmer@jelmer.uk> <jelmer@debian.org>
4 Jelmer Vernooij <jelmer@jelmer.uk> <jelmer@canonical.com>
5 Jelmer Vernooij <jelmer@jelmer.uk> <jelmer@google.com>
6 Martin <gzlist@googlemail.com> <martin.packman@canonical.com>
7 Dave Borowitz <dborowitz@google.com> <ddborowitz@gmail.com>
8 Dave Borowitz <dborowitz@google.com> <dborowitz@google.com>
9 John Carr <john.carr@unrouted.co.uk>
10 Mark Mikofski <bwanamarko@yahoo.com> <mark.mikofski@sunpowercorp.com>
11 Mark Mikofski <bwanamarko@yahoo.com> <bwana.marko@yahoo.com>
12 David Carr <david@carrclan.us>
13 Jon Bain <jsbain@yahoo.com> <jsbain@yahoo.com>
14 James Westby <jw+debian@jameswestby.net> <jw+debian@jameswestby.net>
15 David Keijser <david.keijser@klarna.com> <keijser@gmail.com>
16 Benoît HERVIER <khertan@khertan.net> <khertan@khertan.net>
17 Ryan Faulkner <rfaulk@yahoo-inc.com> <rfaulkner@wikimedia.org>
18 David Bennett <davbennett@google.com> <david@dbinit.com>
19 Risto Kankkunen <risto.kankkunen@iki.fi> <risto.kankkunen@f-secure.com>
20 Augie Fackler <durin42@gmail.com> <raf@durin42.com>
21 Damien Tournoud <damien@commerceguys.com> <damien@platform.sh>
22 Marcin Kuźmiński <marcin@python-blog.com> <marcin@python-works.com>
0 0.19.5 2018-08-08
1
2 IMPROVEMENTS
3
4 * Add ``porcelain.describe``. (Sylvia van Os)
5
6 BUG FIXES
7
8 * Fix regression in ``dulwich.porcelain.clone`` that prevented cloning
9 of remote repositories. (Jelmer Vernooij, #639)
10
11 * Don't leave around empty parent directories for removed refs.
12 (Damien Tournoud, #640)
13
014 0.19.4 2018-06-24
115
216 IMPROVEMENTS
00 Metadata-Version: 2.1
11 Name: dulwich
2 Version: 0.19.4
2 Version: 0.19.5
33 Summary: [![Build Status](https://travis-ci.org/dulwich/dulwich.png?branch=master)](https://travis-ci.org/dulwich/dulwich)
44 [![Windows Build status](https://ci.appveyor.com/api/projects/status/mob7g4vnrfvvoweb?svg=true)](https://ci.appveyor.com/project/jelmer/dulwich/branch/master)
55
613613 print(name)
614614
615615
616 class cmd_describe(Command):
617
618 def run(self, args):
619 parser = optparse.OptionParser()
620 options, args = parser.parse_args(args)
621 print(porcelain.describe('.'))
622
623
616624 class cmd_help(Command):
617625
618626 def run(self, args):
643651 "clone": cmd_clone,
644652 "commit": cmd_commit,
645653 "commit-tree": cmd_commit_tree,
654 "describe": cmd_describe,
646655 "daemon": cmd_daemon,
647656 "diff": cmd_diff,
648657 "diff-tree": cmd_diff_tree,
+0
-21
build.cmd less more
0 @echo off
1 :: To build extensions for 64 bit Python 3, we need to configure environment
2 :: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
3 :: MS Windows SDK for Windows 7 and .NET Framework 4
4 ::
5 :: More details at:
6 :: https://github.com/cython/cython/wiki/CythonExtensionsOnWindows
7
8 IF "%DISTUTILS_USE_SDK%"=="1" (
9 ECHO Configuring environment to build with MSVC on a 64bit architecture
10 ECHO Using Windows SDK 7.1
11 "C:\Program Files\Microsoft SDKs\Windows\v7.1\Setup\WindowsSdkVer.exe" -q -version:v7.1
12 CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release
13 SET MSSdk=1
14 REM Need the following to allow tox to see the SDK compiler
15 SET TOX_TESTENV_PASSENV=DISTUTILS_USE_SDK MSSdk INCLUDE LIB
16 ) ELSE (
17 ECHO Using default MSVC build environment
18 )
19
20 CALL %*
+0
-15
devscripts/PREAMBLE.c less more
0 * Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
1 * General Public License as public by the Free Software Foundation; version 2.0
2 * or (at your option) any later version. You can redistribute it and/or
3 * modify it under the terms of either of these two licenses.
4 *
5 * Unless required by applicable law or agreed to in writing, software
6 * distributed under the License is distributed on an "AS IS" BASIS,
7 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 * See the License for the specific language governing permissions and
9 * limitations under the License.
10 *
11 * You should have received a copy of the licenses; if not, see
12 * <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
13 * and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
14 * License, Version 2.0.
+0
-16
devscripts/PREAMBLE.py less more
0 # Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
1 # General Public License as public by the Free Software Foundation; version 2.0
2 # or (at your option) any later version. You can redistribute it and/or
3 # modify it under the terms of either of these two licenses.
4 #
5 # Unless required by applicable law or agreed to in writing, software
6 # distributed under the License is distributed on an "AS IS" BASIS,
7 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8 # See the License for the specific language governing permissions and
9 # limitations under the License.
10 #
11 # You should have received a copy of the licenses; if not, see
12 # <http://www.gnu.org/licenses/> for a copy of the GNU General Public License
13 # and <http://www.apache.org/licenses/LICENSE-2.0> for a copy of the Apache
14 # License, Version 2.0.
15 #
+0
-3
devscripts/replace-preamble.sh less more
0 #!/usr/bin/zsh
1 perl -i -p0e "s{\Q$(cat PREAMBLE.py.old)\E}{$(cat devscripts/PREAMBLE.py)}g" dulwich/**/*.py bin/dul*
2 perl -i -p0e "s{\Q$(cat PREAMBLE.c.old)\E}{$(cat devscripts/PREAMBLE.c)}g" dulwich/*.c
+0
-2
docs/tutorial/.gitignore less more
0 *.html
1 myrepo
2121
2222 """Python implementation of the Git file formats and protocols."""
2323
24 __version__ = (0, 19, 4)
24 __version__ = (0, 19, 5)
+0
-3
dulwich/contrib/README.md less more
0 This directory contains code that some may find useful. Code here is not an official
1 part of Dulwich, and may no longer work. Unlike the rest of Dulwich, it is not regularly
2 tested.
2929 * commit
3030 * commit-tree
3131 * daemon
32 * describe
3233 * diff-tree
3334 * fetch
3435 * init
6061 contextmanager,
6162 )
6263 from io import BytesIO
64 import datetime
6365 import os
6466 import posixpath
6567 import stat
305307 if checkout and bare:
306308 raise ValueError("checkout and bare are incompatible")
307309
308 config = StackedConfig.default()
309 client, host_path = get_transport_and_path(source, config=config, **kwargs)
310
311310 if target is None:
312 target = host_path.split("/")[-1]
311 target = source.split("/")[-1]
313312
314313 if not os.path.exists(target):
315314 os.mkdir(target)
321320
322321 reflog_message = b'clone: from ' + source.encode('utf-8')
323322 try:
324 fetch_result = fetch(r, host_path, origin, message=reflog_message)
323 fetch_result = fetch(r, source, origin, message=reflog_message)
325324 target_config = r.get_config()
326325 if not isinstance(source, bytes):
327326 source = source.encode(DEFAULT_ENCODING)
12881287 """List all files in an index."""
12891288 with open_repo_closing(repo) as r:
12901289 return sorted(r.open_index())
1290
1291
1292 def describe(repo):
1293 """Describe the repository version.
1294
1295 :param projdir: git repository root
1296 :returns: a string description of the current git revision
1297
1298 Examples: "gabcdefh", "v0.1" or "v0.1-5-gabcdefh".
1299 """
1300 # Get the repository
1301 with open_repo_closing(repo) as r:
1302 # Get a list of all tags
1303 refs = r.get_refs()
1304 tags = {}
1305 for key, value in refs.items():
1306 key = key.decode()
1307 obj = r.get_object(value)
1308 if u'tags' not in key:
1309 continue
1310
1311 _, tag = key.rsplit(u'/', 1)
1312
1313 try:
1314 commit = obj.object
1315 except AttributeError:
1316 continue
1317 else:
1318 commit = r.get_object(commit[1])
1319 tags[tag] = [
1320 datetime.datetime(*time.gmtime(commit.commit_time)[:6]),
1321 commit.id.decode('ascii'),
1322 ]
1323
1324 sorted_tags = sorted(tags.items(),
1325 key=lambda tag: tag[1][0],
1326 reverse=True)
1327
1328 # If there are no tags, return the current commit
1329 if len(sorted_tags) == 0:
1330 return 'g{}'.format(r[r.head()].id.decode('ascii')[:7])
1331
1332 # We're now 0 commits from the top
1333 commit_count = 0
1334
1335 # Get the latest commit
1336 latest_commit = r[r.head()]
1337
1338 # Walk through all commits
1339 walker = r.get_walker()
1340 for entry in walker:
1341 # Check if tag
1342 commit_id = entry.commit.id.decode('ascii')
1343 for tag in sorted_tags:
1344 tag_name = tag[0]
1345 tag_commit = tag[1][1]
1346 if commit_id == tag_commit:
1347 if commit_count == 0:
1348 return tag_name
1349 else:
1350 return '{}-{}-g{}'.format(
1351 tag_name,
1352 commit_count,
1353 latest_commit.id.decode('ascii')[:7])
1354
1355 commit_count += 1
1356
1357 # Return plain commit if no parent tag can be found
1358 return 'g{}'.format(latest_commit.id.decode('ascii')[:7])
771771 orig_ref = self.get_packed_refs().get(name, ZERO_SHA)
772772 if orig_ref != old_ref:
773773 return False
774 # may only be packed
774
775 # remove the reference file itself
775776 try:
776777 os.remove(filename)
777778 except OSError as e:
778 if e.errno != errno.ENOENT:
779 if e.errno != errno.ENOENT: # may only be packed
779780 raise
781
780782 self._remove_packed_ref(name)
781783 self._log(name, old_ref, None, committer=committer,
782784 timestamp=timestamp, timezone=timezone, message=message)
783785 finally:
784786 # never write, we just wanted the lock
785787 f.abort()
788
789 # outside of the lock, clean-up any parent directory that might now
790 # be empty. this ensures that re-creating a reference of the same
791 # name of what was previously a directory works as expected
792 parent = name
793 while True:
794 try:
795 parent, _ = parent.rsplit(b'/', 1)
796 except ValueError:
797 break
798
799 parent_filename = self.refpath(parent)
800 try:
801 os.rmdir(parent_filename)
802 except OSError as e:
803 # this can be caused by the parent directory being
804 # removed by another process, being not empty, etc.
805 # in any case, this is non fatal because we already
806 # removed the reference, just ignore it
807 break
808
786809 return True
787810
788811
13741374 self.assertEqual(
13751375 [(obj.id, 'invalid name .git')],
13761376 [(sha, str(e)) for (sha, e) in porcelain.fsck(self.repo)])
1377
1378
1379 class DescribeTests(PorcelainTestCase):
1380
1381 def test_no_commits(self):
1382 self.assertRaises(KeyError, porcelain.describe, self.repo.path)
1383
1384 def test_single_commit(self):
1385 fullpath = os.path.join(self.repo.path, 'foo')
1386 with open(fullpath, 'w') as f:
1387 f.write("BAR")
1388 porcelain.add(repo=self.repo.path, paths=[fullpath])
1389 sha = porcelain.commit(
1390 self.repo.path, message=b"Some message",
1391 author=b"Joe <joe@example.com>",
1392 committer=b"Bob <bob@example.com>")
1393 self.assertEqual(
1394 'g{}'.format(sha[:7].decode('ascii')),
1395 porcelain.describe(self.repo.path))
1396
1397 def test_tag(self):
1398 fullpath = os.path.join(self.repo.path, 'foo')
1399 with open(fullpath, 'w') as f:
1400 f.write("BAR")
1401 porcelain.add(repo=self.repo.path, paths=[fullpath])
1402 porcelain.commit(
1403 self.repo.path, message=b"Some message",
1404 author=b"Joe <joe@example.com>",
1405 committer=b"Bob <bob@example.com>")
1406 porcelain.tag_create(self.repo.path, b"tryme", b'foo <foo@bar.com>',
1407 b'bar', annotated=True)
1408 self.assertEqual(
1409 "tryme",
1410 porcelain.describe(self.repo.path))
1411
1412 def test_tag_and_commit(self):
1413 fullpath = os.path.join(self.repo.path, 'foo')
1414 with open(fullpath, 'w') as f:
1415 f.write("BAR")
1416 porcelain.add(repo=self.repo.path, paths=[fullpath])
1417 porcelain.commit(
1418 self.repo.path, message=b"Some message",
1419 author=b"Joe <joe@example.com>",
1420 committer=b"Bob <bob@example.com>")
1421 porcelain.tag_create(self.repo.path, b"tryme", b'foo <foo@bar.com>',
1422 b'bar', annotated=True)
1423 with open(fullpath, 'w') as f:
1424 f.write("BAR2")
1425 porcelain.add(repo=self.repo.path, paths=[fullpath])
1426 sha = porcelain.commit(
1427 self.repo.path, message=b"Some message",
1428 author=b"Joe <joe@example.com>",
1429 committer=b"Bob <bob@example.com>")
1430 self.assertEqual(
1431 'tryme-1-g{}'.format(sha[:7].decode('ascii')),
1432 porcelain.describe(self.repo.path))
461461 b'df6800012397fb85c56e7418dd4eb9405dee075c'))
462462 self.assertRaises(KeyError, lambda: self._refs[b'refs/tags/refs-0.1'])
463463
464 def test_remove_parent(self):
465 self._refs[b'refs/heads/foo/bar'] = (
466 b'df6800012397fb85c56e7418dd4eb9405dee075c'
467 )
468 del self._refs[b'refs/heads/foo/bar']
469 ref_file = os.path.join(
470 self._refs.path, b'refs', b'heads', b'foo', b'bar',
471 )
472 self.assertFalse(os.path.exists(ref_file))
473 ref_file = os.path.join(self._refs.path, b'refs', b'heads', b'foo')
474 self.assertFalse(os.path.exists(ref_file))
475 ref_file = os.path.join(self._refs.path, b'refs', b'heads')
476 self.assertTrue(os.path.exists(ref_file))
477 self._refs[b'refs/heads/foo'] = (
478 b'df6800012397fb85c56e7418dd4eb9405dee075c'
479 )
480
464481 def test_read_ref(self):
465482 self.assertEqual(b'ref: refs/heads/master',
466483 self._refs.read_ref(b'HEAD'))
00 Metadata-Version: 2.1
11 Name: dulwich
2 Version: 0.19.4
2 Version: 0.19.5
33 Summary: [![Build Status](https://travis-ci.org/dulwich/dulwich.png?branch=master)](https://travis-ci.org/dulwich/dulwich)
44 [![Windows Build status](https://ci.appveyor.com/api/projects/status/mob7g4vnrfvvoweb?svg=true)](https://ci.appveyor.com/project/jelmer/dulwich/branch/master)
55
0 .coveragerc
1 .gitignore
2 .mailmap
30 .testr.conf
41 .travis.yml
52 AUTHORS
129 README.swift.md
1310 TODO
1411 appveyor.yml
15 build.cmd
1612 dulwich.cfg
17 requirements.txt
1813 setup.cfg
1914 setup.py
2015 tox.ini
2116 bin/dul-receive-pack
2217 bin/dul-upload-pack
2318 bin/dulwich
24 devscripts/PREAMBLE.c
25 devscripts/PREAMBLE.py
26 devscripts/replace-preamble.sh
2719 docs/Makefile
2820 docs/conf.py
2921 docs/index.txt
3022 docs/make.bat
3123 docs/performance.txt
3224 docs/protocol.txt
33 docs/tutorial/.gitignore
3425 docs/tutorial/Makefile
3526 docs/tutorial/conclusion.txt
3627 docs/tutorial/encoding.txt
8071 dulwich.egg-info/dependency_links.txt
8172 dulwich.egg-info/requires.txt
8273 dulwich.egg-info/top_level.txt
83 dulwich/contrib/README.md
8474 dulwich/contrib/__init__.py
8575 dulwich/contrib/paramiko_vendor.py
8676 dulwich/contrib/release_robot.py
+0
-1
requirements.txt less more
0 urllib3[secure]==1.22
1313 import os
1414 import sys
1515
16 dulwich_version_string = '0.19.4'
16 dulwich_version_string = '0.19.5'
1717
1818 include_dirs = []
1919 # Windows MSVC support