regro / rever

Releaser of Versions
https://regro.github.io/rever-docs/
BSD 3-Clause "New" or "Revised" License
74 stars 33 forks source link

Rever push_tag didn't work from a fork #244

Closed xmnlab closed 3 years ago

xmnlab commented 3 years ago

Hi everyone!

In my normal workflow I fork a repo and I clone that locally. In the case of my problem I also have write access to the main repository.

I tried to create a new version of the software using rever from my fork (as origin) but it didn't work (I have the main repo as remote "upstream"). This is the error raised:

16:45 $ rever 0.2.0
activity-start:version_bump:starting activity version_bump
[detached HEAD 79b14ae] bumped version to 0.2.0
 3 files changed, 3 insertions(+), 3 deletions(-)
activity-end:version_bump:activity version_bump complete
activity-start:tag:starting activity tag
activity-end:tag:activity tag complete
activity-start:push_tag:starting activity push_tag
error: The destination you provided is not a full refname (i.e.,
starting with "refs/"). We tried to guess what you meant by:
- Looking for a ref that matches 'HEAD' on the remote side.
- Checking if the <src> being pushed ('HEAD')
  is a ref in "refs/{heads,tags}/". If so we add a corresponding
  refs/{heads,tags}/ prefix on the remote side.
Neither worked, so we gave up. You must fully qualify the ref.
hint: The <src> part of the refspec is a commit object.
hint: Did you mean to create a new branch by pushing to
hint: 'HEAD:refs/heads/HEAD'?
error: failed to push some refs to 'github.com:Quansight/omnisci-datascience-installer.git'
activity-error:push_tag:activity failed with execption:
Traceback (most recent call last):                                                                                                                                                         
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/rever/activity.xsh", line 83, in __call__                                                    
    self.func(*args, **kwargs)                                                                                                                                                             
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/rever/activities/push_tag.xsh", line 70, in _func                                            
    vcsutils.push(remote, target)                                                                                                                                                          
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/rever/vcsutils.xsh", line 37, in vcs_dispatcher                                              
    return func(*args, **kwargs)                                                                                                                                                           
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/rever/vcsutils.xsh", line 140, in git_push                                                   
    git push @(args)                                                                                                                                                                       
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/xonsh/__amalgam__.py", line 20899, in subproc_captured_hiddenobject                          
    return xonsh.procs.specs.run_subproc(cmds, captured="hiddenobject", envs=envs)                                                                                                         
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 3497, in run_subproc                                       
    command.end()                                                                                                                                                                          
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 907, in end                                                
    self._end(tee_output=tee_output)                                                                                                                                                       
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 926, in _end                                               
    self._raise_subproc_error()                                                                                                                                                            
  File "/mnt/sda1/storage/miniconda3/envs/omnisci-datascience-dev/lib/python3.8/site-packages/xonsh/procs/__amalgam__.py", line 1052, in _raise_subproc_error                              
    raise subprocess.CalledProcessError(rtn, spec.args, output=self.output)                                                                                                                
subprocess.CalledProcessError: Command '['git', 'push', 'git@github.com:Quansight/omnisci-datascience-installer.git', 'HEAD']' returned non-zero exit status 1.                            
rewinding to 79b14aefde1d908dd1a267cf79b951389ccd5e51 

for instance, this is my rever.xsh file:

$PROJECT = 'omnisci-datascience-installer'
$ACTIVITIES = [
    'version_bump',  # Changes the version number in various source files (setup.py, __init__.py, etc)
    'tag',  # Creates a tag for the new version number
    'push_tag',  # Pushes the tag up to the $TAG_REMOTE
    # 'ghrelease'  # Creates a Github release entry for the new tag
]
# These note where/how to find the version numbers
$VERSION_BUMP_PATTERNS = [
    ('constructor/pkg/construct.yaml', r'version\s*:.*', "version: $VERSION"),
    ('constructor/sh/construct.yaml', r'version\s*:.*', "version: $VERSION"),
    ('conda/meta.yaml', r'\{\%\s*set\s+version\s*=\s*.*\s*\%\}', '{% set version = "$VERSION" %}'),
]

$PUSH_TAG_REMOTE = 'git@github.com:Quansight/omnisci-datascience-installer.git'  # Repo to push tags to
# $TAG_TEMPLATE = 'v$VERSION'

$GITHUB_ORG = 'Quansight'  # Github org for Github releases and conda-forge
$GITHUB_REPO = 'omnisci-datascience-installer'  # Github repo for Github releases  and conda-forge

Am I doing anything wrong?

rjkoch commented 3 years ago

Hey there! I think you need to do this with the master branch of the fork checked out?

rjkoch commented 3 years ago

Hey @xmnlab just checking if you've been able to resolve this by checking out the master branch prior to running rever? If we don't hear from you in a couple days we will close this issue.

xmnlab commented 3 years ago

hey @rjkoch ! sorry for the delay here.

I created a branch called upstream_master that points to the master from upstream and I was using that. I thought to use this to avoid to push the changes to my fork and create a PR.

is that a wrong approach?

rjkoch commented 3 years ago

@xmnlab I am not certain, but I believe that rever is designed to be run from the master branch of your fork. I can imagine it would get confused otherwise.

I think the best practice would be to push changes to some branch of your fork and then create a PR. Once all relevant PRs are merged, ensure your fork is up to date with upstream and then run rever from the master branch of your fork.

Let me know if this works?

rjkoch commented 3 years ago

@xmnlab I should add that the latest release actually supports releasing from branches other than master After updating to rever 0.5.0, you would need to set the GHRELEASE_TARGET environment variable (in your project's rever.xsh file) to the name of the branch you'd like to release from.

xmnlab commented 3 years ago

@rjkoch that sounds great! I will try the latest release soon! thank you so much!!