Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 184067 Details for
Bug 261382
[PATCH] addition ways of syncing a git repository
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch that implements this feature
0003-experimental-git-support.patch (text/plain), 3.62 KB, created by
Caleb Cushing
on 2009-03-05 23:06:13 UTC
(
hide
)
Description:
patch that implements this feature
Filename:
MIME Type:
Creator:
Caleb Cushing
Created:
2009-03-05 23:06:13 UTC
Size:
3.62 KB
patch
obsolete
>diff --git a/main/tags/2.2_rc23/pym/_emerge/__init__.py b/main/tags/2.2_rc23/pym/_emerge/__init__.py >index 920abb0..a8f3eed 100644 >--- a/main/tags/2.2_rc23/pym/_emerge/__init__.py >+++ b/main/tags/2.2_rc23/pym/_emerge/__init__.py >@@ -12093,10 +12093,10 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): > print "skipping sync" > updatecache_flg = True > elif sync_method == "git": >- # Update existing git repository, and ignore the syncuri. We are >- # going to trust the user and assume that the user is in the branch >- # that he/she wants updated. We'll let the user manage branches with >- # git directly. >+ gitmethod = settings.get("PORTAGE_GIT_METHOD", None) >+ gitlocal = settings.get("PORTAGE_GIT_LOCAL", None) >+ gitremote = settings.get("PORTAGE_GIT_REMOTE", None) >+ > if portage.process.find_binary("git") is None: > msg = ["Command not found: git", > "Type \"emerge dev-util/git\" to enable git support."] >@@ -12104,17 +12104,62 @@ def action_sync(settings, trees, mtimedb, myopts, myaction): > writemsg_level("!!! %s\n" % l, > level=logging.ERROR, noiselevel=-1) > return 1 >- msg = ">>> Starting git pull in %s..." % myportdir >- emergelog(xterm_titles, msg ) >- writemsg_level(msg + "\n") >- exitcode = portage.process.spawn_bash("cd %s ; git pull" % \ >- (portage._shell_quote(myportdir),), **spawn_kwargs) >+ >+ if not os.path.exists( myportdir + "/.git"): >+ msg = ">>> Starting git clone in %s..." % myportdir >+ emergelog(xterm_titles, msg ) >+ # go through the process of cloning git manually as git is unable >+ # to clone into existing directories >+ exitcode = portage.process.spawn_bash("cd %s ; \ >+ git init ; git remote add origin %s ; git fetch ; \ >+ git checkout %s -b %s ;" % ( >+ portage._shell_quote(myportdir), >+ portage._shell_quote(syncuri), >+ portage._shell_quote(gitremote), >+ portage._shell_quote(gitlocal), >+ ), **spawn_kwargs) >+ else: >+ # fetch all remotes >+ exitcode = portage.process.spawn_bash( >+ "cd %s ; git remote update ;" % ( >+ portage._shell_quote(myportdir), >+ ), **spawn_kwargs ) >+ if gitmethod == "merge": >+ msg = ">>> Starting git merge in %s..." % myportdir >+ emergelog(xterm_titles, msg ) >+ writemsg_level(msg + "\n") >+ exitcode = portage.process.spawn_bash( >+ "cd %s ; git checkout %s ; git merge %s ;" % ( >+ portage._shell_quote(myportdir), >+ portage._shell_quote(gitlocal), >+ portage._shell_quote(gitremote), >+ ), **spawn_kwargs) >+ elif gitmethod == "rebase": >+ msg = ">>> Starting git rebase in %s..." % myportdir >+ emergelog(xterm_titles, msg ) >+ writemsg_level(msg + "\n") >+ exitcode = portage.process.spawn_bash( >+ "cd %s ; git checkout %s ; git rebase %s ;" % ( >+ portage._shell_quote(myportdir), >+ portage._shell_quote(gitlocal), >+ portage._shell_quote(gitremote), >+ ), **spawn_kwargs) >+ elif gitmethod == "checkout": >+ msg = ">>> Starting git checkout in %s..." % myportdir >+ emergelog(xterm_titles, msg ) >+ writemsg_level(msg + "\n") >+ exitcode = portage.process.spawn_bash( >+ "cd %s ; git checkout %s ;" % ( >+ portage._shell_quote(myportdir), >+ portage._shell_quote(gitremote), >+ ), **spawn_kwargs) >+ > if exitcode != os.EX_OK: >- msg = "!!! git pull error in %s." % myportdir >+ msg = "!!! git error in %s." % myportdir > emergelog(xterm_titles, msg) > writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1) > return exitcode >- msg = ">>> Git pull in %s successful" % myportdir >+ msg = ">>> Git in %s successful" % myportdir > emergelog(xterm_titles, msg) > writemsg_level(msg + "\n") > exitcode = git_sync_timestamps(settings, myportdir)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261382
: 184067