Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install -e git+https... will overwrite existing dirty working copies #5411

Open
altendky opened this issue May 15, 2018 · 13 comments
Open
Labels
C: vcs pip's interaction with version control systems like git, svn and bzr state: awaiting PR Feature discussed, PR is needed type: bug A confirmed bug or unintended behavior

Comments

@altendky
Copy link

  • Pip version: 10.0.1
  • Python version: 3.6.5
  • Operating system: Debian 9.4 / stretch

Description:

I often have editable installs where the clone is done by pip. It seems that the point of editable installs from a VCS would be to edit them so they should be protected from being carelessly overwritten. Instead, pip overwrites dirty working copies. I would expect to need to --force or such to make this happen.

What I've run:

https://gist.github.com/altendky/9a8cc1c7bec9f44911a2d904c09eb8b1

altendky@lt:~/t$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.4 (stretch)
Release:        9.4
Codename:       stretch
altendky@lt:~/t$ ll -a
total 8
drwxr-xr-x  2 altendky altendky 4096 May 15 13:29 .
drwxr-xr-x 93 altendky altendky 4096 May 15 08:26 ..
altendky@lt:~/t$ python3 -m venv venv
altendky@lt:~/t$ venv/bin/python --version
Python 3.6.5
altendky@lt:~/t$ venv/bin/python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-10.0.1
altendky@lt:~/t$ export PIP_SRC=$PWD/src
altendky@lt:~/t$ venv/bin/pip install -e git+https://github.com/altendky/gitignoreio#egg=gitignoreio
Obtaining gitignoreio from git+https://github.com/altendky/gitignoreio#egg=gitignoreio
  Cloning https://github.com/altendky/gitignoreio to ./src/gitignoreio
Collecting click (from gitignoreio)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Collecting requests (from gitignoreio)
  Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl
Installing collected packages: click, urllib3, certifi, chardet, idna, requests, gitignoreio
  Running setup.py develop for gitignoreio
Successfully installed certifi-2018.4.16 chardet-3.0.4 click-6.7 gitignoreio idna-2.6 requests-2.18.4 urllib3-1.22
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
altendky@lt:~/t$ echo '#blah' >> src/gitignoreio/setup.py
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   setup.py

no changes added to commit (use "git add" and/or "git commit -a")
altendky@lt:~/t$ venv/bin/pip install -e git+https://github.com/altendky/gitignoreio#egg=gitignoreio
Obtaining gitignoreio from git+https://github.com/altendky/gitignoreio#egg=gitignoreio
  Updating ./src/gitignoreio clone
Requirement already satisfied: click in ./venv/lib/python3.6/site-packages (from gitignoreio) (6.7)
Requirement already satisfied: requests in ./venv/lib/python3.6/site-packages (from gitignoreio) (2.18.4)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio) (2018.4.16)
Requirement already satisfied: idna<2.7,>=2.5 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio) (2.6)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio) (1.22)
Installing collected packages: gitignoreio
  Found existing installation: gitignoreio 0.1.5
    Uninstalling gitignoreio-0.1.5:
      Successfully uninstalled gitignoreio-0.1.5
  Running setup.py develop for gitignoreio
Successfully installed gitignoreio
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
altendky@lt:~/t$
@pradyunsg
Copy link
Member

Hey @altendky! Thanks for filing this issue!

Was the behavior in pip 9 the same as pip 10?

@pradyunsg pradyunsg added the S: awaiting response Waiting for a response/more information label May 16, 2018
@altendky
Copy link
Author

Yes, this behavior seems to exist at least back through pip 7.1.2. I stopped at pip 6.1.1 because it gave another unrelated error.

pip 9.0.3
altendky@lt:~/t$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.4 (stretch)
Release:        9.4
Codename:       stretch
altendky@lt:~/t$ python3 -m venv venv
altendky@lt:~/t$ venv/bin/python --version
Python 3.6.5
altendky@lt:~/t$ venv/bin/python -m pip install --upgrade pip==9.*
Requirement already up-to-date: pip==9.* in ./venv/lib/python3.6/site-packages
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
altendky@lt:~/t$ export PIP_SRC=$PWD/src                                                                                                                                                                 
altendky@lt:~/t$ venv/bin/pip install -e git+https://github.com/altendky/gitignoreio#egg=gitignoreio                                                                                                     
Obtaining gitignoreio from git+https://github.com/altendky/gitignoreio#egg=gitignoreio                                                                                                                   
  Cloning https://github.com/altendky/gitignoreio to ./src/gitignoreio                                                                                                                                   
Collecting click (from gitignoreio)                                                                                                                                                                      
  Cache entry deserialization failed, entry ignored                                                                                                                                                      
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl                                                 
Collecting requests (from gitignoreio)                                                                                                                                                                   
  Cache entry deserialization failed, entry ignored                                                                                                                                                      
  Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests->gitignoreio)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->gitignoreio)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->gitignoreio)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->gitignoreio)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
Installing collected packages: click, urllib3, idna, chardet, certifi, requests, gitignoreio
  Running setup.py develop for gitignoreio
Successfully installed certifi-2018.4.16 chardet-3.0.4 click-6.7 gitignoreio idna-2.6 requests-2.18.4 urllib3-1.22
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
altendky@lt:~/t$ echo '#blah' >> src/gitignoreio/setup.py
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   setup.py

no changes added to commit (use "git add" and/or "git commit -a")
altendky@lt:~/t$ venv/bin/pip install -e git+https://github.com/altendky/gitignoreio#egg=gitignoreio
Obtaining gitignoreio from git+https://github.com/altendky/gitignoreio#egg=gitignoreio
  Updating ./src/gitignoreio clone
Requirement already satisfied: click in ./venv/lib/python3.6/site-packages (from gitignoreio)
Requirement already satisfied: requests in ./venv/lib/python3.6/site-packages (from gitignoreio)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)
Requirement already satisfied: idna<2.7,>=2.5 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)
Installing collected packages: gitignoreio
  Found existing installation: gitignoreio 0.1.5
    Uninstalling gitignoreio-0.1.5:
      Successfully uninstalled gitignoreio-0.1.5
  Running setup.py develop for gitignoreio
Successfully installed gitignoreio
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
altendky@lt:~/t$
pip 8.1.2
altendky@lt:~/t$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.4 (stretch)
Release:        9.4
Codename:       stretch
altendky@lt:~/t$ python3 -m venv venv
altendky@lt:~/t$ venv/bin/python --version
Python 3.6.5
altendky@lt:~/t$ venv/bin/python -m pip install --upgrade pip==8.*
Collecting pip==8.*
  Downloading https://files.pythonhosted.org/packages/9c/32/004ce0852e0a127f07f358b715015763273799bd798956fa930814b60f39/pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 1.2MB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
altendky@lt:~/t$ export PIP_SRC=$PWD/src
altendky@lt:~/t$ venv/bin/pip install -e git+https://github.com/altendky/gitignoreio#egg=gitignoreio
Obtaining gitignoreio from git+https://github.com/altendky/gitignoreio#egg=gitignoreio
  Cloning https://github.com/altendky/gitignoreio to ./src/gitignoreio
Collecting click (from gitignoreio)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Collecting requests (from gitignoreio)
  Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
Installing collected packages: click, chardet, urllib3, idna, certifi, requests, gitignoreio
  Running setup.py develop for gitignoreio
Successfully installed certifi-2018.4.16 chardet-3.0.4 click-6.7 gitignoreio idna-2.6 requests-2.18.4 urllib3-1.22
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
altendky@lt:~/t$ echo '#blah' >> src/gitignoreio/setup.py
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.                                                                                                                                                        
                                                                                                                                                                                                       
Changes not staged for commit:                                                                                                                                                                         
  (use "git add <file>..." to update what will be committed)                                                                                                                                           
  (use "git checkout -- <file>..." to discard changes in working directory)                                                                                                                            
                                                                                                                                                                                                       
        modified:   setup.py                                                                                                                                                                           
                                                                                                                                                                                                       
no changes added to commit (use "git add" and/or "git commit -a")                                                                                                                                      
altendky@lt:~/t$ venv/bin/pip install -e git+https://github.com/altendky/gitignoreio#egg=gitignoreio
Obtaining gitignoreio from git+https://github.com/altendky/gitignoreio#egg=gitignoreio                                                                                                                 
  Updating ./src/gitignoreio clone                                                                                                                                                                     
Requirement already satisfied (use --upgrade to upgrade): click in ./venv/lib/python3.6/site-packages (from gitignoreio)                                                                               
Requirement already satisfied (use --upgrade to upgrade): requests in ./venv/lib/python3.6/site-packages (from gitignoreio)                                                                            
Requirement already satisfied (use --upgrade to upgrade): certifi>=2017.4.17 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)                                                        
Requirement already satisfied (use --upgrade to upgrade): idna<2.7,>=2.5 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)                                                            
Requirement already satisfied (use --upgrade to upgrade): chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)                                                     
Requirement already satisfied (use --upgrade to upgrade): urllib3<1.23,>=1.21.1 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)                                                     
Installing collected packages: gitignoreio                                                                                                                                                             
  Running setup.py develop for gitignoreio                                                                                                                                                             
Successfully installed gitignoreio-0.1.5                                                                                                                                                               
You are using pip version 8.1.2, however version 10.0.1 is available.                                                                                                                                  
You should consider upgrading via the 'pip install --upgrade pip' command.                                                                                                                            
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master                                                                                                                                                                                      
Your branch is up-to-date with 'origin/master'.                                                                                                                                                       
                                                                                                                                                                                                      
nothing to commit, working tree clean                                                                                                                                                                 
altendky@lt:~/t$
pip 7.1.2
altendky@lt:~/t$ lsb_release -a
No LSB modules are available.                                                                                                                                                                         
Distributor ID: Debian                                                                                                                                                                                
Description:    Debian GNU/Linux 9.4 (stretch)                                                                                                                                                        
Release:        9.4                                                                                                                                                                                   
Codename:       stretch                                                                                                                                                                                
altendky@lt:~/t$ python3 -m venv venv
altendky@lt:~/t$ venv/bin/python --version
Python 3.6.5
altendky@lt:~/t$ venv/bin/python -m pip install --upgrade pip==7.*
Collecting pip==7.*
  Downloading https://files.pythonhosted.org/packages/b2/d0/cd115fe345dd6f07ec1c780020a7dfe74966fceeb171e0f20d1d4905b0b7/pip-7.1.2-py2.py3-none-any.whl (1.1MB)
    100% |████████████████████████████████| 1.1MB 1.3MB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-7.1.2
You are using pip version 7.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
altendky@lt:~/t$ export PIP_SRC=$PWD/src
altendky@lt:~/t$ venv/bin/pip install -e git+https://github.com/altendky/gitignoreio#egg=gitignoreio
Obtaining gitignoreio from git+https://github.com/altendky/gitignoreio#egg=gitignoreio
  Cloning https://github.com/altendky/gitignoreio to ./src/gitignoreio
Collecting click (from gitignoreio)
  Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Collecting requests (from gitignoreio)
  Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting urllib3<1.23,>=1.21.1 (from requests->gitignoreio)
  Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl
Installing collected packages: click, certifi, idna, chardet, urllib3, requests, gitignoreio
  Running setup.py develop for gitignoreio
Successfully installed certifi-2018.4.16 chardet-3.0.4 click-6.7 gitignoreio idna-2.6 requests-2.18.4 urllib3-1.22
You are using pip version 7.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
altendky@lt:~/t$ echo '#blah' >> src/gitignoreio/setup.py
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   setup.py

no changes added to commit (use "git add" and/or "git commit -a")
altendky@lt:~/t$ venv/bin/pip install -e git+https://github.com/altendky/gitignoreio#egg=gitignoreio
Obtaining gitignoreio from git+https://github.com/altendky/gitignoreio#egg=gitignoreio
  Updating ./src/gitignoreio clone
Requirement already satisfied (use --upgrade to upgrade): click in ./venv/lib/python3.6/site-packages (from gitignoreio)
Requirement already satisfied (use --upgrade to upgrade): requests in ./venv/lib/python3.6/site-packages (from gitignoreio)
Requirement already satisfied (use --upgrade to upgrade): certifi>=2017.4.17 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)
Requirement already satisfied (use --upgrade to upgrade): urllib3<1.23,>=1.21.1 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)
Requirement already satisfied (use --upgrade to upgrade): idna<2.7,>=2.5 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)
Requirement already satisfied (use --upgrade to upgrade): chardet<3.1.0,>=3.0.2 in ./venv/lib/python3.6/site-packages (from requests->gitignoreio)
Installing collected packages: gitignoreio
  Running setup.py develop for gitignoreio
Successfully installed gitignoreio-0.1.5
You are using pip version 7.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
altendky@lt:~/t$ git -C src/gitignoreio/ status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
altendky@lt:~/t$

@pradyunsg pradyunsg added type: bug A confirmed bug or unintended behavior and removed S: awaiting response Waiting for a response/more information labels May 16, 2018
@pradyunsg
Copy link
Member

Thanks for the thorough information on this @altendky! :)

I think the proposed solution in the description is a good way to solve this.

@altendky
Copy link
Author

There may need to be considerations for working directories that are clean but at another revision etc. I'll try to think this over and consider some more scenarios and ways to identify and handle them.

@piotr-dobrogost
Copy link

I think @cjerdonek in the past made a couple of changes in the area of setting up working copy after vcs clone. Maybe he would have some input?

@pradyunsg pradyunsg added the C: vcs pip's interaction with version control systems like git, svn and bzr label May 17, 2018
@cjerdonek
Copy link
Member

I'm almost positive this is a duplicate of another issue, but don't have time at the moment to find the issue number. And @piotr-dobrogost, yes, I commented on that earlier issue -- agreeing that a force reset shouldn't happen automatically because people can lose their work. IIRC, the branch should be checked out but not force reset.

@piotr-dobrogost
Copy link

piotr-dobrogost commented May 17, 2018

Probably you have in mind issue #647pip install -e resets to origin/master

@cjerdonek
Copy link
Member

Yep, thanks. And those PR's I referenced I did work on at some level. But due to a lot of cosmetic refactoring that was happening in pip's code base, those patches got out of sync. I will need to revisit and update them.

@cjerdonek
Copy link
Member

I'd like to work on this issue now that my refactoring of the VCS code is much farther along (thanks to @pradyunsg's help). However, I have a question:

If an installation update would result in local changes getting overwritten, is it okay for a behavior change to occur in this case (e.g. erroring out or prompting the user)? Or should backwards compatibility be preserved? One way to preserve backwards compatibility while not losing information would be to automatically "save" any local changes (e.g. in a backup branch) if the tree is dirty, and then warn the user, but that would add more complexity.

Are there cases where people might be relying on the reset --hard behavior in automated workflows?

@dstufft
Copy link
Member

dstufft commented Jul 12, 2018

If an installation update would result in local changes getting overwritten, is it okay for a behavior change to occur in this case (e.g. erroring out or prompting the user)? Or should backwards compatibility be preserved? One way to preserve backwards compatibility while not losing information would be to automatically "save" any local changes (e.g. in a backup branch) if the tree is dirty, and then warn the user, but that would add more complexity.

Is the behavior documented either in the documentation or --help or otherwise the only way some flag could be interpreted to work?

@cjerdonek
Copy link
Member

Is the behavior documented either in the documentation or --help

I don't see anything documented. For example, nothing is stated here--
https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
or here--
https://pip.pypa.io/en/stable/reference/pip_install/#git

@cjerdonek
Copy link
Member

cjerdonek commented Jul 12, 2018

To add to my previous comment, pip does already have code to prompt the user with options "(s)witch, (i)gnore, (w)ipe, (b)ackup" if a repository exists at the desired path, but with the wrong URL:

logger.warning(
'%s %s in %s exists with URL %s',
self.name,
self.repo_name,
display_path(dest),
existing_url,
)
prompt = ('(s)witch, (i)gnore, (w)ipe, (b)ackup ',
('s', 'i', 'w', 'b'))

Currently, I don't think this prompt can be bypassed in advance with a command-line flag like a --force option though.

In contrast, it doesn't prompt the user in perhaps the last remaining case of the URL being correct but with the working tree containing changes that would be lost (what this issue is about). However, adding prompt logic is also IMHO the solution that would add the most additional complexity to the code.

@ChrisKeefe
Copy link

Thanks to @cjerdonek and all the rest of you who have been thinking about this issue. Just thought I'd give it a bump after nearly losing a week's work to it.

Seeing a reset --hard by default without a user prompt was unexpected and nerve-wracking. A gentler default, a backup, or a prompt will save users some pain, however you choose to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: vcs pip's interaction with version control systems like git, svn and bzr state: awaiting PR Feature discussed, PR is needed type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

6 participants