[MediaWiki-commits] [Gerrit] add - ref to Git-Tools. - change (sartoris)

2013-10-27 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/92260


Change subject: add - ref to Git-Tools.
..

add - ref to Git-Tools.

Change-Id: Idc3388aba8e0b1070e7074da62ee4937ebd33e36
---
M README.rst
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/60/92260/1

diff --git a/README.rst b/README.rst
index 0fe1bf6..98c9f8a 100644
--- a/README.rst
+++ b/README.rst
@@ -1,8 +1,10 @@
 Sartoris
 
 
-This is the Sartoris project.
-It is a tool to manage using git as a deployment management tool
+This is the Sartoris project. It is a tool to manage using git as a deployment 
management tool.  Also see:
+
+https://github.com/Git-Tools/git-deploy
+
 
 **Sartoris**
 

-- 
To view, visit https://gerrit.wikimedia.org/r/92260
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc3388aba8e0b1070e7074da62ee4937ebd33e36
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - start/revert sction. - change (sartoris)

2013-10-26 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - start/revert sction.
..


add - start/revert sction.

Change-Id: I7fb2f4d24acc94bcb97fa6d2e6c25132ed0a0d58
---
M README.rst
1 file changed, 14 insertions(+), 4 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index 9790050..0fe1bf6 100644
--- a/README.rst
+++ b/README.rst
@@ -180,11 +180,11 @@
 on *target.realm.org* as indicated.
 
 target.realm.org:~ me$ cp ~/default-client-pull.py 
/var/www/html/sample.com/.git/deploy/hooks/
-
+
 target.realm.org:~ me$ chmod +x 
/var/www/html/sample.com/.git/deploy/hooks/default-client-pull.py
 
 
-*start/sync*:
+*Sync*:
 
 Ensure that the client is correctly synced to the remote by issuing a git pull 
or rebase.  Then you can issue a
 a start command to write the lock file to the target to begin the deployment.
@@ -213,7 +213,9 @@
 *-sync--*.
 
 
-*start/abort*
+*Abort*
+
+At times it is necessary to exit the deploy cycle prematurely.  For instance, 
consider the following:
 
 client.realm.org:me.com me$ git deploy start
 
@@ -231,7 +233,15 @@
 Now you have released deploy to other clients without infecting the code base 
with your buggy code.
 
 
-*start/rollback*
+*Rollback*
 
+If you accidentally deploy some code that needs to be rolled back the *revert* 
command cn be very helpful here.  You
+can rollback to previous deploy states by utilizing deploy tags.  To view the 
old tags:
 
+client.realm.org:me.com me$ git tag
 
+Now to rollback to a previous deploy call *git revert* with the appropriate 
tag:
+
+client.realm.org:me.com me$ git deploy start
+
+client.realm.org:me.com me$ git deploy revert 

-- 
To view, visit https://gerrit.wikimedia.org/r/92157
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7fb2f4d24acc94bcb97fa6d2e6c25132ed0a0d58
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - start/abort section. - change (sartoris)

2013-10-26 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - start/abort section.
..


add - start/abort section.

Change-Id: I312a537478e88f15210104e9eac13b9af2ba6684
---
M README.rst
1 file changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index 50c432f..9790050 100644
--- a/README.rst
+++ b/README.rst
@@ -180,6 +180,7 @@
 on *target.realm.org* as indicated.
 
 target.realm.org:~ me$ cp ~/default-client-pull.py 
/var/www/html/sample.com/.git/deploy/hooks/
+
 target.realm.org:~ me$ chmod +x 
/var/www/html/sample.com/.git/deploy/hooks/default-client-pull.py
 
 
@@ -209,11 +210,26 @@
 Once you sync a the specified hooks will be invoked from the client and the 
target and a tag is written to the
 repository on the latest commit of the deploy. If the default push and pull 
hooks are used the client will simply
 push its changes to the remote and the target will pull in the new changes.  
Deployment tags have the form
-*-sync-20130918-231126*.
+*-sync--*.
 
 
 *start/abort*
 
+client.realm.org:me.com me$ git deploy start
+
+client.realm.org:me.com me$ git commit bad_change -m "add - some buggy 
code."
+
+Suddenly, you realize that your change introduced a bug after entering the 
deloy process.  Rather than syncing the bad
+code and then rolling back (next section) we can simply abort the deploy:
+
+client.realm.org:me.com me$ git deploy abort
+
+client.realm.org:me.com me$ git reset --soft HEAD^
+
+... continue with your local changes ...
+
+Now you have released deploy to other clients without infecting the code base 
with your buggy code.
+
 
 *start/rollback*
 

-- 
To view, visit https://gerrit.wikimedia.org/r/92156
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I312a537478e88f15210104e9eac13b9af2ba6684
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - start/revert sction. - change (sartoris)

2013-10-26 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/92157


Change subject: add - start/revert sction.
..

add - start/revert sction.

Change-Id: I7fb2f4d24acc94bcb97fa6d2e6c25132ed0a0d58
---
M README.rst
1 file changed, 14 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/57/92157/1

diff --git a/README.rst b/README.rst
index 9790050..0fe1bf6 100644
--- a/README.rst
+++ b/README.rst
@@ -180,11 +180,11 @@
 on *target.realm.org* as indicated.
 
 target.realm.org:~ me$ cp ~/default-client-pull.py 
/var/www/html/sample.com/.git/deploy/hooks/
-
+
 target.realm.org:~ me$ chmod +x 
/var/www/html/sample.com/.git/deploy/hooks/default-client-pull.py
 
 
-*start/sync*:
+*Sync*:
 
 Ensure that the client is correctly synced to the remote by issuing a git pull 
or rebase.  Then you can issue a
 a start command to write the lock file to the target to begin the deployment.
@@ -213,7 +213,9 @@
 *-sync--*.
 
 
-*start/abort*
+*Abort*
+
+At times it is necessary to exit the deploy cycle prematurely.  For instance, 
consider the following:
 
 client.realm.org:me.com me$ git deploy start
 
@@ -231,7 +233,15 @@
 Now you have released deploy to other clients without infecting the code base 
with your buggy code.
 
 
-*start/rollback*
+*Rollback*
 
+If you accidentally deploy some code that needs to be rolled back the *revert* 
command cn be very helpful here.  You
+can rollback to previous deploy states by utilizing deploy tags.  To view the 
old tags:
 
+client.realm.org:me.com me$ git tag
 
+Now to rollback to a previous deploy call *git revert* with the appropriate 
tag:
+
+client.realm.org:me.com me$ git deploy start
+
+client.realm.org:me.com me$ git deploy revert 

-- 
To view, visit https://gerrit.wikimedia.org/r/92157
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7fb2f4d24acc94bcb97fa6d2e6c25132ed0a0d58
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - start/abort section. - change (sartoris)

2013-10-26 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/92156


Change subject: add - start/abort section.
..

add - start/abort section.

Change-Id: I312a537478e88f15210104e9eac13b9af2ba6684
---
M README.rst
1 file changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/56/92156/1

diff --git a/README.rst b/README.rst
index 50c432f..9790050 100644
--- a/README.rst
+++ b/README.rst
@@ -180,6 +180,7 @@
 on *target.realm.org* as indicated.
 
 target.realm.org:~ me$ cp ~/default-client-pull.py 
/var/www/html/sample.com/.git/deploy/hooks/
+
 target.realm.org:~ me$ chmod +x 
/var/www/html/sample.com/.git/deploy/hooks/default-client-pull.py
 
 
@@ -209,11 +210,26 @@
 Once you sync a the specified hooks will be invoked from the client and the 
target and a tag is written to the
 repository on the latest commit of the deploy. If the default push and pull 
hooks are used the client will simply
 push its changes to the remote and the target will pull in the new changes.  
Deployment tags have the form
-*-sync-20130918-231126*.
+*-sync--*.
 
 
 *start/abort*
 
+client.realm.org:me.com me$ git deploy start
+
+client.realm.org:me.com me$ git commit bad_change -m "add - some buggy 
code."
+
+Suddenly, you realize that your change introduced a bug after entering the 
deloy process.  Rather than syncing the bad
+code and then rolling back (next section) we can simply abort the deploy:
+
+client.realm.org:me.com me$ git deploy abort
+
+client.realm.org:me.com me$ git reset --soft HEAD^
+
+... continue with your local changes ...
+
+Now you have released deploy to other clients without infecting the code base 
with your buggy code.
+
 
 *start/rollback*
 

-- 
To view, visit https://gerrit.wikimedia.org/r/92156
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I312a537478e88f15210104e9eac13b9af2ba6684
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - basic start/sync usage. - change (sartoris)

2013-10-25 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - basic start/sync usage.
..


add - basic start/sync usage.

Change-Id: Iecb7201db331809cca8d841625ecb7db18c8e69b
---
M README.rst
1 file changed, 50 insertions(+), 1 deletion(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index 778f311..50c432f 100644
--- a/README.rst
+++ b/README.rst
@@ -164,8 +164,57 @@
 
 **USING GIT DEPLOY**
 
-*start/sync*
+First initialize a new repository on *client.realm.org*:
+
+client.realm.org:~ me$ mkdir me.com
+
+client.realm.org:~ me$ cd me.com
+
+client.realm.org:~ me$ git init
+
+client.realm.org:~ me$ git remote add origin 
g...@github.com:wikimedia/me.com.git
+
+client.realm.org:~ me$ git push origin master
+
+Next initialize the client repo by following the client setup above.  
Subsequently, initialize the deploy target
+on *target.realm.org* as indicated.
+
+target.realm.org:~ me$ cp ~/default-client-pull.py 
/var/www/html/sample.com/.git/deploy/hooks/
+target.realm.org:~ me$ chmod +x 
/var/www/html/sample.com/.git/deploy/hooks/default-client-pull.py
+
+
+*start/sync*:
+
+Ensure that the client is correctly synced to the remote by issuing a git pull 
or rebase.  Then you can issue a
+a start command to write the lock file to the target to begin the deployment.
+
+client.realm.org:~ me$ cd me.com
+
+client.realm.org:me.com me$ touch new_file
+
+client.realm.org:me.com me$ git add new_file
+
+client.realm.org:me.com me$ git commit -m "add - my new file"
+
+client.realm.org:me.com me$ git pull --rebase origin master
+
+At this point you are ready to enter the deployment process:
+
+client.realm.org:me.com me$ git deploy start
+
+
+
+client.realm.org:me.com me$ git deploy sync
+
+Once you sync a the specified hooks will be invoked from the client and the 
target and a tag is written to the
+repository on the latest commit of the deploy. If the default push and pull 
hooks are used the client will simply
+push its changes to the remote and the target will pull in the new changes.  
Deployment tags have the form
+*-sync-20130918-231126*.
+
+
 *start/abort*
+
+
 *start/rollback*
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/91825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iecb7201db331809cca8d841625ecb7db18c8e69b
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - basic start/sync usage. - change (sartoris)

2013-10-25 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91825


Change subject: add - basic start/sync usage.
..

add - basic start/sync usage.

Change-Id: Iecb7201db331809cca8d841625ecb7db18c8e69b
---
M README.rst
1 file changed, 50 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/25/91825/1

diff --git a/README.rst b/README.rst
index 778f311..50c432f 100644
--- a/README.rst
+++ b/README.rst
@@ -164,8 +164,57 @@
 
 **USING GIT DEPLOY**
 
-*start/sync*
+First initialize a new repository on *client.realm.org*:
+
+client.realm.org:~ me$ mkdir me.com
+
+client.realm.org:~ me$ cd me.com
+
+client.realm.org:~ me$ git init
+
+client.realm.org:~ me$ git remote add origin 
g...@github.com:wikimedia/me.com.git
+
+client.realm.org:~ me$ git push origin master
+
+Next initialize the client repo by following the client setup above.  
Subsequently, initialize the deploy target
+on *target.realm.org* as indicated.
+
+target.realm.org:~ me$ cp ~/default-client-pull.py 
/var/www/html/sample.com/.git/deploy/hooks/
+target.realm.org:~ me$ chmod +x 
/var/www/html/sample.com/.git/deploy/hooks/default-client-pull.py
+
+
+*start/sync*:
+
+Ensure that the client is correctly synced to the remote by issuing a git pull 
or rebase.  Then you can issue a
+a start command to write the lock file to the target to begin the deployment.
+
+client.realm.org:~ me$ cd me.com
+
+client.realm.org:me.com me$ touch new_file
+
+client.realm.org:me.com me$ git add new_file
+
+client.realm.org:me.com me$ git commit -m "add - my new file"
+
+client.realm.org:me.com me$ git pull --rebase origin master
+
+At this point you are ready to enter the deployment process:
+
+client.realm.org:me.com me$ git deploy start
+
+
+
+client.realm.org:me.com me$ git deploy sync
+
+Once you sync a the specified hooks will be invoked from the client and the 
target and a tag is written to the
+repository on the latest commit of the deploy. If the default push and pull 
hooks are used the client will simply
+push its changes to the remote and the target will pull in the new changes.  
Deployment tags have the form
+*-sync-20130918-231126*.
+
+
 *start/abort*
+
+
 *start/rollback*
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/91825
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecb7201db331809cca8d841625ecb7db18c8e69b
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - spacing. - change (sartoris)

2013-10-24 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91820


Change subject: fix - spacing.
..

fix - spacing.

Change-Id: Ia09d0b4a60cade4cc21ad621cb433bd081d1c505
---
M README.rst
1 file changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/20/91820/1

diff --git a/README.rst b/README.rst
index 80e2e55..778f311 100644
--- a/README.rst
+++ b/README.rst
@@ -112,25 +112,41 @@
 On *client.realm.org* clone git deploy, local install, configure settings and 
initialize:
 
 $ git clone g...@github.com:Git-Tools/git-deploy.git
+
 ...
+
 $ cd git-deploy
+
 $ sudo pip install -e .
+
 ...
 
 Next configure the client instance with git config by assigning the following 
settings in *scripts/sartoris.ini*:
 
 [deploy]
+
 target=target.realm.org
+
 path=/home/me/project/
+
 user=me
+
 hook-dir=.git/deploy/hooks/
+
 tag-prefix=sample.com
+
 remote=origin
+
 branch=master
+
 client-path=/home/me/project/
+
 key-path=/home/me/.ssh/id_rsa
+
 test-repo-path=/tmp/test_repo/
+
 [system]
+
 run_root=/usr/bin/
 
 Once you have defined settings in *sartoris.ini* call *init.py* to set the got 
config

-- 
To view, visit https://gerrit.wikimedia.org/r/91820
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia09d0b4a60cade4cc21ad621cb433bd081d1c505
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - spacing. - change (sartoris)

2013-10-24 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - spacing.
..


fix - spacing.

Change-Id: Ia09d0b4a60cade4cc21ad621cb433bd081d1c505
---
M README.rst
1 file changed, 16 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index 80e2e55..778f311 100644
--- a/README.rst
+++ b/README.rst
@@ -112,25 +112,41 @@
 On *client.realm.org* clone git deploy, local install, configure settings and 
initialize:
 
 $ git clone g...@github.com:Git-Tools/git-deploy.git
+
 ...
+
 $ cd git-deploy
+
 $ sudo pip install -e .
+
 ...
 
 Next configure the client instance with git config by assigning the following 
settings in *scripts/sartoris.ini*:
 
 [deploy]
+
 target=target.realm.org
+
 path=/home/me/project/
+
 user=me
+
 hook-dir=.git/deploy/hooks/
+
 tag-prefix=sample.com
+
 remote=origin
+
 branch=master
+
 client-path=/home/me/project/
+
 key-path=/home/me/.ssh/id_rsa
+
 test-repo-path=/tmp/test_repo/
+
 [system]
+
 run_root=/usr/bin/
 
 Once you have defined settings in *sartoris.ini* call *init.py* to set the got 
config

-- 
To view, visit https://gerrit.wikimedia.org/r/91820
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia09d0b4a60cade4cc21ad621cb433bd081d1c505
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - more example docs on README. - change (sartoris)

2013-10-23 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - more example docs on README.
..


mod - more example docs on README.

Change-Id: I1b9483790892cbd2217a2434b950dead20ac0fc4
---
M README.rst
1 file changed, 20 insertions(+), 35 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index 6981a30..80e2e55 100644
--- a/README.rst
+++ b/README.rst
@@ -106,44 +106,18 @@
 respectively.  It is assumed that the git remote is configured for your 
project and for this example the remote alias is
 *origin* and the remote branch is *master*.
 
-###Client Setup
 
-On your client machine clone git deploy, local install, configure settings and 
initialize:
+**CLIENT SETUP**
+
+On *client.realm.org* clone git deploy, local install, configure settings and 
initialize:
 
 $ git clone g...@github.com:Git-Tools/git-deploy.git
-
-Cloning into 'git-deploy'...
-remote: Counting objects: 943, done.
-remote: Compressing objects: 100% (380/380), done.
-remote: Total 943 (delta 538), reused 936 (delta 531)
-Receiving objects: 100% (943/943), 153.47 KiB | 208 KiB/s, done.
-Resolving deltas: 100% (538/538), done.
-
+...
 $ cd git-deploy
 $ sudo pip install -e .
+...
 
-Obtaining file:///Users/rfaulkner/projects/git-deploy
-  Running setup.py egg_info for package from 
file:///Users/rfaulkner/projects/git-deploy
-
-warning: no files found matching '*' under directory 'docs'
-no previously-included directories found matching 'docs/_build'
-Requirement already satisfied (use --upgrade to upgrade): dulwich in 
/Library/Python/2.7/site-packages (from sartoris==0.1-devdev-20131021)
-Requirement already satisfied (use --upgrade to upgrade): 
paramiko>=1.11.0 in /Library/Python/2.7/site-packages (from 
sartoris==0.1-devdev-20131021)
-Requirement already satisfied (use --upgrade to upgrade): 
pycrypto>=2.1,!=2.4 in /Library/Python/2.7/site-packages (from 
paramiko>=1.11.0->sartoris==0.1-devdev-20131021)
-Installing collected packages: git-deploy
-  Running setup.py develop for git-deploy
-
-warning: no files found matching '*' under directory 'docs'
-no previously-included directories found matching 'docs/_build'
-Creating /Library/Python/2.7/site-packages/git-deploy.egg-link 
(link to .)
-sartoris 0.1-devdev-20131021 is already the active version in 
easy-install.pth
-Installing git-deploy script to /usr/local/bin
-
-Installed /Users/rfaulkner/projects/git-deploy
-Successfully installed git-deploy
-Cleaning up...
-
-Next configure the client instance with git config by assigning the following 
settings:
+Next configure the client instance with git config by assigning the following 
settings in *scripts/sartoris.ini*:
 
 [deploy]
 target=target.realm.org
@@ -154,18 +128,29 @@
 remote=origin
 branch=master
 client-path=/home/me/project/
+key-path=/home/me/.ssh/id_rsa
+test-repo-path=/tmp/test_repo/
 [system]
 run_root=/usr/bin/
 
+Once you have defined settings in *sartoris.ini* call *init.py* to set the got 
config
 
-###Target Setup
+$ sudo ./scripts/init.py
 
 
-###Using Hooks
+**TARGET SETUP**
+
+On *target.realm.org* there is no need to clone and install git-deploy but 
here the deploy hooks will need to be
+created.  There is a default hook in 
*sartoris/default-hooks/default-target-pull.py* that should be copied to
+*target.realm.org:/var/www/html/sample.com/.git/deploy/hooks/*.  This is a 
basic hook that will pull the changes
+pushed from the client instance on sync.
 
 
-###Using Git-Deploy
+**USING GIT DEPLOY**
 
+*start/sync*
+*start/abort*
+*start/rollback*
 
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/91355
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1b9483790892cbd2217a2434b950dead20ac0fc4
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - remove config_local deps. - change (sartoris)

2013-10-23 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - remove config_local deps.
..


mod - remove config_local deps.

Change-Id: Iebc8c248568c25f66fca9ecbca833578c7d09377
---
M sartoris/tests/test.py
M scripts/init.py
2 files changed, 8 insertions(+), 7 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index d75b435..d4d0da0 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -12,15 +12,18 @@
 from collections import namedtuple
 from sartoris.config import log
 from sartoris.sartoris import Sartoris, SartorisError, exit_codes
-from sartoris import config_local
 from dulwich.repo import Repo
 from os import mkdir, chdir
 from os.path import exists
 from shutil import rmtree
 
+from sartoris.config import configure
+
+
 # Create the initial singleton
-Sartoris(path=config_local.TEST_REPO,
- client_path=config_local.TEST_REPO)
+config = configure()
+Sartoris(path=config['deploy.test_repo'],
+ client_path=config['deploy.test_repo'])
 
 
 def setup_deco(test_method):
diff --git a/scripts/init.py b/scripts/init.py
index a66cebe..0f32ed6 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -12,9 +12,7 @@
 import subprocess
 import shutil
 
-from sartoris.config_local import PROJECT_HOME
-
-INI_FILE = PROJECT_HOME + 'scripts/sartoris.ini'
+INI_FILE = 'scripts/sartoris.ini'
 
 log_format = "%(asctime)s %(levelname)-8s %(message)s"
 handler = logging.StreamHandler(sys.stderr)
@@ -50,7 +48,7 @@
 
 # cp git-deploy
 if section == 'system' and name == 'run_root':
-shutil.copy(PROJECT_HOME + 'sartoris/git-deploy', value)
+shutil.copy('sartoris/git-deploy', value)
 
 
 def cli():

-- 
To view, visit https://gerrit.wikimedia.org/r/91354
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iebc8c248568c25f66fca9ecbca833578c7d09377
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - refs to config_local. - change (sartoris)

2013-10-23 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - refs to config_local.
..


fix - refs to config_local.

Change-Id: I95d72130d0cb57574831873ec5db7fab411ba74d
---
M sartoris/tests/test.py
1 file changed, 7 insertions(+), 7 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index d4d0da0..06797c7 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -48,12 +48,12 @@
 
 log.info(__name__ + ':: Creating test repo.')
 
-if exists(config_local.TEST_REPO):
-rmtree(config_local.TEST_REPO)
+if exists(config['deploy.test_repo']):
+rmtree(config['deploy.test_repo'])
 
-mkdir(config_local.TEST_REPO)
-Repo.init(config_local.TEST_REPO)
-chdir(config_local.TEST_REPO)
+mkdir(config['deploy.test_repo'])
+Repo.init(config['deploy.test_repo'])
+chdir(config['deploy.test_repo'])
 
 
 def teardown_tmp_repo():
@@ -63,8 +63,8 @@
 
 log.info(__name__ + ':: Tearing down test repo.')
 
-chdir(config_local.PROJECT_HOME)
-rmtree(config_local.TEST_REPO)
+chdir(config['deploy.test_repo'])
+rmtree(config['deploy.test_repo'])
 
 
 class TestSartorisInit(unittest.TestCase):

-- 
To view, visit https://gerrit.wikimedia.org/r/91357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I95d72130d0cb57574831873ec5db7fab411ba74d
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - refs to config_local. - change (sartoris)

2013-10-23 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91357


Change subject: fix - refs to config_local.
..

fix - refs to config_local.

Change-Id: I95d72130d0cb57574831873ec5db7fab411ba74d
---
M sartoris/tests/test.py
1 file changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/57/91357/1

diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index d4d0da0..06797c7 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -48,12 +48,12 @@
 
 log.info(__name__ + ':: Creating test repo.')
 
-if exists(config_local.TEST_REPO):
-rmtree(config_local.TEST_REPO)
+if exists(config['deploy.test_repo']):
+rmtree(config['deploy.test_repo'])
 
-mkdir(config_local.TEST_REPO)
-Repo.init(config_local.TEST_REPO)
-chdir(config_local.TEST_REPO)
+mkdir(config['deploy.test_repo'])
+Repo.init(config['deploy.test_repo'])
+chdir(config['deploy.test_repo'])
 
 
 def teardown_tmp_repo():
@@ -63,8 +63,8 @@
 
 log.info(__name__ + ':: Tearing down test repo.')
 
-chdir(config_local.PROJECT_HOME)
-rmtree(config_local.TEST_REPO)
+chdir(config['deploy.test_repo'])
+rmtree(config['deploy.test_repo'])
 
 
 class TestSartorisInit(unittest.TestCase):

-- 
To view, visit https://gerrit.wikimedia.org/r/91357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95d72130d0cb57574831873ec5db7fab411ba74d
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - more example docs on README. - change (sartoris)

2013-10-23 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91355


Change subject: mod - more example docs on README.
..

mod - more example docs on README.

Change-Id: I1b9483790892cbd2217a2434b950dead20ac0fc4
---
M README.rst
1 file changed, 20 insertions(+), 35 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/55/91355/1

diff --git a/README.rst b/README.rst
index 6981a30..80e2e55 100644
--- a/README.rst
+++ b/README.rst
@@ -106,44 +106,18 @@
 respectively.  It is assumed that the git remote is configured for your 
project and for this example the remote alias is
 *origin* and the remote branch is *master*.
 
-###Client Setup
 
-On your client machine clone git deploy, local install, configure settings and 
initialize:
+**CLIENT SETUP**
+
+On *client.realm.org* clone git deploy, local install, configure settings and 
initialize:
 
 $ git clone g...@github.com:Git-Tools/git-deploy.git
-
-Cloning into 'git-deploy'...
-remote: Counting objects: 943, done.
-remote: Compressing objects: 100% (380/380), done.
-remote: Total 943 (delta 538), reused 936 (delta 531)
-Receiving objects: 100% (943/943), 153.47 KiB | 208 KiB/s, done.
-Resolving deltas: 100% (538/538), done.
-
+...
 $ cd git-deploy
 $ sudo pip install -e .
+...
 
-Obtaining file:///Users/rfaulkner/projects/git-deploy
-  Running setup.py egg_info for package from 
file:///Users/rfaulkner/projects/git-deploy
-
-warning: no files found matching '*' under directory 'docs'
-no previously-included directories found matching 'docs/_build'
-Requirement already satisfied (use --upgrade to upgrade): dulwich in 
/Library/Python/2.7/site-packages (from sartoris==0.1-devdev-20131021)
-Requirement already satisfied (use --upgrade to upgrade): 
paramiko>=1.11.0 in /Library/Python/2.7/site-packages (from 
sartoris==0.1-devdev-20131021)
-Requirement already satisfied (use --upgrade to upgrade): 
pycrypto>=2.1,!=2.4 in /Library/Python/2.7/site-packages (from 
paramiko>=1.11.0->sartoris==0.1-devdev-20131021)
-Installing collected packages: git-deploy
-  Running setup.py develop for git-deploy
-
-warning: no files found matching '*' under directory 'docs'
-no previously-included directories found matching 'docs/_build'
-Creating /Library/Python/2.7/site-packages/git-deploy.egg-link 
(link to .)
-sartoris 0.1-devdev-20131021 is already the active version in 
easy-install.pth
-Installing git-deploy script to /usr/local/bin
-
-Installed /Users/rfaulkner/projects/git-deploy
-Successfully installed git-deploy
-Cleaning up...
-
-Next configure the client instance with git config by assigning the following 
settings:
+Next configure the client instance with git config by assigning the following 
settings in *scripts/sartoris.ini*:
 
 [deploy]
 target=target.realm.org
@@ -154,18 +128,29 @@
 remote=origin
 branch=master
 client-path=/home/me/project/
+key-path=/home/me/.ssh/id_rsa
+test-repo-path=/tmp/test_repo/
 [system]
 run_root=/usr/bin/
 
+Once you have defined settings in *sartoris.ini* call *init.py* to set the got 
config
 
-###Target Setup
+$ sudo ./scripts/init.py
 
 
-###Using Hooks
+**TARGET SETUP**
+
+On *target.realm.org* there is no need to clone and install git-deploy but 
here the deploy hooks will need to be
+created.  There is a default hook in 
*sartoris/default-hooks/default-target-pull.py* that should be copied to
+*target.realm.org:/var/www/html/sample.com/.git/deploy/hooks/*.  This is a 
basic hook that will pull the changes
+pushed from the client instance on sync.
 
 
-###Using Git-Deploy
+**USING GIT DEPLOY**
 
+*start/sync*
+*start/abort*
+*start/rollback*
 
 
 

-- 
To view, visit https://gerrit.wikimedia.org/r/91355
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b9483790892cbd2217a2434b950dead20ac0fc4
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - remove config_local deps. - change (sartoris)

2013-10-23 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91354


Change subject: mod - remove config_local deps.
..

mod - remove config_local deps.

Change-Id: Iebc8c248568c25f66fca9ecbca833578c7d09377
---
M sartoris/tests/test.py
M scripts/init.py
2 files changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/54/91354/1

diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index d75b435..d4d0da0 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -12,15 +12,18 @@
 from collections import namedtuple
 from sartoris.config import log
 from sartoris.sartoris import Sartoris, SartorisError, exit_codes
-from sartoris import config_local
 from dulwich.repo import Repo
 from os import mkdir, chdir
 from os.path import exists
 from shutil import rmtree
 
+from sartoris.config import configure
+
+
 # Create the initial singleton
-Sartoris(path=config_local.TEST_REPO,
- client_path=config_local.TEST_REPO)
+config = configure()
+Sartoris(path=config['deploy.test_repo'],
+ client_path=config['deploy.test_repo'])
 
 
 def setup_deco(test_method):
diff --git a/scripts/init.py b/scripts/init.py
index a66cebe..0f32ed6 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -12,9 +12,7 @@
 import subprocess
 import shutil
 
-from sartoris.config_local import PROJECT_HOME
-
-INI_FILE = PROJECT_HOME + 'scripts/sartoris.ini'
+INI_FILE = 'scripts/sartoris.ini'
 
 log_format = "%(asctime)s %(levelname)-8s %(message)s"
 handler = logging.StreamHandler(sys.stderr)
@@ -50,7 +48,7 @@
 
 # cp git-deploy
 if section == 'system' and name == 'run_root':
-shutil.copy(PROJECT_HOME + 'sartoris/git-deploy', value)
+shutil.copy('sartoris/git-deploy', value)
 
 
 def cli():

-- 
To view, visit https://gerrit.wikimedia.org/r/91354
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iebc8c248568c25f66fca9ecbca833578c7d09377
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - remove PKEY and PROJECT_PATH deps. - change (sartoris)

2013-10-22 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91350


Change subject: mod - remove PKEY and PROJECT_PATH deps.
..

mod - remove PKEY and PROJECT_PATH deps.

Change-Id: I1238467dfacbebbdca9233d134fbbf97b696a653
---
M sartoris/sartoris.py
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/50/91350/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 88fd999..d83a7e8 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -27,7 +27,6 @@
 
 from config import log, configure, exit_codes, DEFAULT_CLIENT_HOOK, \
 DEFAULT_TARGET_HOOK
-from config_local import PKEY, PROJECT_HOME
 
 
 class SartorisError(Exception):
@@ -232,9 +231,10 @@
 
 # Iterate through files, those modified will be staged
 for elem in os.walk(self.config['top_dir']):
+relative_path = elem[0].split('./')[-1]
 if not search(r'\.git', elem[0]):
-files = [(elem[0] + '/' + file).split(PROJECT_HOME)[-1]
- for file in elem[2]]
+files = [relative_path + '/' +
+ filename for filename in elem[2]]
 log.info(__name__ + ' :: Staging - {0}'.format(files))
 _repo.stage(files)
 
@@ -460,7 +460,8 @@
 t = paramiko.Transport(sock)
 t.start_client()
 
-rsa_key = paramiko.RSAKey.from_private_key_file(PKEY)
+rsa_key = paramiko.RSAKey.from_private_key_file(
+self.config['deploy.key_path '])
 t.auth_publickey(self.config['user.name'], rsa_key)
 
 # Start a scp channel
@@ -491,7 +492,7 @@
 ssh.connect(
 self.config['target'],
 username=self.config['user.name'],
-key_filename=PKEY)
+key_filename=self.config['deploy.key_path'])
 stdin, stdout, stderr = ssh.exec_command(cmd)
 
 stdout = [line.strip() for line in stdout.readlines()]

-- 
To view, visit https://gerrit.wikimedia.org/r/91350
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1238467dfacbebbdca9233d134fbbf97b696a653
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - remove PKEY and PROJECT_PATH deps. - change (sartoris)

2013-10-22 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - remove PKEY and PROJECT_PATH deps.
..


mod - remove PKEY and PROJECT_PATH deps.

Change-Id: I1238467dfacbebbdca9233d134fbbf97b696a653
---
M sartoris/sartoris.py
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 88fd999..d83a7e8 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -27,7 +27,6 @@
 
 from config import log, configure, exit_codes, DEFAULT_CLIENT_HOOK, \
 DEFAULT_TARGET_HOOK
-from config_local import PKEY, PROJECT_HOME
 
 
 class SartorisError(Exception):
@@ -232,9 +231,10 @@
 
 # Iterate through files, those modified will be staged
 for elem in os.walk(self.config['top_dir']):
+relative_path = elem[0].split('./')[-1]
 if not search(r'\.git', elem[0]):
-files = [(elem[0] + '/' + file).split(PROJECT_HOME)[-1]
- for file in elem[2]]
+files = [relative_path + '/' +
+ filename for filename in elem[2]]
 log.info(__name__ + ' :: Staging - {0}'.format(files))
 _repo.stage(files)
 
@@ -460,7 +460,8 @@
 t = paramiko.Transport(sock)
 t.start_client()
 
-rsa_key = paramiko.RSAKey.from_private_key_file(PKEY)
+rsa_key = paramiko.RSAKey.from_private_key_file(
+self.config['deploy.key_path '])
 t.auth_publickey(self.config['user.name'], rsa_key)
 
 # Start a scp channel
@@ -491,7 +492,7 @@
 ssh.connect(
 self.config['target'],
 username=self.config['user.name'],
-key_filename=PKEY)
+key_filename=self.config['deploy.key_path'])
 stdin, stdout, stderr = ssh.exec_command(cmd)
 
 stdout = [line.strip() for line in stdout.readlines()]

-- 
To view, visit https://gerrit.wikimedia.org/r/91350
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1238467dfacbebbdca9233d134fbbf97b696a653
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - test repo and key path config to git config. - change (sartoris)

2013-10-22 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91349


Change subject: add - test repo and key path config to git config.
..

add - test repo and key path config to git config.

Change-Id: Ib83603a531aa5ef642dcc4aa25e7a352edc93e55
---
M sartoris/config.py
D sartoris/config_local.py.generic
M scripts/sartoris.ini
3 files changed, 6 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/49/91349/1

diff --git a/sartoris/config.py b/sartoris/config.py
index 249810c..b2ab7b6 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -58,6 +58,8 @@
 34: 'git log failed. Exiting.',
 35: 'Revert failed, could not find tag. Exiting.',
 36: 'Not enough tags (<2) to revert on. Exiting.',
+37: 'Missing system configuration item "key-path". Exiting.',
+38: 'Missing system configuration item "test-repo-path". Exiting.',
 40: 'Failed to run sync script. Exiting.',
 50: 'Failed to read the .deploy file. Exiting.',
 60: 'Invalid git deploy action. Exiting.',
@@ -131,6 +133,8 @@
 'client_path': ('deploy', 'client-path', 19),
 'user.name': ('user', 'name', 28),
 'user.email': ('user', 'email', 29),
+'deploy.key_path': ('deploy', 'key-path', 37),
+'deploy.test_repo': ('deploy', 'test-repo-path', 38),
 }
 
 # Assign the values of each git config element
diff --git a/sartoris/config_local.py.generic b/sartoris/config_local.py.generic
deleted file mode 100644
index 68b294d..000
--- a/sartoris/config_local.py.generic
+++ /dev/null
@@ -1,12 +0,0 @@
-"""
-Local settings go in here
-"""
-
-# REPO for Sartoris tests
-TEST_REPO = '/path/to/test_repo/home/'
-
-# Path to private key
-PKEY = '/path/to/private/key/file'
-
-# Project Path
-PROJECT_HOME = '/path/to/sartoris'
\ No newline at end of file
diff --git a/scripts/sartoris.ini b/scripts/sartoris.ini
index 07b790d..df74d24 100644
--- a/scripts/sartoris.ini
+++ b/scripts/sartoris.ini
@@ -12,5 +12,7 @@
 remote=
 branch=
 client-path=
+key-path=
+test-repo-path=
 [system]
 run_root=/usr/bin/
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/91349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib83603a531aa5ef642dcc4aa25e7a352edc93e55
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - test repo and key path config to git config. - change (sartoris)

2013-10-22 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - test repo and key path config to git config.
..


add - test repo and key path config to git config.

Change-Id: Ib83603a531aa5ef642dcc4aa25e7a352edc93e55
---
M sartoris/config.py
D sartoris/config_local.py.generic
M scripts/sartoris.ini
3 files changed, 6 insertions(+), 12 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/config.py b/sartoris/config.py
index 249810c..b2ab7b6 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -58,6 +58,8 @@
 34: 'git log failed. Exiting.',
 35: 'Revert failed, could not find tag. Exiting.',
 36: 'Not enough tags (<2) to revert on. Exiting.',
+37: 'Missing system configuration item "key-path". Exiting.',
+38: 'Missing system configuration item "test-repo-path". Exiting.',
 40: 'Failed to run sync script. Exiting.',
 50: 'Failed to read the .deploy file. Exiting.',
 60: 'Invalid git deploy action. Exiting.',
@@ -131,6 +133,8 @@
 'client_path': ('deploy', 'client-path', 19),
 'user.name': ('user', 'name', 28),
 'user.email': ('user', 'email', 29),
+'deploy.key_path': ('deploy', 'key-path', 37),
+'deploy.test_repo': ('deploy', 'test-repo-path', 38),
 }
 
 # Assign the values of each git config element
diff --git a/sartoris/config_local.py.generic b/sartoris/config_local.py.generic
deleted file mode 100644
index 68b294d..000
--- a/sartoris/config_local.py.generic
+++ /dev/null
@@ -1,12 +0,0 @@
-"""
-Local settings go in here
-"""
-
-# REPO for Sartoris tests
-TEST_REPO = '/path/to/test_repo/home/'
-
-# Path to private key
-PKEY = '/path/to/private/key/file'
-
-# Project Path
-PROJECT_HOME = '/path/to/sartoris'
\ No newline at end of file
diff --git a/scripts/sartoris.ini b/scripts/sartoris.ini
index 07b790d..df74d24 100644
--- a/scripts/sartoris.ini
+++ b/scripts/sartoris.ini
@@ -12,5 +12,7 @@
 remote=
 branch=
 client-path=
+key-path=
+test-repo-path=
 [system]
 run_root=/usr/bin/
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/91349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib83603a531aa5ef642dcc4aa25e7a352edc93e55
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - updates to README doc. - change (sartoris)

2013-10-21 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - updates to README doc.
..


mod - updates to README doc.

Change-Id: Ia5cd31556c58c8588f015d0cc123b0fc23d69502
---
M README.rst
1 file changed, 74 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index d904e68..6981a30 100644
--- a/README.rst
+++ b/README.rst
@@ -95,3 +95,77 @@
 In the working path of your local clone deploy hooks may be added to 
'.git/deploy/hooks'.  You are
 free to write your own hooks however, simple default hooks have been provided 
in 'sartoris/default-hooks',
 these can be copied to the hook folder in each client and target.
+
+
+Example
+---
+
+The following example illustrates how git-deploy can be configured and used 
for a single client and target.  For this
+example the client host and target host will be referred to as 
*client.realm.org* and *target.realm.org* respectively.
+The home path on the client and target for our sample project is 
*/home/me/project/* and */var/www/html/sample.com/*
+respectively.  It is assumed that the git remote is configured for your 
project and for this example the remote alias is
+*origin* and the remote branch is *master*.
+
+###Client Setup
+
+On your client machine clone git deploy, local install, configure settings and 
initialize:
+
+$ git clone g...@github.com:Git-Tools/git-deploy.git
+
+Cloning into 'git-deploy'...
+remote: Counting objects: 943, done.
+remote: Compressing objects: 100% (380/380), done.
+remote: Total 943 (delta 538), reused 936 (delta 531)
+Receiving objects: 100% (943/943), 153.47 KiB | 208 KiB/s, done.
+Resolving deltas: 100% (538/538), done.
+
+$ cd git-deploy
+$ sudo pip install -e .
+
+Obtaining file:///Users/rfaulkner/projects/git-deploy
+  Running setup.py egg_info for package from 
file:///Users/rfaulkner/projects/git-deploy
+
+warning: no files found matching '*' under directory 'docs'
+no previously-included directories found matching 'docs/_build'
+Requirement already satisfied (use --upgrade to upgrade): dulwich in 
/Library/Python/2.7/site-packages (from sartoris==0.1-devdev-20131021)
+Requirement already satisfied (use --upgrade to upgrade): 
paramiko>=1.11.0 in /Library/Python/2.7/site-packages (from 
sartoris==0.1-devdev-20131021)
+Requirement already satisfied (use --upgrade to upgrade): 
pycrypto>=2.1,!=2.4 in /Library/Python/2.7/site-packages (from 
paramiko>=1.11.0->sartoris==0.1-devdev-20131021)
+Installing collected packages: git-deploy
+  Running setup.py develop for git-deploy
+
+warning: no files found matching '*' under directory 'docs'
+no previously-included directories found matching 'docs/_build'
+Creating /Library/Python/2.7/site-packages/git-deploy.egg-link 
(link to .)
+sartoris 0.1-devdev-20131021 is already the active version in 
easy-install.pth
+Installing git-deploy script to /usr/local/bin
+
+Installed /Users/rfaulkner/projects/git-deploy
+Successfully installed git-deploy
+Cleaning up...
+
+Next configure the client instance with git config by assigning the following 
settings:
+
+[deploy]
+target=target.realm.org
+path=/home/me/project/
+user=me
+hook-dir=.git/deploy/hooks/
+tag-prefix=sample.com
+remote=origin
+branch=master
+client-path=/home/me/project/
+[system]
+run_root=/usr/bin/
+
+
+###Target Setup
+
+
+###Using Hooks
+
+
+###Using Git-Deploy
+
+
+
+

-- 
To view, visit https://gerrit.wikimedia.org/r/91140
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5cd31556c58c8588f015d0cc123b0fc23d69502
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - updates to README doc. - change (sartoris)

2013-10-21 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/91140


Change subject: mod - updates to README doc.
..

mod - updates to README doc.

Change-Id: Ia5cd31556c58c8588f015d0cc123b0fc23d69502
---
M README.rst
1 file changed, 74 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/40/91140/1

diff --git a/README.rst b/README.rst
index d904e68..6981a30 100644
--- a/README.rst
+++ b/README.rst
@@ -95,3 +95,77 @@
 In the working path of your local clone deploy hooks may be added to 
'.git/deploy/hooks'.  You are
 free to write your own hooks however, simple default hooks have been provided 
in 'sartoris/default-hooks',
 these can be copied to the hook folder in each client and target.
+
+
+Example
+---
+
+The following example illustrates how git-deploy can be configured and used 
for a single client and target.  For this
+example the client host and target host will be referred to as 
*client.realm.org* and *target.realm.org* respectively.
+The home path on the client and target for our sample project is 
*/home/me/project/* and */var/www/html/sample.com/*
+respectively.  It is assumed that the git remote is configured for your 
project and for this example the remote alias is
+*origin* and the remote branch is *master*.
+
+###Client Setup
+
+On your client machine clone git deploy, local install, configure settings and 
initialize:
+
+$ git clone g...@github.com:Git-Tools/git-deploy.git
+
+Cloning into 'git-deploy'...
+remote: Counting objects: 943, done.
+remote: Compressing objects: 100% (380/380), done.
+remote: Total 943 (delta 538), reused 936 (delta 531)
+Receiving objects: 100% (943/943), 153.47 KiB | 208 KiB/s, done.
+Resolving deltas: 100% (538/538), done.
+
+$ cd git-deploy
+$ sudo pip install -e .
+
+Obtaining file:///Users/rfaulkner/projects/git-deploy
+  Running setup.py egg_info for package from 
file:///Users/rfaulkner/projects/git-deploy
+
+warning: no files found matching '*' under directory 'docs'
+no previously-included directories found matching 'docs/_build'
+Requirement already satisfied (use --upgrade to upgrade): dulwich in 
/Library/Python/2.7/site-packages (from sartoris==0.1-devdev-20131021)
+Requirement already satisfied (use --upgrade to upgrade): 
paramiko>=1.11.0 in /Library/Python/2.7/site-packages (from 
sartoris==0.1-devdev-20131021)
+Requirement already satisfied (use --upgrade to upgrade): 
pycrypto>=2.1,!=2.4 in /Library/Python/2.7/site-packages (from 
paramiko>=1.11.0->sartoris==0.1-devdev-20131021)
+Installing collected packages: git-deploy
+  Running setup.py develop for git-deploy
+
+warning: no files found matching '*' under directory 'docs'
+no previously-included directories found matching 'docs/_build'
+Creating /Library/Python/2.7/site-packages/git-deploy.egg-link 
(link to .)
+sartoris 0.1-devdev-20131021 is already the active version in 
easy-install.pth
+Installing git-deploy script to /usr/local/bin
+
+Installed /Users/rfaulkner/projects/git-deploy
+Successfully installed git-deploy
+Cleaning up...
+
+Next configure the client instance with git config by assigning the following 
settings:
+
+[deploy]
+target=target.realm.org
+path=/home/me/project/
+user=me
+hook-dir=.git/deploy/hooks/
+tag-prefix=sample.com
+remote=origin
+branch=master
+client-path=/home/me/project/
+[system]
+run_root=/usr/bin/
+
+
+###Target Setup
+
+
+###Using Hooks
+
+
+###Using Git-Deploy
+
+
+
+

-- 
To view, visit https://gerrit.wikimedia.org/r/91140
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia5cd31556c58c8588f015d0cc123b0fc23d69502
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - initializtion of the test repo, preventing override of... - change (sartoris)

2013-10-09 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - initializtion of the test repo, preventing override of 
class method names in decorator.
..


fix - initializtion of the test repo, preventing override of class method names 
in decorator.

Change-Id: I7237d1e720811c4a26ff09d549882d42c89279a9
---
M sartoris/tests/test.py
1 file changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index 3ce088f..d75b435 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -10,11 +10,17 @@
 
 import unittest
 from collections import namedtuple
+from sartoris.config import log
 from sartoris.sartoris import Sartoris, SartorisError, exit_codes
 from sartoris import config_local
 from dulwich.repo import Repo
 from os import mkdir, chdir
+from os.path import exists
 from shutil import rmtree
+
+# Create the initial singleton
+Sartoris(path=config_local.TEST_REPO,
+ client_path=config_local.TEST_REPO)
 
 
 def setup_deco(test_method):
@@ -28,6 +34,7 @@
 test_method(self)
 finally:
 teardown_tmp_repo()
+setup_wrap.__name__ = test_method.__name__
 return setup_wrap
 
 
@@ -35,6 +42,12 @@
 """
 Create a test repo, change to directory
 """
+
+log.info(__name__ + ':: Creating test repo.')
+
+if exists(config_local.TEST_REPO):
+rmtree(config_local.TEST_REPO)
+
 mkdir(config_local.TEST_REPO)
 Repo.init(config_local.TEST_REPO)
 chdir(config_local.TEST_REPO)
@@ -44,6 +57,9 @@
 """
 Remove the test repo
 """
+
+log.info(__name__ + ':: Tearing down test repo.')
+
 chdir(config_local.PROJECT_HOME)
 rmtree(config_local.TEST_REPO)
 
@@ -81,9 +97,9 @@
 without exception
 """
 sartoris_obj = Sartoris()
+
 try:
 sartoris_obj.start(None)
-sartoris_obj.sync(None)
 sartoris_obj.abort(None)
 
 # TODO - check lock file & commit

-- 
To view, visit https://gerrit.wikimedia.org/r/88931
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7237d1e720811c4a26ff09d549882d42c89279a9
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - initializtion of the test repo, preventing override of... - change (sartoris)

2013-10-09 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/88931


Change subject: fix - initializtion of the test repo, preventing override of 
class method names in decorator.
..

fix - initializtion of the test repo, preventing override of class method names 
in decorator.

Change-Id: I7237d1e720811c4a26ff09d549882d42c89279a9
---
M sartoris/tests/test.py
1 file changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/31/88931/1

diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index 3ce088f..d75b435 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -10,11 +10,17 @@
 
 import unittest
 from collections import namedtuple
+from sartoris.config import log
 from sartoris.sartoris import Sartoris, SartorisError, exit_codes
 from sartoris import config_local
 from dulwich.repo import Repo
 from os import mkdir, chdir
+from os.path import exists
 from shutil import rmtree
+
+# Create the initial singleton
+Sartoris(path=config_local.TEST_REPO,
+ client_path=config_local.TEST_REPO)
 
 
 def setup_deco(test_method):
@@ -28,6 +34,7 @@
 test_method(self)
 finally:
 teardown_tmp_repo()
+setup_wrap.__name__ = test_method.__name__
 return setup_wrap
 
 
@@ -35,6 +42,12 @@
 """
 Create a test repo, change to directory
 """
+
+log.info(__name__ + ':: Creating test repo.')
+
+if exists(config_local.TEST_REPO):
+rmtree(config_local.TEST_REPO)
+
 mkdir(config_local.TEST_REPO)
 Repo.init(config_local.TEST_REPO)
 chdir(config_local.TEST_REPO)
@@ -44,6 +57,9 @@
 """
 Remove the test repo
 """
+
+log.info(__name__ + ':: Tearing down test repo.')
+
 chdir(config_local.PROJECT_HOME)
 rmtree(config_local.TEST_REPO)
 
@@ -81,9 +97,9 @@
 without exception
 """
 sartoris_obj = Sartoris()
+
 try:
 sartoris_obj.start(None)
-sartoris_obj.sync(None)
 sartoris_obj.abort(None)
 
 # TODO - check lock file & commit

-- 
To view, visit https://gerrit.wikimedia.org/r/88931
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7237d1e720811c4a26ff09d549882d42c89279a9
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - allow git config to be overriden. - change (sartoris)

2013-10-09 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - allow git config to be overriden.
..


mod - allow git config to be overriden.

Change-Id: I52b3f32ce9b10793d50ba26f0791f750f957815f
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 9 insertions(+), 5 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/config.py b/sartoris/config.py
index 17c939b..249810c 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -101,7 +101,7 @@
 log.setLevel(level)
 
 
-def configure():
+def configure(**kwargs):
 """ Parse configuration from git config """
 sc = StackedConfig(StackedConfig.default_backends())
 config = {}
@@ -136,7 +136,11 @@
 # Assign the values of each git config element
 for key, value in config_elements.iteritems():
 try:
-config[key] = sc.get(value[0], value[1])
+# Override with kwargs if the attribute exists
+if key in kwargs:
+config[key] = kwargs[key]
+else:
+config[key] = sc.get(value[0], value[1])
 except KeyError:
 exit_code = value[2]
 log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index f0106cc..88fd999 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -93,14 +93,14 @@
 cls.__instance = super(Sartoris, cls).__new__(cls, *args, **kwargs)
 
 # Call config
-cls.__instance._configure()
+cls.__instance._configure(**kwargs)
 
 log.info('{0} :: Config - {1}'.format(__name__,
  str(cls.__instance.config)))
 return cls.__instance
 
-def _configure(self):
-self.config = configure()
+def _configure(self, **kwargs):
+self.config = configure(**kwargs)
 
 def _check_lock(self):
 """ Returns boolean flag on lock file existence """

-- 
To view, visit https://gerrit.wikimedia.org/r/88930
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I52b3f32ce9b10793d50ba26f0791f750f957815f
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - allow git config to be overriden. - change (sartoris)

2013-10-09 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/88930


Change subject: mod - allow git config to be overriden.
..

mod - allow git config to be overriden.

Change-Id: I52b3f32ce9b10793d50ba26f0791f750f957815f
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/30/88930/1

diff --git a/sartoris/config.py b/sartoris/config.py
index 17c939b..249810c 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -101,7 +101,7 @@
 log.setLevel(level)
 
 
-def configure():
+def configure(**kwargs):
 """ Parse configuration from git config """
 sc = StackedConfig(StackedConfig.default_backends())
 config = {}
@@ -136,7 +136,11 @@
 # Assign the values of each git config element
 for key, value in config_elements.iteritems():
 try:
-config[key] = sc.get(value[0], value[1])
+# Override with kwargs if the attribute exists
+if key in kwargs:
+config[key] = kwargs[key]
+else:
+config[key] = sc.get(value[0], value[1])
 except KeyError:
 exit_code = value[2]
 log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index f0106cc..88fd999 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -93,14 +93,14 @@
 cls.__instance = super(Sartoris, cls).__new__(cls, *args, **kwargs)
 
 # Call config
-cls.__instance._configure()
+cls.__instance._configure(**kwargs)
 
 log.info('{0} :: Config - {1}'.format(__name__,
  str(cls.__instance.config)))
 return cls.__instance
 
-def _configure(self):
-self.config = configure()
+def _configure(self, **kwargs):
+self.config = configure(**kwargs)
 
 def _check_lock(self):
 """ Returns boolean flag on lock file existence """

-- 
To view, visit https://gerrit.wikimedia.org/r/88930
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52b3f32ce9b10793d50ba26f0791f750f957815f
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - 1. remove obsolete tests. \n2. Add some setup to exist... - change (sartoris)

2013-10-09 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - 1. remove obsolete tests. \n2. Add some setup to existing 
tests.
..


mod - 1. remove obsolete tests. \n2. Add some setup to existing tests.

Change-Id: I5ceee8da7e106b2b70e404ec10b4ef7eef97b4ec
---
M sartoris/tests/test.py
1 file changed, 3 insertions(+), 18 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index da0a46e..3ce088f 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -48,13 +48,6 @@
 rmtree(config_local.TEST_REPO)
 
 
-class TestNullHandler(unittest.TestCase):
-def test_emit(self):
-# null_handler = NullHandler()
-# self.assertEqual(expected, null_handler.emit(record))
-assert False  # TODO: implement your test here
-
-
 class TestSartorisInit(unittest.TestCase):
 """ Test cases for Sartoris initialization and config """
 def test_conf_hook_dir(self):
@@ -98,6 +91,7 @@
 except SartorisError:
 assert False
 
+@setup_deco
 def test_diff(self):
 """
 diff - test to ensure that ``diff`` method functions
@@ -109,6 +103,7 @@
 except SartorisError:
 assert False
 
+@setup_deco
 def test_log_deploys(self):
 """
 log_deploys - test to ensure that ``log_deploys`` method functions
@@ -120,17 +115,7 @@
 except SartorisError:
 assert False
 
-def test_resync(self):
-"""
-resync - test to ensure that ``resync`` method functions
-without exception
-"""
-sartoris_obj = Sartoris()
-try:
-sartoris_obj.resync(None)
-except SartorisError:
-assert False
-
+@setup_deco
 def test_revert(self):
 """
 revert - test to ensure that ``revert`` method functions

-- 
To view, visit https://gerrit.wikimedia.org/r/88696
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5ceee8da7e106b2b70e404ec10b4ef7eef97b4ec
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - 1. remove obsolete tests. \n2. Add some setup to exist... - change (sartoris)

2013-10-09 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/88696


Change subject: mod - 1. remove obsolete tests. \n2. Add some setup to existing 
tests.
..

mod - 1. remove obsolete tests. \n2. Add some setup to existing tests.

Change-Id: I5ceee8da7e106b2b70e404ec10b4ef7eef97b4ec
---
M sartoris/tests/test.py
1 file changed, 3 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/96/88696/1

diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index da0a46e..3ce088f 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -48,13 +48,6 @@
 rmtree(config_local.TEST_REPO)
 
 
-class TestNullHandler(unittest.TestCase):
-def test_emit(self):
-# null_handler = NullHandler()
-# self.assertEqual(expected, null_handler.emit(record))
-assert False  # TODO: implement your test here
-
-
 class TestSartorisInit(unittest.TestCase):
 """ Test cases for Sartoris initialization and config """
 def test_conf_hook_dir(self):
@@ -98,6 +91,7 @@
 except SartorisError:
 assert False
 
+@setup_deco
 def test_diff(self):
 """
 diff - test to ensure that ``diff`` method functions
@@ -109,6 +103,7 @@
 except SartorisError:
 assert False
 
+@setup_deco
 def test_log_deploys(self):
 """
 log_deploys - test to ensure that ``log_deploys`` method functions
@@ -120,17 +115,7 @@
 except SartorisError:
 assert False
 
-def test_resync(self):
-"""
-resync - test to ensure that ``resync`` method functions
-without exception
-"""
-sartoris_obj = Sartoris()
-try:
-sartoris_obj.resync(None)
-except SartorisError:
-assert False
-
+@setup_deco
 def test_revert(self):
 """
 revert - test to ensure that ``revert`` method functions

-- 
To view, visit https://gerrit.wikimedia.org/r/88696
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5ceee8da7e106b2b70e404ec10b4ef7eef97b4ec
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - test for test_dulwich_tag. - change (sartoris)

2013-10-08 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - test for test_dulwich_tag.
..


add - test for test_dulwich_tag.

Change-Id: Ica031a9969a3c470ec82f35a6a8cdbee3003936b
---
M sartoris/tests/test.py
1 file changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index 3965828..da0a46e 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -214,12 +214,15 @@
 def test_dulwich_tag(self):
 """
 Tests method Sartoris::_dulwich_tag
+
+1. Call _dulwich_tag
+2. Check most recent tag to verify tag exists
 """
-
-#   1. Call _dulwich_tag
-#   2. Check _repo['refs/tags/' + tag] to verify tag exists
-
-assert False
+s = Sartoris()
+tag = 'test_tag'
+s._dulwich_tag(tag, s._make_author())
+tags = s._dulwich_get_tags()
+assert tags.keys()[0] == tag
 
 @setup_deco
 def test_dulwich_reset_to_tag(self):

-- 
To view, visit https://gerrit.wikimedia.org/r/88690
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ica031a9969a3c470ec82f35a6a8cdbee3003936b
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - test for test_dulwich_tag. - change (sartoris)

2013-10-08 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/88690


Change subject: add - test for test_dulwich_tag.
..

add - test for test_dulwich_tag.

Change-Id: Ica031a9969a3c470ec82f35a6a8cdbee3003936b
---
M sartoris/tests/test.py
1 file changed, 8 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/90/88690/1

diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index 3965828..da0a46e 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -214,12 +214,15 @@
 def test_dulwich_tag(self):
 """
 Tests method Sartoris::_dulwich_tag
+
+1. Call _dulwich_tag
+2. Check most recent tag to verify tag exists
 """
-
-#   1. Call _dulwich_tag
-#   2. Check _repo['refs/tags/' + tag] to verify tag exists
-
-assert False
+s = Sartoris()
+tag = 'test_tag'
+s._dulwich_tag(tag, s._make_author())
+tags = s._dulwich_get_tags()
+assert tags.keys()[0] == tag
 
 @setup_deco
 def test_dulwich_reset_to_tag(self):

-- 
To view, visit https://gerrit.wikimedia.org/r/88690
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica031a9969a3c470ec82f35a6a8cdbee3003936b
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - method _get_deploy_tags, utilize in diff & log_deploys. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/88004


Change subject: add - method _get_deploy_tags, utilize in diff & log_deploys.
..

add - method _get_deploy_tags, utilize in diff & log_deploys.

Change-Id: Icd2d077ce60aaea9304f0ba5bfa0855f1f8b0b71
---
M sartoris/sartoris.py
1 file changed, 19 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/04/88004/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 9686a16..f0106cc 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -167,10 +167,21 @@
 raise SartorisError(message=exit_codes[8], exit_code=8)
 
 def _get_latest_deploy_tag(self):
-""" Returns the latest tag containing 'sync'
-Sets self._tag to tag string
 """
-return self._dulwich_get_tags().keys()[-1]
+Returns the latest tag containing 'sync'
+Sets self._tag to tag string
+"""
+return self._get_deploy_tags()[-1]
+
+def _get_deploy_tags(self):
+"""
+Returns the all deploy tags.
+"""
+# 1. Pull last 'num_tags' sync tags
+# 2. Filter only matched deploy tags
+tags = self._dulwich_get_tags().keys()
+f = lambda x: search(self.config['user'] + '-', x)
+return filter(f, tags)
 
 def _dulwich_tag(self, tag, author, message=DEFAULT_TAG_MSG):
 """
@@ -585,13 +596,7 @@
 except NameError:
 raise SartorisError(message=exit_codes[10], exit_code=10)
 
-# Pull last 'num_tags' sync tags
-# Reverse the tags since the later ones will appear further down
-tags = self._dulwich_get_tags().keys()
-
-# Filter only matched deploy tags
-f = lambda x: search(self.config['user'] + '-', x)
-tags = filter(f, tags)
+tags = self._get_deploy_tags()
 
 if num_tags <= len(tags):
 tags = tags[:num_tags]
@@ -605,25 +610,16 @@
 * show a git diff of the last deploy and it's previous deploy
 """
 
-# Get the last two tags - assumes tagging on deployment only
-proc = subprocess.Popen("git tag".split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE,)
-
-# Get the last two tags
-sync_tags = filter(lambda x: search(r'sync', x),
-   proc.communicate()[0].split('\n'))
+tags = self._get_deploy_tags()
 
 # Check the return code & whether at least two sync tags were
 # returned
-if proc.returncode:
-raise SartorisError(message=exit_codes[6], exit_code=6)
-elif len(sync_tags) < 2:
+if len(tags) < 2:
 raise SartorisError(message=exit_codes[7], exit_code=7)
 
 # Get the associated commit hashes for those tags
-sha_1 = self._get_commit_sha_for_tag(sync_tags[0])
-sha_2 = self._get_commit_sha_for_tag(sync_tags[1])
+sha_1 = self._get_commit_sha_for_tag(tags[0])
+sha_2 = self._get_commit_sha_for_tag(tags[1])
 
 # Produce the diff
 # @TODO replace with dulwich

-- 
To view, visit https://gerrit.wikimedia.org/r/88004
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd2d077ce60aaea9304f0ba5bfa0855f1f8b0b71
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - method _get_deploy_tags, utilize in diff & log_deploys. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - method _get_deploy_tags, utilize in diff & log_deploys.
..


add - method _get_deploy_tags, utilize in diff & log_deploys.

Change-Id: Icd2d077ce60aaea9304f0ba5bfa0855f1f8b0b71
---
M sartoris/sartoris.py
1 file changed, 19 insertions(+), 23 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 9686a16..f0106cc 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -167,10 +167,21 @@
 raise SartorisError(message=exit_codes[8], exit_code=8)
 
 def _get_latest_deploy_tag(self):
-""" Returns the latest tag containing 'sync'
-Sets self._tag to tag string
 """
-return self._dulwich_get_tags().keys()[-1]
+Returns the latest tag containing 'sync'
+Sets self._tag to tag string
+"""
+return self._get_deploy_tags()[-1]
+
+def _get_deploy_tags(self):
+"""
+Returns the all deploy tags.
+"""
+# 1. Pull last 'num_tags' sync tags
+# 2. Filter only matched deploy tags
+tags = self._dulwich_get_tags().keys()
+f = lambda x: search(self.config['user'] + '-', x)
+return filter(f, tags)
 
 def _dulwich_tag(self, tag, author, message=DEFAULT_TAG_MSG):
 """
@@ -585,13 +596,7 @@
 except NameError:
 raise SartorisError(message=exit_codes[10], exit_code=10)
 
-# Pull last 'num_tags' sync tags
-# Reverse the tags since the later ones will appear further down
-tags = self._dulwich_get_tags().keys()
-
-# Filter only matched deploy tags
-f = lambda x: search(self.config['user'] + '-', x)
-tags = filter(f, tags)
+tags = self._get_deploy_tags()
 
 if num_tags <= len(tags):
 tags = tags[:num_tags]
@@ -605,25 +610,16 @@
 * show a git diff of the last deploy and it's previous deploy
 """
 
-# Get the last two tags - assumes tagging on deployment only
-proc = subprocess.Popen("git tag".split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE,)
-
-# Get the last two tags
-sync_tags = filter(lambda x: search(r'sync', x),
-   proc.communicate()[0].split('\n'))
+tags = self._get_deploy_tags()
 
 # Check the return code & whether at least two sync tags were
 # returned
-if proc.returncode:
-raise SartorisError(message=exit_codes[6], exit_code=6)
-elif len(sync_tags) < 2:
+if len(tags) < 2:
 raise SartorisError(message=exit_codes[7], exit_code=7)
 
 # Get the associated commit hashes for those tags
-sha_1 = self._get_commit_sha_for_tag(sync_tags[0])
-sha_2 = self._get_commit_sha_for_tag(sync_tags[1])
+sha_1 = self._get_commit_sha_for_tag(tags[0])
+sha_2 = self._get_commit_sha_for_tag(tags[1])
 
 # Produce the diff
 # @TODO replace with dulwich

-- 
To view, visit https://gerrit.wikimedia.org/r/88004
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icd2d077ce60aaea9304f0ba5bfa0855f1f8b0b71
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - _dulwich_get_tags returns OrderedDict, log_deploys logic. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - _dulwich_get_tags returns OrderedDict, log_deploys logic.
..


fix - _dulwich_get_tags returns OrderedDict, log_deploys logic.

Change-Id: Icc7ce14af43c3b80958794e55c549ae3953ba47d
---
M sartoris/sartoris.py
1 file changed, 20 insertions(+), 9 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index ddb8bcd..9686a16 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -19,6 +19,7 @@
 import subprocess
 from time import time
 from datetime import datetime
+from collections import OrderedDict
 
 from dulwich.repo import Repo
 from dulwich.objects import Tag, Commit, parse_timezone
@@ -251,7 +252,21 @@
 """
 _repo = Repo(self.config['top_dir'])
 tags = _repo.refs.as_dict("refs/tags")
-return tags
+tag_keys = tags.keys()
+commits = [commit for _, commit in tags.iteritems()]
+
+# Reorder list by commit time
+# TODO - this is a non dulwich dependency, refactor this to
+# TODO (cont.) - use timestamps from the repo
+#
+ordered_tags = OrderedDict()
+
+for commit in self._git_commit_list():
+if commit in commits:
+index = commits.index(commit)
+ordered_tags[tag_keys[index]] = commit
+
+return ordered_tags
 
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
@@ -573,20 +588,16 @@
 # Pull last 'num_tags' sync tags
 # Reverse the tags since the later ones will appear further down
 tags = self._dulwich_get_tags().keys()
-tags.reverse()
 
 # Filter only matched deploy tags
-f = lambda x: not search(self.config['user'] + '-', x)
+f = lambda x: search(self.config['user'] + '-', x)
 tags = filter(f, tags)
-if num_tags < len(tags):
+
+if num_tags <= len(tags):
 tags = tags[:num_tags]
 
 for tag in tags:
-if not num_tags:
-break
-if search(r'sync', tag):
-print tag
-num_tags -= 1
+print tag
 return 0
 
 def diff(self, _):

-- 
To view, visit https://gerrit.wikimedia.org/r/87997
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icc7ce14af43c3b80958794e55c549ae3953ba47d
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - _dulwich_get_tags returns OrderedDict, log_deploys logic. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87997


Change subject: fix - _dulwich_get_tags returns OrderedDict, log_deploys logic.
..

fix - _dulwich_get_tags returns OrderedDict, log_deploys logic.

Change-Id: Icc7ce14af43c3b80958794e55c549ae3953ba47d
---
M sartoris/sartoris.py
1 file changed, 20 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/97/87997/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index ddb8bcd..9686a16 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -19,6 +19,7 @@
 import subprocess
 from time import time
 from datetime import datetime
+from collections import OrderedDict
 
 from dulwich.repo import Repo
 from dulwich.objects import Tag, Commit, parse_timezone
@@ -251,7 +252,21 @@
 """
 _repo = Repo(self.config['top_dir'])
 tags = _repo.refs.as_dict("refs/tags")
-return tags
+tag_keys = tags.keys()
+commits = [commit for _, commit in tags.iteritems()]
+
+# Reorder list by commit time
+# TODO - this is a non dulwich dependency, refactor this to
+# TODO (cont.) - use timestamps from the repo
+#
+ordered_tags = OrderedDict()
+
+for commit in self._git_commit_list():
+if commit in commits:
+index = commits.index(commit)
+ordered_tags[tag_keys[index]] = commit
+
+return ordered_tags
 
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
@@ -573,20 +588,16 @@
 # Pull last 'num_tags' sync tags
 # Reverse the tags since the later ones will appear further down
 tags = self._dulwich_get_tags().keys()
-tags.reverse()
 
 # Filter only matched deploy tags
-f = lambda x: not search(self.config['user'] + '-', x)
+f = lambda x: search(self.config['user'] + '-', x)
 tags = filter(f, tags)
-if num_tags < len(tags):
+
+if num_tags <= len(tags):
 tags = tags[:num_tags]
 
 for tag in tags:
-if not num_tags:
-break
-if search(r'sync', tag):
-print tag
-num_tags -= 1
+print tag
 return 0
 
 def diff(self, _):

-- 
To view, visit https://gerrit.wikimedia.org/r/87997
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc7ce14af43c3b80958794e55c549ae3953ba47d
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - mask unused 'args'. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - mask unused 'args'.
..


mod - mask unused 'args'.

Change-Id: I685af1482ab7d9b8f9497d74bf77a280ccb3a85a
---
M sartoris/sartoris.py
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 1283a14..ddb8bcd 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -291,7 +291,7 @@
 if proc.returncode != 0:
 raise SartorisError(message=exit_codes[33], exit_code=33)
 
-def start(self, args):
+def start(self, _):
 """
 * write a lock file
 * add a start tag
@@ -305,7 +305,7 @@
 
 return 0
 
-def abort(self, args):
+def abort(self, _):
 """
 * reset state back to start tag
 * remove lock file
@@ -552,7 +552,7 @@
 """
 pass
 
-def show_tag(self, args):
+def show_tag(self, _):
 """
 * display latest deploy tag
 """
@@ -572,12 +572,12 @@
 
 # Pull last 'num_tags' sync tags
 # Reverse the tags since the later ones will appear further down
-tags = self._dulwich_get_tags()
+tags = self._dulwich_get_tags().keys()
 tags.reverse()
 
 # Filter only matched deploy tags
 f = lambda x: not search(self.config['user'] + '-', x)
-tags = filter(tags, f)
+tags = filter(f, tags)
 if num_tags < len(tags):
 tags = tags[:num_tags]
 
@@ -589,7 +589,7 @@
 num_tags -= 1
 return 0
 
-def diff(self, args):
+def diff(self, _):
 """
 * show a git diff of the last deploy and it's previous deploy
 """

-- 
To view, visit https://gerrit.wikimedia.org/r/87991
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I685af1482ab7d9b8f9497d74bf77a280ccb3a85a
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - log_deploys, use _dulwich_get_tags, rework logic. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87990


Change subject: mod - log_deploys, use _dulwich_get_tags, rework logic.
..

mod - log_deploys, use _dulwich_get_tags, rework logic.

Change-Id: I138bad7b6ed64fd7696150e349819cffbaf4796c
---
M sartoris/sartoris.py
1 file changed, 8 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/90/87990/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 0ed012e..1283a14 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -570,14 +570,17 @@
 except NameError:
 raise SartorisError(message=exit_codes[10], exit_code=10)
 
-# Get tags for project
-proc = subprocess.Popen("git tag".split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
 # Pull last 'num_tags' sync tags
 # Reverse the tags since the later ones will appear further down
-tags = proc.communicate()[0].split('\n')
+tags = self._dulwich_get_tags()
 tags.reverse()
+
+# Filter only matched deploy tags
+f = lambda x: not search(self.config['user'] + '-', x)
+tags = filter(tags, f)
+if num_tags < len(tags):
+tags = tags[:num_tags]
+
 for tag in tags:
 if not num_tags:
 break

-- 
To view, visit https://gerrit.wikimedia.org/r/87990
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I138bad7b6ed64fd7696150e349819cffbaf4796c
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - show_tag. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87989


Change subject: fix - show_tag.
..

fix - show_tag.

Change-Id: I20ca6e1fdf98002d20c18f0c58eaa0fec1062715
---
M sartoris/sartoris.py
1 file changed, 2 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/89/87989/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 160d29d..0ed012e 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -169,19 +169,7 @@
 """ Returns the latest tag containing 'sync'
 Sets self._tag to tag string
 """
-proc = subprocess.Popen("git tag".split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
-self._tag = None
-for line_out in proc.communicate()[0].split('\n'):
-if search(r'sync', line_out):
-self._tag = line_out
-
-if proc.returncode:
-raise SartorisError(message=exit_codes[8], exit_code=8)
-elif not self._tag:
-raise SartorisError(message=exit_codes[8], exit_code=8)
-return 0
+return self._dulwich_get_tags().keys()[-1]
 
 def _dulwich_tag(self, tag, author, message=DEFAULT_TAG_MSG):
 """
@@ -569,8 +557,7 @@
 * display latest deploy tag
 """
 # Get latest "sync" tag - sets self._tag
-self._get_latest_deploy_tag()
-print self._tag
+print self._get_latest_deploy_tag()
 return 0
 
 def log_deploys(self, args):

-- 
To view, visit https://gerrit.wikimedia.org/r/87989
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I20ca6e1fdf98002d20c18f0c58eaa0fec1062715
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - log_deploys, use _dulwich_get_tags, rework logic. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - log_deploys, use _dulwich_get_tags, rework logic.
..


mod - log_deploys, use _dulwich_get_tags, rework logic.

Change-Id: I138bad7b6ed64fd7696150e349819cffbaf4796c
---
M sartoris/sartoris.py
1 file changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 0ed012e..1283a14 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -570,14 +570,17 @@
 except NameError:
 raise SartorisError(message=exit_codes[10], exit_code=10)
 
-# Get tags for project
-proc = subprocess.Popen("git tag".split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
 # Pull last 'num_tags' sync tags
 # Reverse the tags since the later ones will appear further down
-tags = proc.communicate()[0].split('\n')
+tags = self._dulwich_get_tags()
 tags.reverse()
+
+# Filter only matched deploy tags
+f = lambda x: not search(self.config['user'] + '-', x)
+tags = filter(tags, f)
+if num_tags < len(tags):
+tags = tags[:num_tags]
+
 for tag in tags:
 if not num_tags:
 break

-- 
To view, visit https://gerrit.wikimedia.org/r/87990
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I138bad7b6ed64fd7696150e349819cffbaf4796c
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - mask unused 'args'. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87991


Change subject: mod - mask unused 'args'.
..

mod - mask unused 'args'.

Change-Id: I685af1482ab7d9b8f9497d74bf77a280ccb3a85a
---
M sartoris/sartoris.py
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/91/87991/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 1283a14..ddb8bcd 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -291,7 +291,7 @@
 if proc.returncode != 0:
 raise SartorisError(message=exit_codes[33], exit_code=33)
 
-def start(self, args):
+def start(self, _):
 """
 * write a lock file
 * add a start tag
@@ -305,7 +305,7 @@
 
 return 0
 
-def abort(self, args):
+def abort(self, _):
 """
 * reset state back to start tag
 * remove lock file
@@ -552,7 +552,7 @@
 """
 pass
 
-def show_tag(self, args):
+def show_tag(self, _):
 """
 * display latest deploy tag
 """
@@ -572,12 +572,12 @@
 
 # Pull last 'num_tags' sync tags
 # Reverse the tags since the later ones will appear further down
-tags = self._dulwich_get_tags()
+tags = self._dulwich_get_tags().keys()
 tags.reverse()
 
 # Filter only matched deploy tags
 f = lambda x: not search(self.config['user'] + '-', x)
-tags = filter(tags, f)
+tags = filter(f, tags)
 if num_tags < len(tags):
 tags = tags[:num_tags]
 
@@ -589,7 +589,7 @@
 num_tags -= 1
 return 0
 
-def diff(self, args):
+def diff(self, _):
 """
 * show a git diff of the last deploy and it's previous deploy
 """

-- 
To view, visit https://gerrit.wikimedia.org/r/87991
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I685af1482ab7d9b8f9497d74bf77a280ccb3a85a
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - show_tag. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - show_tag.
..


fix - show_tag.

Change-Id: I20ca6e1fdf98002d20c18f0c58eaa0fec1062715
---
M sartoris/sartoris.py
1 file changed, 2 insertions(+), 15 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 160d29d..0ed012e 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -169,19 +169,7 @@
 """ Returns the latest tag containing 'sync'
 Sets self._tag to tag string
 """
-proc = subprocess.Popen("git tag".split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
-self._tag = None
-for line_out in proc.communicate()[0].split('\n'):
-if search(r'sync', line_out):
-self._tag = line_out
-
-if proc.returncode:
-raise SartorisError(message=exit_codes[8], exit_code=8)
-elif not self._tag:
-raise SartorisError(message=exit_codes[8], exit_code=8)
-return 0
+return self._dulwich_get_tags().keys()[-1]
 
 def _dulwich_tag(self, tag, author, message=DEFAULT_TAG_MSG):
 """
@@ -569,8 +557,7 @@
 * display latest deploy tag
 """
 # Get latest "sync" tag - sets self._tag
-self._get_latest_deploy_tag()
-print self._tag
+print self._get_latest_deploy_tag()
 return 0
 
 def log_deploys(self, args):

-- 
To view, visit https://gerrit.wikimedia.org/r/87989
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I20ca6e1fdf98002d20c18f0c58eaa0fec1062715
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add/mod - _dulwich_get_tags method / utilize get tags in rev... - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add/mod - _dulwich_get_tags method / utilize get tags in 
revert, add syncing.
..


add/mod - _dulwich_get_tags method / utilize get tags in revert, add syncing.

Change-Id: I178d708fb10fbd253a4ad431c58bce61aa3fc972
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 24 insertions(+), 14 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/config.py b/sartoris/config.py
index 41524b8..17c939b 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -57,6 +57,7 @@
 33: 'git revert failed. Exiting.',
 34: 'git log failed. Exiting.',
 35: 'Revert failed, could not find tag. Exiting.',
+36: 'Not enough tags (<2) to revert on. Exiting.',
 40: 'Failed to run sync script. Exiting.',
 50: 'Failed to read the .deploy file. Exiting.',
 60: 'Invalid git deploy action. Exiting.',
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 51580c4..b9ae24f 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -257,6 +257,14 @@
 return list(tree_changes(_repo, index.commit(_repo.object_store),
  _repo['HEAD'].tree))
 
+def _dulwich_get_tags(self):
+"""
+Get all tags & correspondin commit shas
+"""
+_repo = Repo(self.config['top_dir'])
+tags = _repo.refs.as_dict("refs/tags")
+return tags
+
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
 return '{0}-{1}'.format(self.config['user'], timestamp)
@@ -279,7 +287,6 @@
 raise SartorisError(message=exit_codes[34], exit_code=34)
 
 commits = [i.split()[0] for i in proc_out[0][:-1].split('\n')]
-commits.reverse()
 
 return commits
 
@@ -291,7 +298,6 @@
 proc = subprocess.Popen(cmd.split(),
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE)
-
 proc.communicate()
 
 if proc.returncode != 0:
@@ -484,7 +490,7 @@
 'stderr': stderr,
 }
 
-def revert(self, args):
+def revert(self, args, auto_sync=False):
 """
 * write a lock file
 * reset to last or specified tag
@@ -494,19 +500,19 @@
 if not self._check_lock():
 raise SartorisError(message=exit_codes[30])
 
+# This will be the tag on the revert commit
 revert_tag = self._make_tag()
 
 # Extract tag on which to revert
-tag = ''
 if hasattr(args, 'tag'):
 tag = args.tag
 else:
-# revert to last tag
-for item in os.walk(self.config['top_dir'] + '/.git/refs/tags/'):
-if search(r'/.git/refs/tags/', item[0]):
-print item
-tag = item[2][-1]
-break
+# revert to previous to current tag
+repo_tags = self._dulwich_get_tags()
+if len(repo_tags) >= 2:
+tag = repo_tags.keys()[-2]
+else:
+raise SartorisError(message=exit_codes[36], exit_code=36)
 
 # Ensure tag to revert to was set
 if tag == '':
@@ -521,7 +527,7 @@
 #
 
 log.info(__name__ + ' :: revert - Attempting to revert to tag: {0}'.
- format(revert_tag))
+ format(tag))
 
 tag_commit_sha = self._get_commit_sha_for_tag(tag)
 commit_sha = None
@@ -535,10 +541,13 @@
 self._dulwich_reset_to_tag()
 raise SartorisError(message=exit_codes[35], exit_code=35)
 self._dulwich_commit(self._make_author(),
- message='Rollback to {0}.'.format(revert_tag))
+ message='Rollback to {0}.'.format(tag))
 
-log.info(__name__ + ' :: revert - Reverted to tag: {0}'.
- format(revert_tag))
+log.info(__name__ + ' :: revert - Reverted to tag: {0}, '
+'call "git deploy sync" to persist'.format(tag))
+
+if auto_sync:
+self._sync(revert_tag, True)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87987
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I178d708fb10fbd253a4ad431c58bce61aa3fc972
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - logging for revert. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - logging for revert.
..


add - logging for revert.

Change-Id: I596439f77b1d73a630cec25c886b690f64e74b62
---
M sartoris/sartoris.py
1 file changed, 9 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index d46f382..51580c4 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -504,6 +504,7 @@
 # revert to last tag
 for item in os.walk(self.config['top_dir'] + '/.git/refs/tags/'):
 if search(r'/.git/refs/tags/', item[0]):
+print item
 tag = item[2][-1]
 break
 
@@ -518,6 +519,10 @@
 #   2. perform no-commit reverts
 #   3. commit
 #
+
+log.info(__name__ + ' :: revert - Attempting to revert to tag: {0}'.
+ format(revert_tag))
+
 tag_commit_sha = self._get_commit_sha_for_tag(tag)
 commit_sha = None
 for commit_sha in self._git_commit_list():
@@ -531,6 +536,10 @@
 raise SartorisError(message=exit_codes[35], exit_code=35)
 self._dulwich_commit(self._make_author(),
  message='Rollback to {0}.'.format(revert_tag))
+
+log.info(__name__ + ' :: revert - Reverted to tag: {0}'.
+ format(revert_tag))
+
 return 0
 
 def release(self):

-- 
To view, visit https://gerrit.wikimedia.org/r/87986
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I596439f77b1d73a630cec25c886b690f64e74b62
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - allow auto-syncing on revert. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - allow auto-syncing on revert.
..


add - allow auto-syncing on revert.

Change-Id: I9789f0ea62fe2c8171d3e13567f4480b7815be8e
---
M README.rst
M sartoris/git-deploy
M sartoris/sartoris.py
3 files changed, 12 insertions(+), 6 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index ce2b5c8..d904e68 100644
--- a/README.rst
+++ b/README.rst
@@ -84,7 +84,10 @@
 
 $ git deploy revert [-t ] [opts]
 
-If no tag is supplied the rollback uses the most recent tag.
+If no tag is supplied the rollback uses the most recent tag.  The default is 
to only commit the rollback locally
+however, by suppling the "-a" option for auto-sync the rollback automatically 
syncs also:
+
+$ git deploy revert [-t ] [opts]
 
 Deploy Hooks
 
diff --git a/sartoris/git-deploy b/sartoris/git-deploy
index 836f587..7731dfb 100755
--- a/sartoris/git-deploy
+++ b/sartoris/git-deploy
@@ -58,8 +58,11 @@
 action="store_true",
 help="force the action, bypass sanity checks.")
 parser.add_argument("-t", "--tag",
-default='', type =str,
+default='', type=str,
 help="Specify the tag for the revert action.")
+parser.add_argument("-a", "--auto_sync",
+default='', action="store_true",
+help="Auto sync flag.")
 
 args = parser.parse_args()
 return args
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index b9ae24f..160d29d 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -490,7 +490,7 @@
 'stderr': stderr,
 }
 
-def revert(self, args, auto_sync=False):
+def revert(self, args):
 """
 * write a lock file
 * reset to last or specified tag
@@ -543,11 +543,11 @@
 self._dulwich_commit(self._make_author(),
  message='Rollback to {0}.'.format(tag))
 
-log.info(__name__ + ' :: revert - Reverted to tag: {0}, '
+log.info(__name__ + ' :: revert - Reverted to tag: "{0}", '
 'call "git deploy sync" to persist'.format(tag))
 
-if auto_sync:
-self._sync(revert_tag, True)
+if args.auto_sync:
+return self._sync(revert_tag, args.force)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87988
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9789f0ea62fe2c8171d3e13567f4480b7815be8e
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add/mod - _dulwich_get_tags method / utilize get tags in rev... - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87987


Change subject: add/mod - _dulwich_get_tags method / utilize get tags in 
revert, add syncing.
..

add/mod - _dulwich_get_tags method / utilize get tags in revert, add syncing.

Change-Id: I178d708fb10fbd253a4ad431c58bce61aa3fc972
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 24 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/87/87987/1

diff --git a/sartoris/config.py b/sartoris/config.py
index 41524b8..17c939b 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -57,6 +57,7 @@
 33: 'git revert failed. Exiting.',
 34: 'git log failed. Exiting.',
 35: 'Revert failed, could not find tag. Exiting.',
+36: 'Not enough tags (<2) to revert on. Exiting.',
 40: 'Failed to run sync script. Exiting.',
 50: 'Failed to read the .deploy file. Exiting.',
 60: 'Invalid git deploy action. Exiting.',
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 51580c4..b9ae24f 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -257,6 +257,14 @@
 return list(tree_changes(_repo, index.commit(_repo.object_store),
  _repo['HEAD'].tree))
 
+def _dulwich_get_tags(self):
+"""
+Get all tags & correspondin commit shas
+"""
+_repo = Repo(self.config['top_dir'])
+tags = _repo.refs.as_dict("refs/tags")
+return tags
+
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
 return '{0}-{1}'.format(self.config['user'], timestamp)
@@ -279,7 +287,6 @@
 raise SartorisError(message=exit_codes[34], exit_code=34)
 
 commits = [i.split()[0] for i in proc_out[0][:-1].split('\n')]
-commits.reverse()
 
 return commits
 
@@ -291,7 +298,6 @@
 proc = subprocess.Popen(cmd.split(),
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE)
-
 proc.communicate()
 
 if proc.returncode != 0:
@@ -484,7 +490,7 @@
 'stderr': stderr,
 }
 
-def revert(self, args):
+def revert(self, args, auto_sync=False):
 """
 * write a lock file
 * reset to last or specified tag
@@ -494,19 +500,19 @@
 if not self._check_lock():
 raise SartorisError(message=exit_codes[30])
 
+# This will be the tag on the revert commit
 revert_tag = self._make_tag()
 
 # Extract tag on which to revert
-tag = ''
 if hasattr(args, 'tag'):
 tag = args.tag
 else:
-# revert to last tag
-for item in os.walk(self.config['top_dir'] + '/.git/refs/tags/'):
-if search(r'/.git/refs/tags/', item[0]):
-print item
-tag = item[2][-1]
-break
+# revert to previous to current tag
+repo_tags = self._dulwich_get_tags()
+if len(repo_tags) >= 2:
+tag = repo_tags.keys()[-2]
+else:
+raise SartorisError(message=exit_codes[36], exit_code=36)
 
 # Ensure tag to revert to was set
 if tag == '':
@@ -521,7 +527,7 @@
 #
 
 log.info(__name__ + ' :: revert - Attempting to revert to tag: {0}'.
- format(revert_tag))
+ format(tag))
 
 tag_commit_sha = self._get_commit_sha_for_tag(tag)
 commit_sha = None
@@ -535,10 +541,13 @@
 self._dulwich_reset_to_tag()
 raise SartorisError(message=exit_codes[35], exit_code=35)
 self._dulwich_commit(self._make_author(),
- message='Rollback to {0}.'.format(revert_tag))
+ message='Rollback to {0}.'.format(tag))
 
-log.info(__name__ + ' :: revert - Reverted to tag: {0}'.
- format(revert_tag))
+log.info(__name__ + ' :: revert - Reverted to tag: {0}, '
+'call "git deploy sync" to persist'.format(tag))
+
+if auto_sync:
+self._sync(revert_tag, True)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87987
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I178d708fb10fbd253a4ad431c58bce61aa3fc972
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - allow auto-syncing on revert. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87988


Change subject: add - allow auto-syncing on revert.
..

add - allow auto-syncing on revert.

Change-Id: I9789f0ea62fe2c8171d3e13567f4480b7815be8e
---
M README.rst
M sartoris/git-deploy
M sartoris/sartoris.py
3 files changed, 12 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/88/87988/1

diff --git a/README.rst b/README.rst
index ce2b5c8..d904e68 100644
--- a/README.rst
+++ b/README.rst
@@ -84,7 +84,10 @@
 
 $ git deploy revert [-t ] [opts]
 
-If no tag is supplied the rollback uses the most recent tag.
+If no tag is supplied the rollback uses the most recent tag.  The default is 
to only commit the rollback locally
+however, by suppling the "-a" option for auto-sync the rollback automatically 
syncs also:
+
+$ git deploy revert [-t ] [opts]
 
 Deploy Hooks
 
diff --git a/sartoris/git-deploy b/sartoris/git-deploy
index 836f587..7731dfb 100755
--- a/sartoris/git-deploy
+++ b/sartoris/git-deploy
@@ -58,8 +58,11 @@
 action="store_true",
 help="force the action, bypass sanity checks.")
 parser.add_argument("-t", "--tag",
-default='', type =str,
+default='', type=str,
 help="Specify the tag for the revert action.")
+parser.add_argument("-a", "--auto_sync",
+default='', action="store_true",
+help="Auto sync flag.")
 
 args = parser.parse_args()
 return args
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index b9ae24f..160d29d 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -490,7 +490,7 @@
 'stderr': stderr,
 }
 
-def revert(self, args, auto_sync=False):
+def revert(self, args):
 """
 * write a lock file
 * reset to last or specified tag
@@ -543,11 +543,11 @@
 self._dulwich_commit(self._make_author(),
  message='Rollback to {0}.'.format(tag))
 
-log.info(__name__ + ' :: revert - Reverted to tag: {0}, '
+log.info(__name__ + ' :: revert - Reverted to tag: "{0}", '
 'call "git deploy sync" to persist'.format(tag))
 
-if auto_sync:
-self._sync(revert_tag, True)
+if args.auto_sync:
+return self._sync(revert_tag, args.force)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87988
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9789f0ea62fe2c8171d3e13567f4480b7815be8e
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - logging for revert. - change (sartoris)

2013-10-06 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87986


Change subject: add - logging for revert.
..

add - logging for revert.

Change-Id: I596439f77b1d73a630cec25c886b690f64e74b62
---
M sartoris/sartoris.py
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/86/87986/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index d46f382..51580c4 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -504,6 +504,7 @@
 # revert to last tag
 for item in os.walk(self.config['top_dir'] + '/.git/refs/tags/'):
 if search(r'/.git/refs/tags/', item[0]):
+print item
 tag = item[2][-1]
 break
 
@@ -518,6 +519,10 @@
 #   2. perform no-commit reverts
 #   3. commit
 #
+
+log.info(__name__ + ' :: revert - Attempting to revert to tag: {0}'.
+ format(revert_tag))
+
 tag_commit_sha = self._get_commit_sha_for_tag(tag)
 commit_sha = None
 for commit_sha in self._git_commit_list():
@@ -531,6 +536,10 @@
 raise SartorisError(message=exit_codes[35], exit_code=35)
 self._dulwich_commit(self._make_author(),
  message='Rollback to {0}.'.format(revert_tag))
+
+log.info(__name__ + ' :: revert - Reverted to tag: {0}'.
+ format(revert_tag))
+
 return 0
 
 def release(self):

-- 
To view, visit https://gerrit.wikimedia.org/r/87986
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I596439f77b1d73a630cec25c886b690f64e74b62
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add/fix - _git_revert / revert functionality. - change (sartoris)

2013-10-05 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add/fix - _git_revert / revert functionality.
..


add/fix - _git_revert / revert functionality.

Change-Id: Idcc74c76a12e15c85c2d3853810562cbb8f300bd
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 36 insertions(+), 12 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/sartoris/config.py b/sartoris/config.py
index 410277c..e5d4c95 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -54,6 +54,8 @@
 30: 'No deploy started. Please run: git deploy start',
 31: 'Failed to write tag on sync. Exiting.',
 32: 'Failed to write the .deploy file. Exiting.',
+33: 'git revert failed. Exiting.',
+34: 'git log failed. Exiting.',
 40: 'Failed to run sync script. Exiting.',
 50: 'Failed to read the .deploy file. Exiting.',
 60: 'Invalid git deploy action. Exiting.',
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 850b07f..21b2a11 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -268,10 +268,29 @@
 proc = subprocess.Popen(cmd.split(),
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE)
-commits = [i.split()[0] for i in 
proc.communicate()[0][:-1].split('\n')]
+proc_out = proc.communicate()
+
+if proc.returncode != 0:
+raise SartorisError(message=exit_codes[34], exit_code=34)
+
+commits = [i.split()[0] for i in proc_out[0][:-1].split('\n')]
 commits.reverse()
 
 return commits
+
+def _git_revert(self, commit_sha):
+"""
+Perform a no-commit revert
+"""
+cmd = 'git revert --no-commit {0}'.format(commit_sha)
+proc = subprocess.Popen(cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+
+proc.communicate()
+
+if proc.returncode != 0:
+raise SartorisError(message=exit_codes[33], exit_code=33)
 
 def start(self, args):
 """
@@ -487,17 +506,20 @@
 if tag == '':
 raise SartorisError(message=exit_codes[13], exit_code=13)
 
-# Reset the HEAD
-self._dulwich_reset_to_tag(tag)
-
-# Add changes to staging
-self._dulwich_stage_all()
-
-# Commit
-self._dulwich_commit(self._make_author())
-
-# Sync to reset HEAD
-self._sync(revert_tag, args.force)
+#
+# Rollback to tag:
+#
+#   1. get a commit list
+#   2. perform no-commit reverts
+#   3. commit
+#
+tag_commit_sha = self._get_commit_sha_for_tag(tag)
+for commit_sha in self._git_commit_list():
+if commit_sha == tag_commit_sha:
+break
+self._git_revert(commit_sha)
+self._dulwich_commit(self._make_author(),
+ message='Rollback to {0}.'.format(tag))
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87658
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idcc74c76a12e15c85c2d3853810562cbb8f300bd
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - ensure that commit sha matches tag commit sha on rollb... - change (sartoris)

2013-10-05 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - ensure that commit sha matches tag commit sha on rollback 
/ make _dulwich_reset_to_tag default reset to HEAD.
..


mod - ensure that commit sha matches tag commit sha on rollback / make 
_dulwich_reset_to_tag default reset to HEAD.

Change-Id: I0783f330e0c3bb6b30f6ee430e82fc967e0b5942
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 15 insertions(+), 4 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/config.py b/sartoris/config.py
index e5d4c95..41524b8 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -56,6 +56,7 @@
 32: 'Failed to write the .deploy file. Exiting.',
 33: 'git revert failed. Exiting.',
 34: 'git log failed. Exiting.',
+35: 'Revert failed, could not find tag. Exiting.',
 40: 'Failed to run sync script. Exiting.',
 50: 'Failed to read the .deploy file. Exiting.',
 60: 'Invalid git deploy action. Exiting.',
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 21b2a11..d46f382 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -208,14 +208,19 @@
 _repo.object_store.add_object(tag_obj)
 _repo['refs/tags/' + tag] = tag_obj.id
 
-def _dulwich_reset_to_tag(self, tag):
+def _dulwich_reset_to_tag(self, tag=None):
 """
 Resets the HEAD to the commit
 """
 _repo = Repo(self.config['top_dir'])
 
+if not tag:
+sha = _repo.head()
+else:
+sha = self._get_commit_sha_for_tag(tag)
+
 try:
-_repo.refs['HEAD'] = self._get_commit_sha_for_tag(tag)
+_repo.refs['HEAD'] = sha
 except AttributeError:
 raise SartorisError(message=exit_codes[7], exit_code=7)
 
@@ -514,13 +519,18 @@
 #   3. commit
 #
 tag_commit_sha = self._get_commit_sha_for_tag(tag)
+commit_sha = None
 for commit_sha in self._git_commit_list():
 if commit_sha == tag_commit_sha:
 break
 self._git_revert(commit_sha)
-self._dulwich_commit(self._make_author(),
- message='Rollback to {0}.'.format(tag))
 
+# Ensure the commit tag was matched
+if commit_sha != tag_commit_sha or not commit_sha:
+self._dulwich_reset_to_tag()
+raise SartorisError(message=exit_codes[35], exit_code=35)
+self._dulwich_commit(self._make_author(),
+ message='Rollback to {0}.'.format(revert_tag))
 return 0
 
 def release(self):

-- 
To view, visit https://gerrit.wikimedia.org/r/87660
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0783f330e0c3bb6b30f6ee430e82fc967e0b5942
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - update readme. - change (sartoris)

2013-10-05 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - update readme.
..


mod - update readme.

Change-Id: I1199f687496e3e96d472242308d9bb2a04bdbff3
---
M README.rst
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index ed686c7..ce2b5c8 100644
--- a/README.rst
+++ b/README.rst
@@ -80,6 +80,11 @@
 
 $ git deploy abort [opts]
 
+You can rollback to a tag with the revert call:
+
+$ git deploy revert [-t ] [opts]
+
+If no tag is supplied the rollback uses the most recent tag.
 
 Deploy Hooks
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87659
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1199f687496e3e96d472242308d9bb2a04bdbff3
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - methods _git_commit_list, _dulwich_status. - change (sartoris)

2013-10-05 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - methods _git_commit_list, _dulwich_status.
..


add - methods _git_commit_list, _dulwich_status.

Change-Id: Idd4e91adbb49a02d81a8151f3b673f268d7c0e98
---
M sartoris/sartoris.py
1 file changed, 24 insertions(+), 1 deletion(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 7f49428..850b07f 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -22,6 +22,7 @@
 
 from dulwich.repo import Repo
 from dulwich.objects import Tag, Commit, parse_timezone
+from dulwich.diff_tree import tree_changes
 
 from config import log, configure, exit_codes, DEFAULT_CLIENT_HOOK, \
 DEFAULT_TARGET_HOOK
@@ -214,7 +215,7 @@
 _repo = Repo(self.config['top_dir'])
 
 try:
-_repo.refs['HEAD'] = _repo['refs/tags/' + tag].id
+_repo.refs['HEAD'] = self._get_commit_sha_for_tag(tag)
 except AttributeError:
 raise SartorisError(message=exit_codes[7], exit_code=7)
 
@@ -242,6 +243,15 @@
 if not _repo.head() == commit_id:
 raise SartorisError(message=exit_codes[14], exit_code=14)
 
+def _dulwich_status(self):
+"""
+Return the git status
+"""
+_repo = Repo(self.config['top_dir'])
+index = _repo.open_index()
+return list(tree_changes(_repo, index.commit(_repo.object_store),
+ _repo['HEAD'].tree))
+
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
 return '{0}-{1}'.format(self.config['user'], timestamp)
@@ -250,6 +260,19 @@
 return '{0} <{1}>'.format(self.config['user.name'],
   self.config['user.email'])
 
+def _git_commit_list(self):
+"""
+Generate an in-order list of commits
+"""
+cmd = 'git log --pretty=oneline'
+proc = subprocess.Popen(cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+commits = [i.split()[0] for i in 
proc.communicate()[0][:-1].split('\n')]
+commits.reverse()
+
+return commits
+
 def start(self, args):
 """
 * write a lock file

-- 
To view, visit https://gerrit.wikimedia.org/r/87657
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idd4e91adbb49a02d81a8151f3b673f268d7c0e98
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - update readme. - change (sartoris)

2013-10-05 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87659


Change subject: mod - update readme.
..

mod - update readme.

Change-Id: I1199f687496e3e96d472242308d9bb2a04bdbff3
---
M README.rst
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/59/87659/1

diff --git a/README.rst b/README.rst
index ed686c7..ce2b5c8 100644
--- a/README.rst
+++ b/README.rst
@@ -80,6 +80,11 @@
 
 $ git deploy abort [opts]
 
+You can rollback to a tag with the revert call:
+
+$ git deploy revert [-t ] [opts]
+
+If no tag is supplied the rollback uses the most recent tag.
 
 Deploy Hooks
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87659
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1199f687496e3e96d472242308d9bb2a04bdbff3
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - ensure that commit sha matches tag commit sha on rollb... - change (sartoris)

2013-10-05 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87660


Change subject: mod - ensure that commit sha matches tag commit sha on rollback 
/ make _dulwich_reset_to_tag default reset to HEAD.
..

mod - ensure that commit sha matches tag commit sha on rollback / make 
_dulwich_reset_to_tag default reset to HEAD.

Change-Id: I0783f330e0c3bb6b30f6ee430e82fc967e0b5942
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 15 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/60/87660/1

diff --git a/sartoris/config.py b/sartoris/config.py
index e5d4c95..41524b8 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -56,6 +56,7 @@
 32: 'Failed to write the .deploy file. Exiting.',
 33: 'git revert failed. Exiting.',
 34: 'git log failed. Exiting.',
+35: 'Revert failed, could not find tag. Exiting.',
 40: 'Failed to run sync script. Exiting.',
 50: 'Failed to read the .deploy file. Exiting.',
 60: 'Invalid git deploy action. Exiting.',
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 21b2a11..d46f382 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -208,14 +208,19 @@
 _repo.object_store.add_object(tag_obj)
 _repo['refs/tags/' + tag] = tag_obj.id
 
-def _dulwich_reset_to_tag(self, tag):
+def _dulwich_reset_to_tag(self, tag=None):
 """
 Resets the HEAD to the commit
 """
 _repo = Repo(self.config['top_dir'])
 
+if not tag:
+sha = _repo.head()
+else:
+sha = self._get_commit_sha_for_tag(tag)
+
 try:
-_repo.refs['HEAD'] = self._get_commit_sha_for_tag(tag)
+_repo.refs['HEAD'] = sha
 except AttributeError:
 raise SartorisError(message=exit_codes[7], exit_code=7)
 
@@ -514,13 +519,18 @@
 #   3. commit
 #
 tag_commit_sha = self._get_commit_sha_for_tag(tag)
+commit_sha = None
 for commit_sha in self._git_commit_list():
 if commit_sha == tag_commit_sha:
 break
 self._git_revert(commit_sha)
-self._dulwich_commit(self._make_author(),
- message='Rollback to {0}.'.format(tag))
 
+# Ensure the commit tag was matched
+if commit_sha != tag_commit_sha or not commit_sha:
+self._dulwich_reset_to_tag()
+raise SartorisError(message=exit_codes[35], exit_code=35)
+self._dulwich_commit(self._make_author(),
+ message='Rollback to {0}.'.format(revert_tag))
 return 0
 
 def release(self):

-- 
To view, visit https://gerrit.wikimedia.org/r/87660
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0783f330e0c3bb6b30f6ee430e82fc967e0b5942
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add/fix - _git_revert / revert functionality. - change (sartoris)

2013-10-05 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87658


Change subject: add/fix - _git_revert / revert functionality.
..

add/fix - _git_revert / revert functionality.

Change-Id: Idcc74c76a12e15c85c2d3853810562cbb8f300bd
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 36 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/58/87658/1

diff --git a/sartoris/config.py b/sartoris/config.py
index 410277c..e5d4c95 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -54,6 +54,8 @@
 30: 'No deploy started. Please run: git deploy start',
 31: 'Failed to write tag on sync. Exiting.',
 32: 'Failed to write the .deploy file. Exiting.',
+33: 'git revert failed. Exiting.',
+34: 'git log failed. Exiting.',
 40: 'Failed to run sync script. Exiting.',
 50: 'Failed to read the .deploy file. Exiting.',
 60: 'Invalid git deploy action. Exiting.',
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 850b07f..21b2a11 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -268,10 +268,29 @@
 proc = subprocess.Popen(cmd.split(),
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE)
-commits = [i.split()[0] for i in 
proc.communicate()[0][:-1].split('\n')]
+proc_out = proc.communicate()
+
+if proc.returncode != 0:
+raise SartorisError(message=exit_codes[34], exit_code=34)
+
+commits = [i.split()[0] for i in proc_out[0][:-1].split('\n')]
 commits.reverse()
 
 return commits
+
+def _git_revert(self, commit_sha):
+"""
+Perform a no-commit revert
+"""
+cmd = 'git revert --no-commit {0}'.format(commit_sha)
+proc = subprocess.Popen(cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+
+proc.communicate()
+
+if proc.returncode != 0:
+raise SartorisError(message=exit_codes[33], exit_code=33)
 
 def start(self, args):
 """
@@ -487,17 +506,20 @@
 if tag == '':
 raise SartorisError(message=exit_codes[13], exit_code=13)
 
-# Reset the HEAD
-self._dulwich_reset_to_tag(tag)
-
-# Add changes to staging
-self._dulwich_stage_all()
-
-# Commit
-self._dulwich_commit(self._make_author())
-
-# Sync to reset HEAD
-self._sync(revert_tag, args.force)
+#
+# Rollback to tag:
+#
+#   1. get a commit list
+#   2. perform no-commit reverts
+#   3. commit
+#
+tag_commit_sha = self._get_commit_sha_for_tag(tag)
+for commit_sha in self._git_commit_list():
+if commit_sha == tag_commit_sha:
+break
+self._git_revert(commit_sha)
+self._dulwich_commit(self._make_author(),
+ message='Rollback to {0}.'.format(tag))
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/87658
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idcc74c76a12e15c85c2d3853810562cbb8f300bd
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - methods _git_commit_list, _dulwich_status. - change (sartoris)

2013-10-05 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87657


Change subject: add - methods _git_commit_list, _dulwich_status.
..

add - methods _git_commit_list, _dulwich_status.

Change-Id: Idd4e91adbb49a02d81a8151f3b673f268d7c0e98
---
M sartoris/sartoris.py
1 file changed, 24 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/57/87657/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 7f49428..850b07f 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -22,6 +22,7 @@
 
 from dulwich.repo import Repo
 from dulwich.objects import Tag, Commit, parse_timezone
+from dulwich.diff_tree import tree_changes
 
 from config import log, configure, exit_codes, DEFAULT_CLIENT_HOOK, \
 DEFAULT_TARGET_HOOK
@@ -214,7 +215,7 @@
 _repo = Repo(self.config['top_dir'])
 
 try:
-_repo.refs['HEAD'] = _repo['refs/tags/' + tag].id
+_repo.refs['HEAD'] = self._get_commit_sha_for_tag(tag)
 except AttributeError:
 raise SartorisError(message=exit_codes[7], exit_code=7)
 
@@ -242,6 +243,15 @@
 if not _repo.head() == commit_id:
 raise SartorisError(message=exit_codes[14], exit_code=14)
 
+def _dulwich_status(self):
+"""
+Return the git status
+"""
+_repo = Repo(self.config['top_dir'])
+index = _repo.open_index()
+return list(tree_changes(_repo, index.commit(_repo.object_store),
+ _repo['HEAD'].tree))
+
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
 return '{0}-{1}'.format(self.config['user'], timestamp)
@@ -250,6 +260,19 @@
 return '{0} <{1}>'.format(self.config['user.name'],
   self.config['user.email'])
 
+def _git_commit_list(self):
+"""
+Generate an in-order list of commits
+"""
+cmd = 'git log --pretty=oneline'
+proc = subprocess.Popen(cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+commits = [i.split()[0] for i in 
proc.communicate()[0][:-1].split('\n')]
+commits.reverse()
+
+return commits
+
 def start(self, args):
 """
 * write a lock file

-- 
To view, visit https://gerrit.wikimedia.org/r/87657
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd4e91adbb49a02d81a8151f3b673f268d7c0e98
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - staging files in _dulwich_stage_all. - change (sartoris)

2013-10-04 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - staging files in _dulwich_stage_all.
..


fix - staging files in _dulwich_stage_all.

Change-Id: I8c7e561a71e2ae849e49d24aee8efb845c84f79f
---
M sartoris/sartoris.py
1 file changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 069a1e1..7f49428 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -25,7 +25,7 @@
 
 from config import log, configure, exit_codes, DEFAULT_CLIENT_HOOK, \
 DEFAULT_TARGET_HOOK
-from config_local import PKEY
+from config_local import PKEY, PROJECT_HOME
 
 
 class SartorisError(Exception):
@@ -226,8 +226,10 @@
 
 # Iterate through files, those modified will be staged
 for elem in os.walk(self.config['top_dir']):
-if not search(r'\./\.git', elem[0]):
-files = [elem[2] + '/' + file for file in elem[2]]
+if not search(r'\.git', elem[0]):
+files = [(elem[0] + '/' + file).split(PROJECT_HOME)[-1]
+ for file in elem[2]]
+log.info(__name__ + ' :: Staging - {0}'.format(files))
 _repo.stage(files)
 
 def _dulwich_commit(self, author, message=DEFAULT_COMMIT_MSG):

-- 
To view, visit https://gerrit.wikimedia.org/r/87651
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8c7e561a71e2ae849e49d24aee8efb845c84f79f
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - staging files in _dulwich_stage_all. - change (sartoris)

2013-10-04 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87651


Change subject: fix - staging files in _dulwich_stage_all.
..

fix - staging files in _dulwich_stage_all.

Change-Id: I8c7e561a71e2ae849e49d24aee8efb845c84f79f
---
M sartoris/sartoris.py
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/51/87651/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 069a1e1..7f49428 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -25,7 +25,7 @@
 
 from config import log, configure, exit_codes, DEFAULT_CLIENT_HOOK, \
 DEFAULT_TARGET_HOOK
-from config_local import PKEY
+from config_local import PKEY, PROJECT_HOME
 
 
 class SartorisError(Exception):
@@ -226,8 +226,10 @@
 
 # Iterate through files, those modified will be staged
 for elem in os.walk(self.config['top_dir']):
-if not search(r'\./\.git', elem[0]):
-files = [elem[2] + '/' + file for file in elem[2]]
+if not search(r'\.git', elem[0]):
+files = [(elem[0] + '/' + file).split(PROJECT_HOME)[-1]
+ for file in elem[2]]
+log.info(__name__ + ' :: Staging - {0}'.format(files))
 _repo.stage(files)
 
 def _dulwich_commit(self, author, message=DEFAULT_COMMIT_MSG):

-- 
To view, visit https://gerrit.wikimedia.org/r/87651
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8c7e561a71e2ae849e49d24aee8efb845c84f79f
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - dulwich staging, stage all files in git. - change (sartoris)

2013-10-01 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - dulwich staging, stage all files in git.
..


mod - dulwich staging, stage all files in git.

Change-Id: I713d1fe133c82ce6c22d67320a112fb2fd16eee8
---
M sartoris/sartoris.py
M scripts/make-release.py
2 files changed, 9 insertions(+), 4 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 41534e9..069a1e1 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -218,12 +218,17 @@
 except AttributeError:
 raise SartorisError(message=exit_codes[7], exit_code=7)
 
-def _dulwich_stage(self, file):
+def _dulwich_stage_all(self):
 """
 Stage modified files in the repo
 """
 _repo = Repo(self.config['top_dir'])
-_repo.stage([file])
+
+# Iterate through files, those modified will be staged
+for elem in os.walk(self.config['top_dir']):
+if not search(r'\./\.git', elem[0]):
+files = [elem[2] + '/' + file for file in elem[2]]
+_repo.stage(files)
 
 def _dulwich_commit(self, author, message=DEFAULT_COMMIT_MSG):
 """
@@ -461,7 +466,7 @@
 self._dulwich_reset_to_tag(tag)
 
 # Add changes to staging
-self._dulwich_stage('*')
+self._dulwich_stage_all()
 
 # Commit
 self._dulwich_commit(self._make_author())
diff --git a/scripts/make-release.py b/scripts/make-release.py
index 3db9df3..5ac7522 100644
--- a/scripts/make-release.py
+++ b/scripts/make-release.py
@@ -27,7 +27,7 @@
 continue
 length = len(match.group(1))
 version = match.group(1).strip()
-if lineiter.next().count('-') != len(match.group(0)):
+if lineiter.next().count('-') != length:
 continue
 while 1:
 change_info = lineiter.next().strip()

-- 
To view, visit https://gerrit.wikimedia.org/r/87043
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I713d1fe133c82ce6c22d67320a112fb2fd16eee8
Gerrit-PatchSet: 2
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - dulwich staging, stage all files in git. - change (sartoris)

2013-10-01 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/87043


Change subject: mod - dulwich staging, stage all files in git.
..

mod - dulwich staging, stage all files in git.

Change-Id: I713d1fe133c82ce6c22d67320a112fb2fd16eee8
---
M sartoris/sartoris.py
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/43/87043/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 41534e9..069a1e1 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -218,12 +218,17 @@
 except AttributeError:
 raise SartorisError(message=exit_codes[7], exit_code=7)
 
-def _dulwich_stage(self, file):
+def _dulwich_stage_all(self):
 """
 Stage modified files in the repo
 """
 _repo = Repo(self.config['top_dir'])
-_repo.stage([file])
+
+# Iterate through files, those modified will be staged
+for elem in os.walk(self.config['top_dir']):
+if not search(r'\./\.git', elem[0]):
+files = [elem[2] + '/' + file for file in elem[2]]
+_repo.stage(files)
 
 def _dulwich_commit(self, author, message=DEFAULT_COMMIT_MSG):
 """
@@ -461,7 +466,7 @@
 self._dulwich_reset_to_tag(tag)
 
 # Add changes to staging
-self._dulwich_stage('*')
+self._dulwich_stage_all()
 
 # Commit
 self._dulwich_commit(self._make_author())

-- 
To view, visit https://gerrit.wikimedia.org/r/87043
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I713d1fe133c82ce6c22d67320a112fb2fd16eee8
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - method _make_author for formatting commiter ID. - change (sartoris)

2013-09-30 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - method _make_author for formatting commiter ID.
..


add - method _make_author for formatting commiter ID.

Change-Id: If38ae1897019cef2cb4215abee66826cf03fcdc8
---
M sartoris/sartoris.py
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 0e22d58..41534e9 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -239,6 +239,10 @@
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
 return '{0}-{1}'.format(self.config['user'], timestamp)
 
+def _make_author(self):
+return '{0} <{1}>'.format(self.config['user.name'],
+  self.config['user.email'])
+
 def start(self, args):
 """
 * write a lock file
@@ -321,10 +325,8 @@
 # In absence of a sync script -- Tag the repo
 log.debug(__name__ + ' :: Calling default sync.')
 
-_author = '{0} <{1}>'.format(self.config['user.name'],
- self.config['user.email'])
 try:
-self._dulwich_tag(tag, _author)
+self._dulwich_tag(tag, self._make_author())
 except Exception as e:
 log.error(str(e))
 raise SartorisError(message=exit_codes[12], exit_code=12)
@@ -462,9 +464,7 @@
 self._dulwich_stage('*')
 
 # Commit
-author = '{0} <{1}>'.format(self.config['user.name'],
-self.config['user.email'])
-self._dulwich_commit(author)
+self._dulwich_commit(self._make_author())
 
 # Sync to reset HEAD
 self._sync(revert_tag, args.force)

-- 
To view, visit https://gerrit.wikimedia.org/r/86808
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If38ae1897019cef2cb4215abee66826cf03fcdc8
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - use dulwich deps in revert. - change (sartoris)

2013-09-30 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86807


Change subject: mod - use dulwich deps in revert.
..

mod - use dulwich deps in revert.

Change-Id: I888f4ae33e9894f17f0b144ee9610bd8d8e0faa3
---
M sartoris/sartoris.py
1 file changed, 5 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/07/86807/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 405aefe..0e22d58 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -455,28 +455,16 @@
 if tag == '':
 raise SartorisError(message=exit_codes[13], exit_code=13)
 
-# TODO - use dulwich
-reset_cmd = 'git reset {0}'.format(tag)
-add_cmd = 'git add *'
-commit_cmd = 'git commit -m "revert to \'{0}\'"'.format(tag)
-
 # Reset the HEAD
-proc = subprocess.Popen(reset_cmd.split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
-proc.communicate()
+self._dulwich_reset_to_tag(tag)
 
 # Add changes to staging
-proc = subprocess.Popen(add_cmd.split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
-proc.communicate()
+self._dulwich_stage('*')
 
 # Commit
-proc = subprocess.Popen(commit_cmd.split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
-proc.communicate()
+author = '{0} <{1}>'.format(self.config['user.name'],
+self.config['user.email'])
+self._dulwich_commit(author)
 
 # Sync to reset HEAD
 self._sync(revert_tag, args.force)

-- 
To view, visit https://gerrit.wikimedia.org/r/86807
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I888f4ae33e9894f17f0b144ee9610bd8d8e0faa3
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - method _make_author for formatting commiter ID. - change (sartoris)

2013-09-30 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86808


Change subject: add - method _make_author for formatting commiter ID.
..

add - method _make_author for formatting commiter ID.

Change-Id: If38ae1897019cef2cb4215abee66826cf03fcdc8
---
M sartoris/sartoris.py
1 file changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/08/86808/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 0e22d58..41534e9 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -239,6 +239,10 @@
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
 return '{0}-{1}'.format(self.config['user'], timestamp)
 
+def _make_author(self):
+return '{0} <{1}>'.format(self.config['user.name'],
+  self.config['user.email'])
+
 def start(self, args):
 """
 * write a lock file
@@ -321,10 +325,8 @@
 # In absence of a sync script -- Tag the repo
 log.debug(__name__ + ' :: Calling default sync.')
 
-_author = '{0} <{1}>'.format(self.config['user.name'],
- self.config['user.email'])
 try:
-self._dulwich_tag(tag, _author)
+self._dulwich_tag(tag, self._make_author())
 except Exception as e:
 log.error(str(e))
 raise SartorisError(message=exit_codes[12], exit_code=12)
@@ -462,9 +464,7 @@
 self._dulwich_stage('*')
 
 # Commit
-author = '{0} <{1}>'.format(self.config['user.name'],
-self.config['user.email'])
-self._dulwich_commit(author)
+self._dulwich_commit(self._make_author())
 
 # Sync to reset HEAD
 self._sync(revert_tag, args.force)

-- 
To view, visit https://gerrit.wikimedia.org/r/86808
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If38ae1897019cef2cb4215abee66826cf03fcdc8
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - use dulwich deps in revert. - change (sartoris)

2013-09-30 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - use dulwich deps in revert.
..


mod - use dulwich deps in revert.

Change-Id: I888f4ae33e9894f17f0b144ee9610bd8d8e0faa3
---
M sartoris/sartoris.py
1 file changed, 5 insertions(+), 17 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 405aefe..0e22d58 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -455,28 +455,16 @@
 if tag == '':
 raise SartorisError(message=exit_codes[13], exit_code=13)
 
-# TODO - use dulwich
-reset_cmd = 'git reset {0}'.format(tag)
-add_cmd = 'git add *'
-commit_cmd = 'git commit -m "revert to \'{0}\'"'.format(tag)
-
 # Reset the HEAD
-proc = subprocess.Popen(reset_cmd.split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
-proc.communicate()
+self._dulwich_reset_to_tag(tag)
 
 # Add changes to staging
-proc = subprocess.Popen(add_cmd.split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
-proc.communicate()
+self._dulwich_stage('*')
 
 # Commit
-proc = subprocess.Popen(commit_cmd.split(),
-stdout=subprocess.PIPE,
-stderr=subprocess.PIPE)
-proc.communicate()
+author = '{0} <{1}>'.format(self.config['user.name'],
+self.config['user.email'])
+self._dulwich_commit(author)
 
 # Sync to reset HEAD
 self._sync(revert_tag, args.force)

-- 
To view, visit https://gerrit.wikimedia.org/r/86807
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I888f4ae33e9894f17f0b144ee9610bd8d8e0faa3
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] rm - TestParseargs class, boilerplate code in git-deploy exe... - change (sartoris)

2013-09-29 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: rm - TestParseargs class, boilerplate code in git-deploy 
executable, I don't think we need to test this.
..


rm - TestParseargs class, boilerplate code in git-deploy executable, I don't 
think we need to test this.

Change-Id: I227f516e2777e3bc2dcc3376a861d59f023556aa
---
M sartoris/tests/test.py
1 file changed, 2 insertions(+), 10 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index bedbb30..3965828 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -10,7 +10,7 @@
 
 import unittest
 from collections import namedtuple
-from sartoris.sartoris import Sartoris, SartorisError, exit_codes, parseargs
+from sartoris.sartoris import Sartoris, SartorisError, exit_codes
 from sartoris import config_local
 from dulwich.repo import Repo
 from os import mkdir, chdir
@@ -53,14 +53,6 @@
 # null_handler = NullHandler()
 # self.assertEqual(expected, null_handler.emit(record))
 assert False  # TODO: implement your test here
-
-
-class TestParseargs(unittest.TestCase):
-def test_parseargs_present(self):
-args = parseargs()
-cond = 'force' in args and 'method' in args and 'count' in args and \
-   'quiet' in args and 'silent' in args and 'verbose' in args
-assert cond
 
 
 class TestSartorisInit(unittest.TestCase):
@@ -263,4 +255,4 @@
 #   2. Perform commit
 #   3. Ensure that _repo['HEAD'] matches the commit.id
 
-assert False
\ No newline at end of file
+assert False

-- 
To view, visit https://gerrit.wikimedia.org/r/86636
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I227f516e2777e3bc2dcc3376a861d59f023556aa
Gerrit-PatchSet: 2
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - Ensure path to test repo exists. - change (sartoris)

2013-09-29 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - Ensure path to test repo exists.
..


fix - Ensure path to test repo exists.

Change-Id: I9f84ae71f0f47b545413c4933d07af7d20c82e82
---
M sartoris/config_local.py.generic
M sartoris/tests/test.py
2 files changed, 9 insertions(+), 6 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/sartoris/config_local.py.generic b/sartoris/config_local.py.generic
index 9126052..68b294d 100644
--- a/sartoris/config_local.py.generic
+++ b/sartoris/config_local.py.generic
@@ -2,6 +2,9 @@
 Local settings go in here
 """
 
+# REPO for Sartoris tests
+TEST_REPO = '/path/to/test_repo/home/'
+
 # Path to private key
 PKEY = '/path/to/private/key/file'
 
diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index 57cf91a..bedbb30 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -11,7 +11,7 @@
 import unittest
 from collections import namedtuple
 from sartoris.sartoris import Sartoris, SartorisError, exit_codes, parseargs
-from sartoris import config
+from sartoris import config_local
 from dulwich.repo import Repo
 from os import mkdir, chdir
 from shutil import rmtree
@@ -35,17 +35,17 @@
 """
 Create a test repo, change to directory
 """
-mkdir(config.TEST_REPO)
-Repo.init(config.TEST_REPO)
-chdir(config.TEST_REPO)
+mkdir(config_local.TEST_REPO)
+Repo.init(config_local.TEST_REPO)
+chdir(config_local.TEST_REPO)
 
 
 def teardown_tmp_repo():
 """
 Remove the test repo
 """
-chdir(config.SARTORIS_HOME)
-rmtree(config.TEST_REPO)
+chdir(config_local.PROJECT_HOME)
+rmtree(config_local.TEST_REPO)
 
 
 class TestNullHandler(unittest.TestCase):

-- 
To view, visit https://gerrit.wikimedia.org/r/86635
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9f84ae71f0f47b545413c4933d07af7d20c82e82
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - TestSartorisDulwichDeps class for testing Sartoris dul... - change (sartoris)

2013-09-29 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - TestSartorisDulwichDeps class for testing Sartoris 
dulwich methods - tests need to be fleshed out.
..


add - TestSartorisDulwichDeps class for testing Sartoris dulwich methods - 
tests need to be fleshed out.

Change-Id: I215675968ef500d78cacc686b1e2db9839204478
---
M sartoris/tests/test.py
1 file changed, 53 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index 46c3084..57cf91a 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -211,3 +211,56 @@
 assert False
 return
 assert False
+
+
+class TestSartorisDulwichDeps(unittest.TestCase):
+"""
+Class to test Sartoris dulwich dependencies.  Utilize test repos
+"""
+
+@setup_deco
+def test_dulwich_tag(self):
+"""
+Tests method Sartoris::_dulwich_tag
+"""
+
+#   1. Call _dulwich_tag
+#   2. Check _repo['refs/tags/' + tag] to verify tag exists
+
+assert False
+
+@setup_deco
+def test_dulwich_reset_to_tag(self):
+"""
+Tests method Sartoris::_dulwich_reset_to_tag
+"""
+
+#   1. Create two dummy tags and commits
+#   2. Call _dulwich_reset_to_tag
+#   3. Ensure _repo['HEAD'] matches _repo['refs/tags/' + tag]
+
+assert False
+
+@setup_deco
+def test_dulwich_stage(self):
+"""
+Tests method Sartoris::_dulwich_stage
+"""
+
+#   1. Create a dummy file - use object store
+#   2. Call _dulwich_stage
+#   3. Use dulwich.diff_tree.tree_changes to ensure changes are staged
+
+assert False
+
+@setup_deco
+def test_dulwich_commit(self):
+"""
+Tests method Sartoris::_dulwich_commit
+"""
+
+#   1. Follow steps in test_dulwich_stage
+#   2. Perform commit
+#   3. Ensure that _repo['HEAD'] matches the commit.id
+
+assert False
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/86634
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I215675968ef500d78cacc686b1e2db9839204478
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - TestSartorisDulwichDeps class for testing Sartoris dul... - change (sartoris)

2013-09-29 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86634


Change subject: add - TestSartorisDulwichDeps class for testing Sartoris 
dulwich methods - tests need to be fleshed out.
..

add - TestSartorisDulwichDeps class for testing Sartoris dulwich methods - 
tests need to be fleshed out.

Change-Id: I215675968ef500d78cacc686b1e2db9839204478
---
M sartoris/tests/test.py
1 file changed, 53 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/34/86634/1

diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index 46c3084..57cf91a 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -211,3 +211,56 @@
 assert False
 return
 assert False
+
+
+class TestSartorisDulwichDeps(unittest.TestCase):
+"""
+Class to test Sartoris dulwich dependencies.  Utilize test repos
+"""
+
+@setup_deco
+def test_dulwich_tag(self):
+"""
+Tests method Sartoris::_dulwich_tag
+"""
+
+#   1. Call _dulwich_tag
+#   2. Check _repo['refs/tags/' + tag] to verify tag exists
+
+assert False
+
+@setup_deco
+def test_dulwich_reset_to_tag(self):
+"""
+Tests method Sartoris::_dulwich_reset_to_tag
+"""
+
+#   1. Create two dummy tags and commits
+#   2. Call _dulwich_reset_to_tag
+#   3. Ensure _repo['HEAD'] matches _repo['refs/tags/' + tag]
+
+assert False
+
+@setup_deco
+def test_dulwich_stage(self):
+"""
+Tests method Sartoris::_dulwich_stage
+"""
+
+#   1. Create a dummy file - use object store
+#   2. Call _dulwich_stage
+#   3. Use dulwich.diff_tree.tree_changes to ensure changes are staged
+
+assert False
+
+@setup_deco
+def test_dulwich_commit(self):
+"""
+Tests method Sartoris::_dulwich_commit
+"""
+
+#   1. Follow steps in test_dulwich_stage
+#   2. Perform commit
+#   3. Ensure that _repo['HEAD'] matches the commit.id
+
+assert False
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/86634
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I215675968ef500d78cacc686b1e2db9839204478
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] rm - TestParseargs class, boilerplate code in git-deploy exe... - change (sartoris)

2013-09-29 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86636


Change subject: rm - TestParseargs class, boilerplate code in git-deploy 
executable, I don't think we need to test this.
..

rm - TestParseargs class, boilerplate code in git-deploy executable, I don't 
think we need to test this.

Change-Id: I227f516e2777e3bc2dcc3376a861d59f023556aa
---
M sartoris/tests/test.py
1 file changed, 1 insertion(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/36/86636/1

diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index bedbb30..8c0dd17 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -10,7 +10,7 @@
 
 import unittest
 from collections import namedtuple
-from sartoris.sartoris import Sartoris, SartorisError, exit_codes, parseargs
+from sartoris.sartoris import Sartoris, SartorisError, exit_codes
 from sartoris import config_local
 from dulwich.repo import Repo
 from os import mkdir, chdir
@@ -53,14 +53,6 @@
 # null_handler = NullHandler()
 # self.assertEqual(expected, null_handler.emit(record))
 assert False  # TODO: implement your test here
-
-
-class TestParseargs(unittest.TestCase):
-def test_parseargs_present(self):
-args = parseargs()
-cond = 'force' in args and 'method' in args and 'count' in args and \
-   'quiet' in args and 'silent' in args and 'verbose' in args
-assert cond
 
 
 class TestSartorisInit(unittest.TestCase):

-- 
To view, visit https://gerrit.wikimedia.org/r/86636
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I227f516e2777e3bc2dcc3376a861d59f023556aa
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - Ensure path to test repo exists. - change (sartoris)

2013-09-29 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86635


Change subject: fix - Ensure path to test repo exists.
..

fix - Ensure path to test repo exists.

Change-Id: I9f84ae71f0f47b545413c4933d07af7d20c82e82
---
M sartoris/config_local.py.generic
M sartoris/tests/test.py
2 files changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/35/86635/1

diff --git a/sartoris/config_local.py.generic b/sartoris/config_local.py.generic
index 9126052..68b294d 100644
--- a/sartoris/config_local.py.generic
+++ b/sartoris/config_local.py.generic
@@ -2,6 +2,9 @@
 Local settings go in here
 """
 
+# REPO for Sartoris tests
+TEST_REPO = '/path/to/test_repo/home/'
+
 # Path to private key
 PKEY = '/path/to/private/key/file'
 
diff --git a/sartoris/tests/test.py b/sartoris/tests/test.py
index 57cf91a..bedbb30 100644
--- a/sartoris/tests/test.py
+++ b/sartoris/tests/test.py
@@ -11,7 +11,7 @@
 import unittest
 from collections import namedtuple
 from sartoris.sartoris import Sartoris, SartorisError, exit_codes, parseargs
-from sartoris import config
+from sartoris import config_local
 from dulwich.repo import Repo
 from os import mkdir, chdir
 from shutil import rmtree
@@ -35,17 +35,17 @@
 """
 Create a test repo, change to directory
 """
-mkdir(config.TEST_REPO)
-Repo.init(config.TEST_REPO)
-chdir(config.TEST_REPO)
+mkdir(config_local.TEST_REPO)
+Repo.init(config_local.TEST_REPO)
+chdir(config_local.TEST_REPO)
 
 
 def teardown_tmp_repo():
 """
 Remove the test repo
 """
-chdir(config.SARTORIS_HOME)
-rmtree(config.TEST_REPO)
+chdir(config_local.PROJECT_HOME)
+rmtree(config_local.TEST_REPO)
 
 
 class TestNullHandler(unittest.TestCase):

-- 
To view, visit https://gerrit.wikimedia.org/r/86635
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f84ae71f0f47b545413c4933d07af7d20c82e82
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - method _dulwich_reset_to_tag. - change (sartoris)

2013-09-28 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - method _dulwich_reset_to_tag.
..


add - method _dulwich_reset_to_tag.

Change-Id: Iac7240e72ce46fa5cbed9b001170b28e0c95ccfc
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 12 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/config.py b/sartoris/config.py
index c99580f..410277c 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -37,6 +37,7 @@
 11: 'Could not find any deploys.  Exiting',
 12: 'Tagging failed. Exiting',
 13: 'Revert tag not found. Exiting',
+14: 'Commit failed, does not match HEAD. Exiting.',
 19: 'Missing system configuration item "deploy.client-path". Exiting.',
 20: 'Cannot find top level directory for the git repository. Exiting.',
 21: 'Missing system configuration item "hook-dir". Exiting.',
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 02f4ed1..405aefe 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -207,6 +207,17 @@
 _repo.object_store.add_object(tag_obj)
 _repo['refs/tags/' + tag] = tag_obj.id
 
+def _dulwich_reset_to_tag(self, tag):
+"""
+Resets the HEAD to the commit
+"""
+_repo = Repo(self.config['top_dir'])
+
+try:
+_repo.refs['HEAD'] = _repo['refs/tags/' + tag].id
+except AttributeError:
+raise SartorisError(message=exit_codes[7], exit_code=7)
+
 def _dulwich_stage(self, file):
 """
 Stage modified files in the repo

-- 
To view, visit https://gerrit.wikimedia.org/r/86370
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iac7240e72ce46fa5cbed9b001170b28e0c95ccfc
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - method _dulwich_reset_to_tag. - change (sartoris)

2013-09-28 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86370


Change subject: add - method _dulwich_reset_to_tag.
..

add - method _dulwich_reset_to_tag.

Change-Id: Iac7240e72ce46fa5cbed9b001170b28e0c95ccfc
---
M sartoris/config.py
M sartoris/sartoris.py
2 files changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/70/86370/1

diff --git a/sartoris/config.py b/sartoris/config.py
index c99580f..410277c 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -37,6 +37,7 @@
 11: 'Could not find any deploys.  Exiting',
 12: 'Tagging failed. Exiting',
 13: 'Revert tag not found. Exiting',
+14: 'Commit failed, does not match HEAD. Exiting.',
 19: 'Missing system configuration item "deploy.client-path". Exiting.',
 20: 'Cannot find top level directory for the git repository. Exiting.',
 21: 'Missing system configuration item "hook-dir". Exiting.',
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 02f4ed1..405aefe 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -207,6 +207,17 @@
 _repo.object_store.add_object(tag_obj)
 _repo['refs/tags/' + tag] = tag_obj.id
 
+def _dulwich_reset_to_tag(self, tag):
+"""
+Resets the HEAD to the commit
+"""
+_repo = Repo(self.config['top_dir'])
+
+try:
+_repo.refs['HEAD'] = _repo['refs/tags/' + tag].id
+except AttributeError:
+raise SartorisError(message=exit_codes[7], exit_code=7)
+
 def _dulwich_stage(self, file):
 """
 Stage modified files in the repo

-- 
To view, visit https://gerrit.wikimedia.org/r/86370
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac7240e72ce46fa5cbed9b001170b28e0c95ccfc
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - methods _dulwich_stage & _dulwich_commit. - change (sartoris)

2013-09-28 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - methods _dulwich_stage & _dulwich_commit.
..


add - methods _dulwich_stage & _dulwich_commit.

Change-Id: I66e457b764fc41aa462e1c4ac66f563ce4a9b353
---
M sartoris/sartoris.py
1 file changed, 12 insertions(+), 21 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 8d9c29a..02f4ed1 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -17,7 +17,6 @@
 import socket
 from re import search
 import subprocess
-import json
 from time import time
 from datetime import datetime
 
@@ -71,7 +70,7 @@
 DEFAULT_TAG_MSG = 'Sartoris Tag.'
 
 # Default tag message
-DEFAULT_COMMIT_MSG = 'Sartoris Commit .'
+DEFAULT_COMMIT_MSG = 'Sartoris Commit'
 
 # class instance
 __instance = None
@@ -208,30 +207,22 @@
 _repo.object_store.add_object(tag_obj)
 _repo['refs/tags/' + tag] = tag_obj.id
 
-def _dulwich_commit(self, tag, author, message=DEFAULT_COMMIT_MSG):
+def _dulwich_stage(self, file):
 """
-Creates a tag in git via dulwich calls:
-
-Parameters:
-tag - string :: "-[start|sync]-"
-author - string :: "Your Name "
+Stage modified files in the repo
 """
-
-# Open the repo
 _repo = Repo(self.config['top_dir'])
+_repo.stage([file])
 
-# Create the tag object
-tag_obj = Tag()
-tag_obj.tagger = author
-tag_obj.message = message
-tag_obj.name = tag
-tag_obj.object = (Commit, _repo.refs['HEAD'])
-tag_obj.tag_time = int(time())
-tag_obj.tag_timezone = parse_timezone('-0200')[0]
+def _dulwich_commit(self, author, message=DEFAULT_COMMIT_MSG):
+"""
+Commit staged files in the repo
+"""
+_repo = Repo(self.config['top_dir'])
+commit_id = _repo.do_commit(message, committer=author)
 
-# Add tag to the object store
-_repo.object_store.add_object(tag_obj)
-_repo['refs/tags/' + tag] = tag_obj.id
+if not _repo.head() == commit_id:
+raise SartorisError(message=exit_codes[14], exit_code=14)
 
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)

-- 
To view, visit https://gerrit.wikimedia.org/r/86367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I66e457b764fc41aa462e1c4ac66f563ce4a9b353
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - methods _dulwich_stage & _dulwich_commit. - change (sartoris)

2013-09-28 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86367


Change subject: add - methods _dulwich_stage & _dulwich_commit.
..

add - methods _dulwich_stage & _dulwich_commit.

Change-Id: I66e457b764fc41aa462e1c4ac66f563ce4a9b353
---
M sartoris/sartoris.py
1 file changed, 12 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/67/86367/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 8d9c29a..02f4ed1 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -17,7 +17,6 @@
 import socket
 from re import search
 import subprocess
-import json
 from time import time
 from datetime import datetime
 
@@ -71,7 +70,7 @@
 DEFAULT_TAG_MSG = 'Sartoris Tag.'
 
 # Default tag message
-DEFAULT_COMMIT_MSG = 'Sartoris Commit .'
+DEFAULT_COMMIT_MSG = 'Sartoris Commit'
 
 # class instance
 __instance = None
@@ -208,30 +207,22 @@
 _repo.object_store.add_object(tag_obj)
 _repo['refs/tags/' + tag] = tag_obj.id
 
-def _dulwich_commit(self, tag, author, message=DEFAULT_COMMIT_MSG):
+def _dulwich_stage(self, file):
 """
-Creates a tag in git via dulwich calls:
-
-Parameters:
-tag - string :: "-[start|sync]-"
-author - string :: "Your Name "
+Stage modified files in the repo
 """
-
-# Open the repo
 _repo = Repo(self.config['top_dir'])
+_repo.stage([file])
 
-# Create the tag object
-tag_obj = Tag()
-tag_obj.tagger = author
-tag_obj.message = message
-tag_obj.name = tag
-tag_obj.object = (Commit, _repo.refs['HEAD'])
-tag_obj.tag_time = int(time())
-tag_obj.tag_timezone = parse_timezone('-0200')[0]
+def _dulwich_commit(self, author, message=DEFAULT_COMMIT_MSG):
+"""
+Commit staged files in the repo
+"""
+_repo = Repo(self.config['top_dir'])
+commit_id = _repo.do_commit(message, committer=author)
 
-# Add tag to the object store
-_repo.object_store.add_object(tag_obj)
-_repo['refs/tags/' + tag] = tag_obj.id
+if not _repo.head() == commit_id:
+raise SartorisError(message=exit_codes[14], exit_code=14)
 
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)

-- 
To view, visit https://gerrit.wikimedia.org/r/86367
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66e457b764fc41aa462e1c4ac66f563ce4a9b353
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - cleanup sync logic, rm .deploy file - not needed. - change (sartoris)

2013-09-28 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - cleanup sync logic, rm .deploy file - not needed.
..


mod - cleanup sync logic, rm .deploy file - not needed.

Change-Id: I965460a3167436020b338754694c8a837aac0045
---
M sartoris/sartoris.py
1 file changed, 30 insertions(+), 17 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 53b9b2f..8d9c29a 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -70,6 +70,9 @@
 # Default tag message
 DEFAULT_TAG_MSG = 'Sartoris Tag.'
 
+# Default tag message
+DEFAULT_COMMIT_MSG = 'Sartoris Commit .'
+
 # class instance
 __instance = None
 
@@ -205,6 +208,31 @@
 _repo.object_store.add_object(tag_obj)
 _repo['refs/tags/' + tag] = tag_obj.id
 
+def _dulwich_commit(self, tag, author, message=DEFAULT_COMMIT_MSG):
+"""
+Creates a tag in git via dulwich calls:
+
+Parameters:
+tag - string :: "-[start|sync]-"
+author - string :: "Your Name "
+"""
+
+# Open the repo
+_repo = Repo(self.config['top_dir'])
+
+# Create the tag object
+tag_obj = Tag()
+tag_obj.tagger = author
+tag_obj.message = message
+tag_obj.name = tag
+tag_obj.object = (Commit, _repo.refs['HEAD'])
+tag_obj.tag_time = int(time())
+tag_obj.tag_timezone = parse_timezone('-0200')[0]
+
+# Add tag to the object store
+_repo.object_store.add_object(tag_obj)
+_repo['refs/tags/' + tag] = tag_obj.id
+
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
 return '{0}-{1}'.format(self.config['user'], timestamp)
@@ -255,30 +283,16 @@
 self._remove_lock()
 return 0
 
-def sync(self, args, no_deps=False, force=False):
+def sync(self, args):
 """
 * add a sync tag
 * write a .deploy file with the tag information
 * call a sync hook with the prefix (repo) and tag info
 """
-#TODO: do git calls in dulwich, rather than shelling out
 if not self._check_lock():
-exit_code = 30
-log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
-return exit_code
-repo_name = self.config['repo_name']
+raise SartorisError(message=exit_codes[30], exit_code=30)
 
 tag = self._make_tag()
-
-# Write .deploy file
-try:
-deploy_file = open(self.config['deploy_file'], 'w')
-deploy_file.write(json.dumps({'repo': repo_name, 'tag': tag}))
-deploy_file.close()
-except OSError:
-exit_code = 32
-log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
-return exit_code
 
 return self._sync(tag, args.force)
 
@@ -287,7 +301,6 @@
 repo_name = self.config['repo_name']
 sync_script = '{0}/{1}.sync'.format(self.config["sync_dir"], repo_name)
 
-#TODO: use a pluggable sync system rather than shelling out
 if os.path.exists(sync_script):
 log.info('{0} :: Calling sync script at {1}'.format(__name__,
 sync_script))

-- 
To view, visit https://gerrit.wikimedia.org/r/86363
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I965460a3167436020b338754694c8a837aac0045
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - cleanup sync logic, rm .deploy file - not needed. - change (sartoris)

2013-09-28 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86363


Change subject: mod - cleanup sync logic, rm .deploy file - not needed.
..

mod - cleanup sync logic, rm .deploy file - not needed.

Change-Id: I965460a3167436020b338754694c8a837aac0045
---
M sartoris/sartoris.py
1 file changed, 30 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/63/86363/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 53b9b2f..8d9c29a 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -70,6 +70,9 @@
 # Default tag message
 DEFAULT_TAG_MSG = 'Sartoris Tag.'
 
+# Default tag message
+DEFAULT_COMMIT_MSG = 'Sartoris Commit .'
+
 # class instance
 __instance = None
 
@@ -205,6 +208,31 @@
 _repo.object_store.add_object(tag_obj)
 _repo['refs/tags/' + tag] = tag_obj.id
 
+def _dulwich_commit(self, tag, author, message=DEFAULT_COMMIT_MSG):
+"""
+Creates a tag in git via dulwich calls:
+
+Parameters:
+tag - string :: "-[start|sync]-"
+author - string :: "Your Name "
+"""
+
+# Open the repo
+_repo = Repo(self.config['top_dir'])
+
+# Create the tag object
+tag_obj = Tag()
+tag_obj.tagger = author
+tag_obj.message = message
+tag_obj.name = tag
+tag_obj.object = (Commit, _repo.refs['HEAD'])
+tag_obj.tag_time = int(time())
+tag_obj.tag_timezone = parse_timezone('-0200')[0]
+
+# Add tag to the object store
+_repo.object_store.add_object(tag_obj)
+_repo['refs/tags/' + tag] = tag_obj.id
+
 def _make_tag(self):
 timestamp = datetime.now().strftime(self.DATE_TIME_TAG_FORMAT)
 return '{0}-{1}'.format(self.config['user'], timestamp)
@@ -255,30 +283,16 @@
 self._remove_lock()
 return 0
 
-def sync(self, args, no_deps=False, force=False):
+def sync(self, args):
 """
 * add a sync tag
 * write a .deploy file with the tag information
 * call a sync hook with the prefix (repo) and tag info
 """
-#TODO: do git calls in dulwich, rather than shelling out
 if not self._check_lock():
-exit_code = 30
-log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
-return exit_code
-repo_name = self.config['repo_name']
+raise SartorisError(message=exit_codes[30], exit_code=30)
 
 tag = self._make_tag()
-
-# Write .deploy file
-try:
-deploy_file = open(self.config['deploy_file'], 'w')
-deploy_file.write(json.dumps({'repo': repo_name, 'tag': tag}))
-deploy_file.close()
-except OSError:
-exit_code = 32
-log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
-return exit_code
 
 return self._sync(tag, args.force)
 
@@ -287,7 +301,6 @@
 repo_name = self.config['repo_name']
 sync_script = '{0}/{1}.sync'.format(self.config["sync_dir"], repo_name)
 
-#TODO: use a pluggable sync system rather than shelling out
 if os.path.exists(sync_script):
 log.info('{0} :: Calling sync script at {1}'.format(__name__,
 sync_script))

-- 
To view, visit https://gerrit.wikimedia.org/r/86363
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I965460a3167436020b338754694c8a837aac0045
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - logic to revert handling extraction of latest tag. - change (sartoris)

2013-09-28 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86362


Change subject: add - logic to revert handling extraction of latest tag.
..

add - logic to revert handling extraction of latest tag.

Change-Id: I13bb48b9e2a6d838fad3b8eb3f7520a8a939876b
---
M sartoris/config.py
M sartoris/git-deploy
M sartoris/sartoris.py
3 files changed, 18 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/62/86362/1

diff --git a/sartoris/config.py b/sartoris/config.py
index b090456..c99580f 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -36,6 +36,7 @@
 10: 'Please specify number of deploy tags to emit with -c.  Exiting',
 11: 'Could not find any deploys.  Exiting',
 12: 'Tagging failed. Exiting',
+13: 'Revert tag not found. Exiting',
 19: 'Missing system configuration item "deploy.client-path". Exiting.',
 20: 'Cannot find top level directory for the git repository. Exiting.',
 21: 'Missing system configuration item "hook-dir". Exiting.',
diff --git a/sartoris/git-deploy b/sartoris/git-deploy
index 7e335c6..836f587 100755
--- a/sartoris/git-deploy
+++ b/sartoris/git-deploy
@@ -57,6 +57,9 @@
 parser.add_argument("-f", "--force",
 action="store_true",
 help="force the action, bypass sanity checks.")
+parser.add_argument("-t", "--tag",
+default='', type =str,
+help="Specify the tag for the revert action.")
 
 args = parser.parse_args()
 return args
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 26a5093..53b9b2f 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -55,6 +55,9 @@
 
 class Sartoris(object):
 
+# Pattern for git-deploy tags
+TAG_PATTERN = r'[a-zA-Z]*-[0-9]{8}-[0-9]{6}'
+
 # Module level attribute for tagging datetime format
 DATE_TIME_TAG_FORMAT = '%Y%m%d-%H%M%S'
 
@@ -413,22 +416,31 @@
 def revert(self, args):
 """
 * write a lock file
+* reset to last or specified tag
 * call sync hook with the prefix (repo) and tag info
 """
 
-#TODO: do git calls in dulwich, rather than shelling out
 if not self._check_lock():
 raise SartorisError(message=exit_codes[30])
 
 revert_tag = self._make_tag()
 
 # Extract tag on which to revert
+tag = ''
 if hasattr(args, 'tag'):
 tag = args.tag
 else:
 # revert to last tag
-raise NotImplementedError()
+for item in os.walk(self.config['top_dir'] + '/.git/refs/tags/'):
+if search(r'/.git/refs/tags/', item[0]):
+tag = item[2][-1]
+break
 
+# Ensure tag to revert to was set
+if tag == '':
+raise SartorisError(message=exit_codes[13], exit_code=13)
+
+# TODO - use dulwich
 reset_cmd = 'git reset {0}'.format(tag)
 add_cmd = 'git add *'
 commit_cmd = 'git commit -m "revert to \'{0}\'"'.format(tag)

-- 
To view, visit https://gerrit.wikimedia.org/r/86362
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I13bb48b9e2a6d838fad3b8eb3f7520a8a939876b
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - logic to revert handling extraction of latest tag. - change (sartoris)

2013-09-28 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - logic to revert handling extraction of latest tag.
..


add - logic to revert handling extraction of latest tag.

Change-Id: I13bb48b9e2a6d838fad3b8eb3f7520a8a939876b
---
M sartoris/config.py
M sartoris/git-deploy
M sartoris/sartoris.py
3 files changed, 18 insertions(+), 2 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/config.py b/sartoris/config.py
index b090456..c99580f 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -36,6 +36,7 @@
 10: 'Please specify number of deploy tags to emit with -c.  Exiting',
 11: 'Could not find any deploys.  Exiting',
 12: 'Tagging failed. Exiting',
+13: 'Revert tag not found. Exiting',
 19: 'Missing system configuration item "deploy.client-path". Exiting.',
 20: 'Cannot find top level directory for the git repository. Exiting.',
 21: 'Missing system configuration item "hook-dir". Exiting.',
diff --git a/sartoris/git-deploy b/sartoris/git-deploy
index 7e335c6..836f587 100755
--- a/sartoris/git-deploy
+++ b/sartoris/git-deploy
@@ -57,6 +57,9 @@
 parser.add_argument("-f", "--force",
 action="store_true",
 help="force the action, bypass sanity checks.")
+parser.add_argument("-t", "--tag",
+default='', type =str,
+help="Specify the tag for the revert action.")
 
 args = parser.parse_args()
 return args
diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 26a5093..53b9b2f 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -55,6 +55,9 @@
 
 class Sartoris(object):
 
+# Pattern for git-deploy tags
+TAG_PATTERN = r'[a-zA-Z]*-[0-9]{8}-[0-9]{6}'
+
 # Module level attribute for tagging datetime format
 DATE_TIME_TAG_FORMAT = '%Y%m%d-%H%M%S'
 
@@ -413,22 +416,31 @@
 def revert(self, args):
 """
 * write a lock file
+* reset to last or specified tag
 * call sync hook with the prefix (repo) and tag info
 """
 
-#TODO: do git calls in dulwich, rather than shelling out
 if not self._check_lock():
 raise SartorisError(message=exit_codes[30])
 
 revert_tag = self._make_tag()
 
 # Extract tag on which to revert
+tag = ''
 if hasattr(args, 'tag'):
 tag = args.tag
 else:
 # revert to last tag
-raise NotImplementedError()
+for item in os.walk(self.config['top_dir'] + '/.git/refs/tags/'):
+if search(r'/.git/refs/tags/', item[0]):
+tag = item[2][-1]
+break
 
+# Ensure tag to revert to was set
+if tag == '':
+raise SartorisError(message=exit_codes[13], exit_code=13)
+
+# TODO - use dulwich
 reset_cmd = 'git reset {0}'.format(tag)
 add_cmd = 'git add *'
 commit_cmd = 'git commit -m "revert to \'{0}\'"'.format(tag)

-- 
To view, visit https://gerrit.wikimedia.org/r/86362
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I13bb48b9e2a6d838fad3b8eb3f7520a8a939876b
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - revert logic, add general flow. - change (sartoris)

2013-09-27 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - revert logic, add general flow.
..


fix - revert logic, add general flow.

Change-Id: I07e004301cbcae25dd101cdd562adb05f36bb5b0
---
M sartoris/sartoris.py
1 file changed, 23 insertions(+), 18 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index f0dac7b..4626cd1 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -417,28 +417,33 @@
 * call sync hook with the prefix (repo) and tag info
 * remove lock file
 """
-# Create lock file - check if it already exists
-if self._check_lock():
-raise SartorisError(message=exit_codes[2])
 
-self._create_lock()
-repo_name = self.config['repo_name']
+#TODO: do git calls in dulwich, rather than shelling out
+if not self._check_lock():
+raise SartorisError(message=exit_codes[30])
 
-# Get latest "sync" tag - sets self._tag
-self._get_latest_deploy_tag()
+tag = self._make_tag()
 
-# Write .deploy file
-try:
-deploy_file = open(self.config['deploy_file'], 'w')
-deploy_file.write(json.dumps({'repo': repo_name,
-  'tag': self._tag}))
-deploy_file.close()
-except OSError:
-exit_code = 32
-log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
-return exit_code
+# Perform revert
+if hasattr(args, 'tag'):
+# revert to tag
+pass
+else:
+# revert to last tag
+pass
 
-self._sync(self._tag, args.force)
+## Write .deploy file
+#try:
+#deploy_file = open(self.config['deploy_file'], 'w')
+#deploy_file.write(json.dumps({'repo': repo_name,
+#  'tag': self._tag}))
+#deploy_file.close()
+#except OSError:
+#exit_code = 32
+#log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
+#return exit_code
+
+self._sync(tag, args.force)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I07e004301cbcae25dd101cdd562adb05f36bb5b0
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] rm - .deploy file logic - not needed. - change (sartoris)

2013-09-27 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: rm - .deploy file logic - not needed.
..


rm - .deploy file logic - not needed.

Change-Id: I0a755842e733170f898825869173a78ca99f863d
---
M sartoris/sartoris.py
1 file changed, 1 insertion(+), 12 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 4626cd1..4858aa4 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -277,7 +277,7 @@
 log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
 return exit_code
 
-return self._sync(args.force)
+return self._sync(tag, args.force)
 
 def _sync(self, tag, force):
 
@@ -431,17 +431,6 @@
 else:
 # revert to last tag
 pass
-
-## Write .deploy file
-#try:
-#deploy_file = open(self.config['deploy_file'], 'w')
-#deploy_file.write(json.dumps({'repo': repo_name,
-#  'tag': self._tag}))
-#deploy_file.close()
-#except OSError:
-#exit_code = 32
-#log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
-#return exit_code
 
 self._sync(tag, args.force)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86358
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0a755842e733170f898825869173a78ca99f863d
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - new revert logic. - change (sartoris)

2013-09-27 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - new revert logic.
..


add - new revert logic.

Change-Id: If0f0b6fed11f92298b0f584a06119ed9608f37ab
---
M sartoris/sartoris.py
1 file changed, 28 insertions(+), 8 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 4858aa4..26a5093 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -413,26 +413,46 @@
 def revert(self, args):
 """
 * write a lock file
-* write previous deploy info into .deploy
 * call sync hook with the prefix (repo) and tag info
-* remove lock file
 """
 
 #TODO: do git calls in dulwich, rather than shelling out
 if not self._check_lock():
 raise SartorisError(message=exit_codes[30])
 
-tag = self._make_tag()
+revert_tag = self._make_tag()
 
-# Perform revert
+# Extract tag on which to revert
 if hasattr(args, 'tag'):
-# revert to tag
-pass
+tag = args.tag
 else:
 # revert to last tag
-pass
+raise NotImplementedError()
 
-self._sync(tag, args.force)
+reset_cmd = 'git reset {0}'.format(tag)
+add_cmd = 'git add *'
+commit_cmd = 'git commit -m "revert to \'{0}\'"'.format(tag)
+
+# Reset the HEAD
+proc = subprocess.Popen(reset_cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+proc.communicate()
+
+# Add changes to staging
+proc = subprocess.Popen(add_cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+proc.communicate()
+
+# Commit
+proc = subprocess.Popen(commit_cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+proc.communicate()
+
+# Sync to reset HEAD
+self._sync(revert_tag, args.force)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86359
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If0f0b6fed11f92298b0f584a06119ed9608f37ab
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - revert logic, add general flow. - change (sartoris)

2013-09-27 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86357


Change subject: fix - revert logic, add general flow.
..

fix - revert logic, add general flow.

Change-Id: I07e004301cbcae25dd101cdd562adb05f36bb5b0
---
M sartoris/sartoris.py
1 file changed, 23 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/57/86357/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index f0dac7b..4626cd1 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -417,28 +417,33 @@
 * call sync hook with the prefix (repo) and tag info
 * remove lock file
 """
-# Create lock file - check if it already exists
-if self._check_lock():
-raise SartorisError(message=exit_codes[2])
 
-self._create_lock()
-repo_name = self.config['repo_name']
+#TODO: do git calls in dulwich, rather than shelling out
+if not self._check_lock():
+raise SartorisError(message=exit_codes[30])
 
-# Get latest "sync" tag - sets self._tag
-self._get_latest_deploy_tag()
+tag = self._make_tag()
 
-# Write .deploy file
-try:
-deploy_file = open(self.config['deploy_file'], 'w')
-deploy_file.write(json.dumps({'repo': repo_name,
-  'tag': self._tag}))
-deploy_file.close()
-except OSError:
-exit_code = 32
-log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
-return exit_code
+# Perform revert
+if hasattr(args, 'tag'):
+# revert to tag
+pass
+else:
+# revert to last tag
+pass
 
-self._sync(self._tag, args.force)
+## Write .deploy file
+#try:
+#deploy_file = open(self.config['deploy_file'], 'w')
+#deploy_file.write(json.dumps({'repo': repo_name,
+#  'tag': self._tag}))
+#deploy_file.close()
+#except OSError:
+#exit_code = 32
+#log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
+#return exit_code
+
+self._sync(tag, args.force)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07e004301cbcae25dd101cdd562adb05f36bb5b0
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] rm - .deploy file logic - not needed. - change (sartoris)

2013-09-27 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86358


Change subject: rm - .deploy file logic - not needed.
..

rm - .deploy file logic - not needed.

Change-Id: I0a755842e733170f898825869173a78ca99f863d
---
M sartoris/sartoris.py
1 file changed, 1 insertion(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/58/86358/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 4626cd1..4858aa4 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -277,7 +277,7 @@
 log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
 return exit_code
 
-return self._sync(args.force)
+return self._sync(tag, args.force)
 
 def _sync(self, tag, force):
 
@@ -431,17 +431,6 @@
 else:
 # revert to last tag
 pass
-
-## Write .deploy file
-#try:
-#deploy_file = open(self.config['deploy_file'], 'w')
-#deploy_file.write(json.dumps({'repo': repo_name,
-#  'tag': self._tag}))
-#deploy_file.close()
-#except OSError:
-#exit_code = 32
-#log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
-#return exit_code
 
 self._sync(tag, args.force)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86358
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a755842e733170f898825869173a78ca99f863d
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - new revert logic. - change (sartoris)

2013-09-27 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86359


Change subject: add - new revert logic.
..

add - new revert logic.

Change-Id: If0f0b6fed11f92298b0f584a06119ed9608f37ab
---
M sartoris/sartoris.py
1 file changed, 28 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/59/86359/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 4858aa4..26a5093 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -413,26 +413,46 @@
 def revert(self, args):
 """
 * write a lock file
-* write previous deploy info into .deploy
 * call sync hook with the prefix (repo) and tag info
-* remove lock file
 """
 
 #TODO: do git calls in dulwich, rather than shelling out
 if not self._check_lock():
 raise SartorisError(message=exit_codes[30])
 
-tag = self._make_tag()
+revert_tag = self._make_tag()
 
-# Perform revert
+# Extract tag on which to revert
 if hasattr(args, 'tag'):
-# revert to tag
-pass
+tag = args.tag
 else:
 # revert to last tag
-pass
+raise NotImplementedError()
 
-self._sync(tag, args.force)
+reset_cmd = 'git reset {0}'.format(tag)
+add_cmd = 'git add *'
+commit_cmd = 'git commit -m "revert to \'{0}\'"'.format(tag)
+
+# Reset the HEAD
+proc = subprocess.Popen(reset_cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+proc.communicate()
+
+# Add changes to staging
+proc = subprocess.Popen(add_cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+proc.communicate()
+
+# Commit
+proc = subprocess.Popen(commit_cmd.split(),
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE)
+proc.communicate()
+
+# Sync to reset HEAD
+self._sync(revert_tag, args.force)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86359
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If0f0b6fed11f92298b0f584a06119ed9608f37ab
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] rm / fix - TODOs that are no longer needed / fix call to _sy... - change (sartoris)

2013-09-26 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/86157


Change subject: rm / fix - TODOs that are no longer needed / fix call to _sync 
in revert.
..

rm / fix - TODOs that are no longer needed / fix call to _sync in revert.

Change-Id: Ia56e28ff7705efebe7c7d6d46270a92daa4d612f
---
M sartoris/sartoris.py
1 file changed, 1 insertion(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/57/86157/1

diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index fdd4b81..f0dac7b 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -211,11 +211,8 @@
 * write a lock file
 * add a start tag
 """
-# @TODO use dulwich package implement git functionality rather
-#   than shell commands - http://www.samba.org/~jelmer/dulwich/
 
 # Create lock file - check if it already exists
-# @TODO catch exceptions for any os callable attributes
 if self._check_lock():
 raise SartorisError(message=exit_codes[2])
 
@@ -421,7 +418,6 @@
 * remove lock file
 """
 # Create lock file - check if it already exists
-# @TODO catch exceptions for any os callable attributes
 if self._check_lock():
 raise SartorisError(message=exit_codes[2])
 
@@ -442,8 +438,7 @@
 log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
 return exit_code
 
-# @TODO determine what to pass as arg 2
-self._sync(args.force)
+self._sync(self._tag, args.force)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86157
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia56e28ff7705efebe7c7d6d46270a92daa4d612f
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] rm / fix - TODOs that are no longer needed / fix call to _sy... - change (sartoris)

2013-09-26 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: rm / fix - TODOs that are no longer needed / fix call to _sync 
in revert.
..


rm / fix - TODOs that are no longer needed / fix call to _sync in revert.

Change-Id: Ia56e28ff7705efebe7c7d6d46270a92daa4d612f
---
M sartoris/sartoris.py
1 file changed, 1 insertion(+), 6 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index fdd4b81..f0dac7b 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -211,11 +211,8 @@
 * write a lock file
 * add a start tag
 """
-# @TODO use dulwich package implement git functionality rather
-#   than shell commands - http://www.samba.org/~jelmer/dulwich/
 
 # Create lock file - check if it already exists
-# @TODO catch exceptions for any os callable attributes
 if self._check_lock():
 raise SartorisError(message=exit_codes[2])
 
@@ -421,7 +418,6 @@
 * remove lock file
 """
 # Create lock file - check if it already exists
-# @TODO catch exceptions for any os callable attributes
 if self._check_lock():
 raise SartorisError(message=exit_codes[2])
 
@@ -442,8 +438,7 @@
 log.error("{0} :: {1}".format(__name__, exit_codes[exit_code]))
 return exit_code
 
-# @TODO determine what to pass as arg 2
-self._sync(args.force)
+self._sync(self._tag, args.force)
 
 return 0
 

-- 
To view, visit https://gerrit.wikimedia.org/r/86157
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia56e28ff7705efebe7c7d6d46270a92daa4d612f
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - docs update and git-deploy cp to init. - change (sartoris)

2013-09-24 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85893


Change subject: add - docs update and git-deploy cp to init.
..

add - docs update and git-deploy cp to init.

Change-Id: I7790e3f17c3c28a87821212f5fc9fd1fd1ee3869
---
M README.rst
M scripts/init.py
M scripts/sartoris.ini
3 files changed, 20 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/93/85893/1

diff --git a/README.rst b/README.rst
index 14ab268..ed686c7 100644
--- a/README.rst
+++ b/README.rst
@@ -33,27 +33,28 @@
 
 $ sudo pip install -e .
 
-Next, copy the /usr/bin
+Next, execute the initialization script, this will prepare the git config and 
copy the git deploy script.  Make sure that
+the relevant values are set in sartoris.ini for your client/server-target 
beforehand (see below).
 
-$ sudo cp sartoris/git-deploy /usr/bin/
+$ sudo ./scripts/init.py
 
-Finally, set the "hook-dir" and "tag-prefix" and other dependencies for the 
deploy section in your global .gitconfig:
+The .ini file defines the dependencies for the deploy section in your global 
.gitconfig:
 
-$ git config --global deploy.target {%target host%} # e.g. 
my.remotehost.com:8080 a.k.a deploy host
+deploy.target {%target host%} # e.g. my.remotehost.com:8080 a.k.a deploy 
host
 
-$ git config --global deploy.path {%remote deploy path%}
+deploy.path {%remote deploy path%}
 
-$ git config --global deploy.user {%authorized user on deploy target%}
+deploy.user {%authorized user on deploy target%}
 
-$ git config --global deploy.hook-dir .git/deploy/hooks/
+deploy.hook-dir .git/deploy/hooks/
 
-$ git config --global deploy.tag-prefix {%project name%}
+deploy.tag-prefix {%project name%}
 
-$ git config --global deploy.remote {%remote name%}
+deploy.remote {%remote name%}
 
-$ git config --global deploy.branch {%deploy branch name%}
+deploy.branch {%deploy branch name%}
 
-$ git config --global deploy.client-path {%client path%}
+deploy.client-path {%client path%}
 
 Also ensure that the global git params user.name and user.email are defined.
 
diff --git a/scripts/init.py b/scripts/init.py
index de0bce2..a66cebe 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -10,6 +10,7 @@
 import logging
 import ConfigParser
 import subprocess
+import shutil
 
 from sartoris.config_local import PROJECT_HOME
 
@@ -43,11 +44,13 @@
 # Set the ini conf
 for section in config.sections():
 for name, value in config.items(section):
-# TODO - process config  ... git config, cp git-deploy
+# git config
 if section == 'deploy':
 git_config_global_set(section, name, value)
 
-# TODO - process config  ... cp git-deploy
+# cp git-deploy
+if section == 'system' and name == 'run_root':
+shutil.copy(PROJECT_HOME + 'sartoris/git-deploy', value)
 
 
 def cli():
diff --git a/scripts/sartoris.ini b/scripts/sartoris.ini
index aa26a08..07b790d 100644
--- a/scripts/sartoris.ini
+++ b/scripts/sartoris.ini
@@ -11,4 +11,6 @@
 tag-prefix=
 remote=
 branch=
-client-path=
\ No newline at end of file
+client-path=
+[system]
+run_root=/usr/bin/
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/85893
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7790e3f17c3c28a87821212f5fc9fd1fd1ee3869
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - docs update and git-deploy cp to init. - change (sartoris)

2013-09-24 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - docs update and git-deploy cp to init.
..


add - docs update and git-deploy cp to init.

Change-Id: I7790e3f17c3c28a87821212f5fc9fd1fd1ee3869
---
M README.rst
M scripts/init.py
M scripts/sartoris.ini
3 files changed, 20 insertions(+), 14 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/README.rst b/README.rst
index 14ab268..ed686c7 100644
--- a/README.rst
+++ b/README.rst
@@ -33,27 +33,28 @@
 
 $ sudo pip install -e .
 
-Next, copy the /usr/bin
+Next, execute the initialization script, this will prepare the git config and 
copy the git deploy script.  Make sure that
+the relevant values are set in sartoris.ini for your client/server-target 
beforehand (see below).
 
-$ sudo cp sartoris/git-deploy /usr/bin/
+$ sudo ./scripts/init.py
 
-Finally, set the "hook-dir" and "tag-prefix" and other dependencies for the 
deploy section in your global .gitconfig:
+The .ini file defines the dependencies for the deploy section in your global 
.gitconfig:
 
-$ git config --global deploy.target {%target host%} # e.g. 
my.remotehost.com:8080 a.k.a deploy host
+deploy.target {%target host%} # e.g. my.remotehost.com:8080 a.k.a deploy 
host
 
-$ git config --global deploy.path {%remote deploy path%}
+deploy.path {%remote deploy path%}
 
-$ git config --global deploy.user {%authorized user on deploy target%}
+deploy.user {%authorized user on deploy target%}
 
-$ git config --global deploy.hook-dir .git/deploy/hooks/
+deploy.hook-dir .git/deploy/hooks/
 
-$ git config --global deploy.tag-prefix {%project name%}
+deploy.tag-prefix {%project name%}
 
-$ git config --global deploy.remote {%remote name%}
+deploy.remote {%remote name%}
 
-$ git config --global deploy.branch {%deploy branch name%}
+deploy.branch {%deploy branch name%}
 
-$ git config --global deploy.client-path {%client path%}
+deploy.client-path {%client path%}
 
 Also ensure that the global git params user.name and user.email are defined.
 
diff --git a/scripts/init.py b/scripts/init.py
index de0bce2..a66cebe 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -10,6 +10,7 @@
 import logging
 import ConfigParser
 import subprocess
+import shutil
 
 from sartoris.config_local import PROJECT_HOME
 
@@ -43,11 +44,13 @@
 # Set the ini conf
 for section in config.sections():
 for name, value in config.items(section):
-# TODO - process config  ... git config, cp git-deploy
+# git config
 if section == 'deploy':
 git_config_global_set(section, name, value)
 
-# TODO - process config  ... cp git-deploy
+# cp git-deploy
+if section == 'system' and name == 'run_root':
+shutil.copy(PROJECT_HOME + 'sartoris/git-deploy', value)
 
 
 def cli():
diff --git a/scripts/sartoris.ini b/scripts/sartoris.ini
index aa26a08..07b790d 100644
--- a/scripts/sartoris.ini
+++ b/scripts/sartoris.ini
@@ -11,4 +11,6 @@
 tag-prefix=
 remote=
 branch=
-client-path=
\ No newline at end of file
+client-path=
+[system]
+run_root=/usr/bin/
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/85893
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7790e3f17c3c28a87821212f5fc9fd1fd1ee3869
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - calls to set git config. - change (sartoris)

2013-09-23 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - calls to set git config.
..


add - calls to set git config.

Change-Id: I27eafe9dd7091209c4c28ec8e71401f76b88a147
---
M scripts/init.py
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/init.py b/scripts/init.py
index 81db422..b35921a 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -42,7 +42,10 @@
 for section in config.sections():
 for name, value in config.items(section):
 # TODO - process config  ... git config, cp git-deploy
-pass
+if section == 'deploy':
+git_config_global_set(section, name, value)
+
+# TODO - process config  ... cp git-deploy
 
 
 def cli():

-- 
To view, visit https://gerrit.wikimedia.org/r/85827
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I27eafe9dd7091209c4c28ec8e71401f76b88a147
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add / mod - calls to git config in init.py / use of project ... - change (sartoris)

2013-09-23 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85828


Change subject: add / mod - calls to git config in init.py / use of project 
path.
..

add / mod - calls to git config in init.py / use of project path.

Change-Id: I387c21f8fed8c41bc02a225ff9237953ec28ee5e
---
M sartoris/config_local.py.generic
M scripts/init.py
2 files changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/28/85828/1

diff --git a/sartoris/config_local.py.generic b/sartoris/config_local.py.generic
index f68d4b8..9126052 100644
--- a/sartoris/config_local.py.generic
+++ b/sartoris/config_local.py.generic
@@ -3,4 +3,7 @@
 """
 
 # Path to private key
-PKEY = '/path/to/private/key/file'
\ No newline at end of file
+PKEY = '/path/to/private/key/file'
+
+# Project Path
+PROJECT_HOME = '/path/to/sartoris'
\ No newline at end of file
diff --git a/scripts/init.py b/scripts/init.py
index b35921a..de0bce2 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -11,7 +11,9 @@
 import ConfigParser
 import subprocess
 
-INI_FILE = '/your/project/home/scripts/sartoris.ini'
+from sartoris.config_local import PROJECT_HOME
+
+INI_FILE = PROJECT_HOME + 'scripts/sartoris.ini'
 
 log_format = "%(asctime)s %(levelname)-8s %(message)s"
 handler = logging.StreamHandler(sys.stderr)

-- 
To view, visit https://gerrit.wikimedia.org/r/85828
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I387c21f8fed8c41bc02a225ff9237953ec28ee5e
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add / mod - calls to git config in init.py / use of project ... - change (sartoris)

2013-09-23 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add / mod - calls to git config in init.py / use of project 
path.
..


add / mod - calls to git config in init.py / use of project path.

Change-Id: I387c21f8fed8c41bc02a225ff9237953ec28ee5e
---
M sartoris/config_local.py.generic
M scripts/init.py
2 files changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/config_local.py.generic b/sartoris/config_local.py.generic
index f68d4b8..9126052 100644
--- a/sartoris/config_local.py.generic
+++ b/sartoris/config_local.py.generic
@@ -3,4 +3,7 @@
 """
 
 # Path to private key
-PKEY = '/path/to/private/key/file'
\ No newline at end of file
+PKEY = '/path/to/private/key/file'
+
+# Project Path
+PROJECT_HOME = '/path/to/sartoris'
\ No newline at end of file
diff --git a/scripts/init.py b/scripts/init.py
index b35921a..de0bce2 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -11,7 +11,9 @@
 import ConfigParser
 import subprocess
 
-INI_FILE = '/your/project/home/scripts/sartoris.ini'
+from sartoris.config_local import PROJECT_HOME
+
+INI_FILE = PROJECT_HOME + 'scripts/sartoris.ini'
 
 log_format = "%(asctime)s %(levelname)-8s %(message)s"
 handler = logging.StreamHandler(sys.stderr)

-- 
To view, visit https://gerrit.wikimedia.org/r/85828
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I387c21f8fed8c41bc02a225ff9237953ec28ee5e
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - calls to set git config. - change (sartoris)

2013-09-23 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85827


Change subject: add - calls to set git config.
..

add - calls to set git config.

Change-Id: I27eafe9dd7091209c4c28ec8e71401f76b88a147
---
M scripts/init.py
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/27/85827/1

diff --git a/scripts/init.py b/scripts/init.py
index 81db422..b35921a 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -42,7 +42,10 @@
 for section in config.sections():
 for name, value in config.items(section):
 # TODO - process config  ... git config, cp git-deploy
-pass
+if section == 'deploy':
+git_config_global_set(section, name, value)
+
+# TODO - process config  ... cp git-deploy
 
 
 def cli():

-- 
To view, visit https://gerrit.wikimedia.org/r/85827
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I27eafe9dd7091209c4c28ec8e71401f76b88a147
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - git_config_global_set method. - change (sartoris)

2013-09-23 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - git_config_global_set method.
..


add - git_config_global_set method.

Change-Id: Id0e4ec00fa7d021fb9e93e0eec577b3530b2b607
---
M sartoris/sartoris.py
M scripts/init.py
2 files changed, 11 insertions(+), 4 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index 80b735c..fdd4b81 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -380,8 +380,8 @@
  % '/'.join(target.split('/')[:-1]))
 scp_channel.send('C%s %d %s\n'
  % (oct(os.stat(source).st_mode)[-4:],
- os.stat(source)[6],
- target.split('/')[-1]))
+os.stat(source)[6],
+target.split('/')[-1]))
 scp_channel.sendall(f.read())
 
 # Cleanup
diff --git a/scripts/init.py b/scripts/init.py
index f482bb5..81db422 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -9,8 +9,7 @@
 import io
 import logging
 import ConfigParser
-
-from sartoris.config import log
+import subprocess
 
 INI_FILE = '/your/project/home/scripts/sartoris.ini'
 
@@ -19,6 +18,14 @@
 handler.setFormatter(logging.Formatter(fmt=log_format,
  datefmt='%b-%d %H:%M:%S'))
 
+
+def git_config_global_set(section, prop, value):
+proc = subprocess.Popen("git config --global {0}.{1} {2}".format(
+section, prop, value
+).split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+proc.communicate()
+
+
 def main():
 
 # Process INI

-- 
To view, visit https://gerrit.wikimedia.org/r/85826
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id0e4ec00fa7d021fb9e93e0eec577b3530b2b607
Gerrit-PatchSet: 2
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - git_config_global_set method. - change (sartoris)

2013-09-23 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85826


Change subject: add - git_config_global_set method.
..

add - git_config_global_set method.

Change-Id: Id0e4ec00fa7d021fb9e93e0eec577b3530b2b607
---
M scripts/init.py
1 file changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/26/85826/1

diff --git a/scripts/init.py b/scripts/init.py
index f482bb5..81db422 100755
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -9,8 +9,7 @@
 import io
 import logging
 import ConfigParser
-
-from sartoris.config import log
+import subprocess
 
 INI_FILE = '/your/project/home/scripts/sartoris.ini'
 
@@ -19,6 +18,14 @@
 handler.setFormatter(logging.Formatter(fmt=log_format,
  datefmt='%b-%d %H:%M:%S'))
 
+
+def git_config_global_set(section, prop, value):
+proc = subprocess.Popen("git config --global {0}.{1} {2}".format(
+section, prop, value
+).split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+proc.communicate()
+
+
 def main():
 
 # Process INI

-- 
To view, visit https://gerrit.wikimedia.org/r/85826
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0e4ec00fa7d021fb9e93e0eec577b3530b2b607
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - default ini processor for project. - change (sartoris)

2013-09-22 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - default ini processor for project.
..


add - default ini processor for project.

Change-Id: I68575e096d662a5f6e9427e6266c1e93dfc60b4a
---
A scripts/init.py
1 file changed, 45 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/scripts/init.py b/scripts/init.py
new file mode 100755
index 000..f482bb5
--- /dev/null
+++ b/scripts/init.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+"""
+Prepares system state for Sartoris.
+"""
+
+import sys
+import io
+import logging
+import ConfigParser
+
+from sartoris.config import log
+
+INI_FILE = '/your/project/home/scripts/sartoris.ini'
+
+log_format = "%(asctime)s %(levelname)-8s %(message)s"
+handler = logging.StreamHandler(sys.stderr)
+handler.setFormatter(logging.Formatter(fmt=log_format,
+ datefmt='%b-%d %H:%M:%S'))
+
+def main():
+
+# Process INI
+try:
+with file(INI_FILE, 'r') as f:
+config_handle = f.read()
+config = ConfigParser.RawConfigParser(allow_no_value=True)
+config.readfp(io.BytesIO(config_handle))
+except IOError:
+logging.error(__name__ + ' :: Could not find .ini.')
+return
+
+# Set the ini conf
+for section in config.sections():
+for name, value in config.items(section):
+# TODO - process config  ... git config, cp git-deploy
+pass
+
+
+def cli():
+sys.exit(main())
+
+if __name__ == "__main__":  # pragma: nocover
+cli()

-- 
To view, visit https://gerrit.wikimedia.org/r/85520
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I68575e096d662a5f6e9427e6266c1e93dfc60b4a
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - ini syntax. - change (sartoris)

2013-09-22 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: fix - ini syntax.
..


fix - ini syntax.

Change-Id: I39b7f28c425455618707e7c81ea8d921b6b29563
---
M scripts/sartoris.ini
1 file changed, 8 insertions(+), 8 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/sartoris.ini b/scripts/sartoris.ini
index 29bb13c..aa26a08 100644
--- a/scripts/sartoris.ini
+++ b/scripts/sartoris.ini
@@ -4,11 +4,11 @@
 ;   Initialize instance.
 
 [deploy]
-target=
-path=
-user=
-hook-dir=
-tag-prefix=
-remote=
-branch=
-client-path=
\ No newline at end of file
+target=
+path=
+user=
+hook-dir=
+tag-prefix=
+remote=
+branch=
+client-path=
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/85519
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I39b7f28c425455618707e7c81ea8d921b6b29563
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] rm - ConfigParser ref. - change (sartoris)

2013-09-22 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: rm - ConfigParser ref.
..


rm - ConfigParser ref.

Change-Id: I608231834c0626c3c7680a13026bf9b570f8ebd4
---
M sartoris/config.py
1 file changed, 0 insertions(+), 14 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved



diff --git a/sartoris/config.py b/sartoris/config.py
index e620cc0..b090456 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -15,20 +15,6 @@
 import sys
 import logging
 
-# TODO - PULL config_local.py creds from ini file
-#
-# import io
-# import ConfigParser
-#
-# # Process INI
-# if not 'INI_CONF' in dir():
-# with file('sartoris.ini', 'r') as f:
-# config_handle = f.read()
-# config = ConfigParser.RawConfigParser(allow_no_value=True)
-# INI_CONF = config.readfp(io.BytesIO(config_handle))
-#
-# INI_FILE = 'sartoris.ini'
-
 # Native git call
 GIT_CALL = '/usr/bin/git'
 

-- 
To view, visit https://gerrit.wikimedia.org/r/85518
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I608231834c0626c3c7680a13026bf9b570f8ebd4
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] rm - ConfigParser ref. - change (sartoris)

2013-09-22 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85518


Change subject: rm - ConfigParser ref.
..

rm - ConfigParser ref.

Change-Id: I608231834c0626c3c7680a13026bf9b570f8ebd4
---
M sartoris/config.py
1 file changed, 0 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/18/85518/1

diff --git a/sartoris/config.py b/sartoris/config.py
index e620cc0..b090456 100644
--- a/sartoris/config.py
+++ b/sartoris/config.py
@@ -15,20 +15,6 @@
 import sys
 import logging
 
-# TODO - PULL config_local.py creds from ini file
-#
-# import io
-# import ConfigParser
-#
-# # Process INI
-# if not 'INI_CONF' in dir():
-# with file('sartoris.ini', 'r') as f:
-# config_handle = f.read()
-# config = ConfigParser.RawConfigParser(allow_no_value=True)
-# INI_CONF = config.readfp(io.BytesIO(config_handle))
-#
-# INI_FILE = 'sartoris.ini'
-
 # Native git call
 GIT_CALL = '/usr/bin/git'
 

-- 
To view, visit https://gerrit.wikimedia.org/r/85518
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I608231834c0626c3c7680a13026bf9b570f8ebd4
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] fix - ini syntax. - change (sartoris)

2013-09-22 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85519


Change subject: fix - ini syntax.
..

fix - ini syntax.

Change-Id: I39b7f28c425455618707e7c81ea8d921b6b29563
---
M scripts/sartoris.ini
1 file changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/19/85519/1

diff --git a/scripts/sartoris.ini b/scripts/sartoris.ini
index 29bb13c..aa26a08 100644
--- a/scripts/sartoris.ini
+++ b/scripts/sartoris.ini
@@ -4,11 +4,11 @@
 ;   Initialize instance.
 
 [deploy]
-target=
-path=
-user=
-hook-dir=
-tag-prefix=
-remote=
-branch=
-client-path=
\ No newline at end of file
+target=
+path=
+user=
+hook-dir=
+tag-prefix=
+remote=
+branch=
+client-path=
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/85519
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I39b7f28c425455618707e7c81ea8d921b6b29563
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - default ini processor for project. - change (sartoris)

2013-09-22 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85520


Change subject: add - default ini processor for project.
..

add - default ini processor for project.

Change-Id: I68575e096d662a5f6e9427e6266c1e93dfc60b4a
---
A scripts/init.py
1 file changed, 45 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/20/85520/1

diff --git a/scripts/init.py b/scripts/init.py
new file mode 100755
index 000..f482bb5
--- /dev/null
+++ b/scripts/init.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+"""
+Prepares system state for Sartoris.
+"""
+
+import sys
+import io
+import logging
+import ConfigParser
+
+from sartoris.config import log
+
+INI_FILE = '/your/project/home/scripts/sartoris.ini'
+
+log_format = "%(asctime)s %(levelname)-8s %(message)s"
+handler = logging.StreamHandler(sys.stderr)
+handler.setFormatter(logging.Formatter(fmt=log_format,
+ datefmt='%b-%d %H:%M:%S'))
+
+def main():
+
+# Process INI
+try:
+with file(INI_FILE, 'r') as f:
+config_handle = f.read()
+config = ConfigParser.RawConfigParser(allow_no_value=True)
+config.readfp(io.BytesIO(config_handle))
+except IOError:
+logging.error(__name__ + ' :: Could not find .ini.')
+return
+
+# Set the ini conf
+for section in config.sections():
+for name, value in config.items(section):
+# TODO - process config  ... git config, cp git-deploy
+pass
+
+
+def cli():
+sys.exit(main())
+
+if __name__ == "__main__":  # pragma: nocover
+cli()

-- 
To view, visit https://gerrit.wikimedia.org/r/85520
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68575e096d662a5f6e9427e6266c1e93dfc60b4a
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - dummy ini for instance initialization. - change (sartoris)

2013-09-20 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: add - dummy ini for instance initialization.
..


add - dummy ini for instance initialization.

Change-Id: I6f764d7493e6cb81d43d2ee71cbd91ca31f3
---
A scripts/sartoris.ini
1 file changed, 14 insertions(+), 0 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/scripts/sartoris.ini b/scripts/sartoris.ini
new file mode 100644
index 000..29bb13c
--- /dev/null
+++ b/scripts/sartoris.ini
@@ -0,0 +1,14 @@
+
+;   Ryan Faulkner, 2013-09-20
+;
+;   Initialize instance.
+
+[deploy]
+target=
+path=
+user=
+hook-dir=
+tag-prefix=
+remote=
+branch=
+client-path=
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/85406
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6f764d7493e6cb81d43d2ee71cbd91ca31f3
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] add - dummy ini for instance initialization. - change (sartoris)

2013-09-20 Thread Rfaulk (Code Review)
Rfaulk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85406


Change subject: add - dummy ini for instance initialization.
..

add - dummy ini for instance initialization.

Change-Id: I6f764d7493e6cb81d43d2ee71cbd91ca31f3
---
A scripts/sartoris.ini
1 file changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/sartoris refs/changes/06/85406/1

diff --git a/scripts/sartoris.ini b/scripts/sartoris.ini
new file mode 100644
index 000..29bb13c
--- /dev/null
+++ b/scripts/sartoris.ini
@@ -0,0 +1,14 @@
+
+;   Ryan Faulkner, 2013-09-20
+;
+;   Initialize instance.
+
+[deploy]
+target=
+path=
+user=
+hook-dir=
+tag-prefix=
+remote=
+branch=
+client-path=
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/85406
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f764d7493e6cb81d43d2ee71cbd91ca31f3
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mod - scp_file utilizes config. - change (sartoris)

2013-09-19 Thread Rfaulk (Code Review)
Rfaulk has submitted this change and it was merged.

Change subject: mod - scp_file utilizes config.
..


mod - scp_file utilizes config.

Change-Id: I69e3b1fd9c111399f0442b217f11b68d5599f69d
---
M sartoris/sartoris.py
1 file changed, 3 insertions(+), 4 deletions(-)

Approvals:
  Rfaulk: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sartoris/sartoris.py b/sartoris/sartoris.py
index af6b8c6..80b735c 100755
--- a/sartoris/sartoris.py
+++ b/sartoris/sartoris.py
@@ -356,22 +356,21 @@
 log.info('PULL -> ' + '; '.join(
 filter(lambda x: x, ret['stdout'])))
 
-@staticmethod
-def scp_file(source, target, user, host, port=22):
+def scp_file(self, source, target, port=22):
 """
 SCP files via paramiko.
 """
 
 # Socket connection to remote host
 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-sock.connect((host, port))
+sock.connect((self.config['target'], port))
 
 # Build a SSH transport
 t = paramiko.Transport(sock)
 t.start_client()
 
 rsa_key = paramiko.RSAKey.from_private_key_file(PKEY)
-t.auth_publickey(user, rsa_key)
+t.auth_publickey(self.config['user.name'], rsa_key)
 
 # Start a scp channel
 scp_channel = t.open_session()

-- 
To view, visit https://gerrit.wikimedia.org/r/84954
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I69e3b1fd9c111399f0442b217f11b68d5599f69d
Gerrit-PatchSet: 1
Gerrit-Project: sartoris
Gerrit-Branch: master
Gerrit-Owner: Rfaulk 
Gerrit-Reviewer: Rfaulk 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


  1   2   3   4   5   6   7   >