https://pantsbuild.org/ logo
#general
Title
# general
e

enough-analyst-54434

06/13/2021, 12:56 AM
Nope. Like so: Create the repository:
Copy code
$ time pex . -r requirements.txt -c git-squash -o git-squash.pex

real	0m5.389s
user	0m4.663s
sys	0m0.524s
Use it:
Copy code
$ time pex git-squash==0.0.1 -r requirements.txt --pex-repository git-squash.pex -c git-squash -o git-squash.2.pex -c git-squash

real	0m0.339s
user	0m0.302s
sys	0m0.035s
You get the same pex in this case (a full resolve, not a subset):
Copy code
$ ./git-squash.2.pex -h
usage: git-squash.2.pex [-h] branch

positional arguments:
  branch      The upstream branch to squash commits of the current branch on to.

optional arguments:
  -h, --help  show this help message and exit
$ diff <(pex-tools git-squash.pex info -i4) <(pex-tools git-squash.2.pex info -i4)
$
But you could get a subset:
Copy code
$ time pex GitPython -o GitPython.pex

real	0m0.791s
user	0m0.652s
sys	0m0.093s
$ time pex GitPython -o GitPython.2.pex --pex-repository git-squash.pex 

real	0m0.317s
user	0m0.289s
sys	0m0.029s
$ diff <(pex-tools GitPython.pex info -i4) <(pex-tools GitPython.2.pex info -i4)
^jsirois@gill /tmp/git-squash (master *) $ ./GitPython.2.pex 
Python 3.9.5 (default, May 24 2021, 12:50:35) 
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from git import Repo
>>> repo = Repo()
>>> repo.rev_parse("HEAD")
<git.Commit "505cf06c598409db9d119a521480e43de3fa8908">
>>> 
now exiting InteractiveConsole...
🎉 1