Skip to content

Commit

Permalink
Fixes for bare repos in Project.add
Browse files Browse the repository at this point in the history
  • Loading branch information
abstrakraft committed Feb 27, 2012
1 parent 64ec8de commit 3fdd723
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions rug/project.py
Expand Up @@ -556,34 +556,39 @@ def add(self, path, name=None, remote=None, rev=None, vcs=None, use_sha=None):
break
if repo is None:
raise RugError('unrecognized repo %s' % path)
else:
elif not self.bare:
repo = self.vcs_class[vcs](abs_path, output_buffer=self.output.spawn(path + ': '))
else:
repo = None

#Add the repo
repos[path] = {'path': path}

#TODO: we don't know if the remote even exists yet, so can't set up all branches
#logic elsewhere should be able to handle this possibility (remote & bookmark branches don't exist)
if not self.bare:
update_rug_branch = True
update_rug_branch = True
else:
repo = r['repo']

#TODO: rethink this condition
if remote is not None:
update_rug_branch = True

#If use_sha is not specified, look at existing manifest revision
if use_sha is None:
use_sha = repo.valid_sha(r.get('revision', lookup_default['revision']))
if not self.bare:
#If use_sha is not specified, look at existing manifest revision
if use_sha is None:
use_sha = repo.valid_sha(r.get('revision', lookup_default['revision']))

#Get the rev
if rev is None:
rev = repo.head()
#Get the rev
if rev is None:
rev = repo.head()
else:
rev = repo.rev_class.cast(repo, rev)
if use_sha:
rev = repo.rev_class(repo, rev.get_sha())
revision = rev.get_short_name()
else:
rev = repo.rev_class.cast(repo, rev)
if use_sha:
rev = repo.rev_class(repo, rev.get_sha())
revision = rev.get_short_name()
revision = rev

#Update repo properties
for p in ['revision', 'name', 'remote', 'vcs']:
Expand All @@ -598,12 +603,13 @@ def add(self, path, name=None, remote=None, rev=None, vcs=None, use_sha=None):
repo = r['repo']
branches = self.get_branch_names(r)

#Update rug_index
repo.update_ref(branches['rug_index'], rev)
if not self.bare:
#Update rug_index
repo.update_ref(branches['rug_index'], rev)

#If this is a new repo, set the rug branch
if update_rug_branch:
repo.update_ref(branches['rug'], rev)
#If this is a new repo, set the rug branch
if update_rug_branch:
repo.update_ref(branches['rug'], rev)

self.output.append("%s added to manifest" % path)

Expand Down

0 comments on commit 3fdd723

Please sign in to comment.