Difference between revisions of "Newbie Guide for Windows People Working on Minor Bugs"

From Dreamwidth Notes
Jump to: navigation, search
(Finish Setting Up Your Dreamhack: Oops, missed one.)
(Removed sections which no longer applied; updated some parts; added FIXME where needed)
Line 1: Line 1:
 +
{{Warn|text=This guide is currently being rewritten to reflect the new workflow. Some things may be unclear, some things may no longer be relevant, some things may be missing. Please be patient.}}
 +
 
{{Note|text=Feel free to correct, add, expand, anything that could make this better and clearer. ^_^}}
 
{{Note|text=Feel free to correct, add, expand, anything that could make this better and clearer. ^_^}}
  
{{Note|text=For Mac users, see [http://sarken.dreamwidth.org/1747903.html Patching Styles and Other Things on a Mac] by <dwuser>sarken</dwuser>.}}
 
  
 +
= What do you need and why? =
  
= Install and Set Things Up =
+
Because we're on Windows, we have to use quite a number of tools to access and manage things so this part might seem a little daunting. The good news is that 1) we're used to being flexible and resourceful, right? 2) once you've got everything set up things will be much simpler.
  
This may seem like a lot of things to do before you can really get started, things you may not be familiar with but 1) you can do it 2) you only have to do this once.
+
# You need a Dreamhack where you'll clone the Dreamwidth code. Think of it as an online mirror of the Dreamwidth site.
  
 +
# You need a Github account to be able to clone the Dreamwith repository code into your Dreamhack and fetch updates. This is your code source.
  
== Get a Dreamhack ==
+
# You need PuTTY to connect GitHub to your Dreamhack, and to access and manage your Dreamhack. PuTTY is your center of command. You can't do anything without it.
  
What's a Dreamhack? To put it simply, it's an online mirror of the Dreamwidth site which is set up for any developer, beginner or experienced, who asks for it. This way, you don't have to go through the complicated process of installing Dreamwidth on your own computer.
+
# You need WinSCP to visualize the files on your Dreamhack and be able to open them in a text editor.
 +
 
 +
# You need a text editor to edit your files. While you can use Notepad, I recommend [[Editor:_Notepad_plus_plus | Notepad++]] instead. It's free, simple and will make editing much easier.
 +
 
 +
# You need a Bugzilla account to find bugs, files bugs and upload patches.
 +
 
 +
 
 +
== Get a Dreamhack ==
  
 
* Apply for a Dreamhack by [http://hack.dreamwidth.net/apply.shtml filling this form]. The two important fields are 'Your Desired Username' and 'Your email address'. Your username is used to manage your Dreamhack and to create the URL where your Dreamhack will be located at so you can pick anything. Your email address is used to send you a welcome e-mail which contains important information as well as various alerts. You can pick any of your existing email addresses or choose to create an email account entirely devoted to your development work.
 
* Apply for a Dreamhack by [http://hack.dreamwidth.net/apply.shtml filling this form]. The two important fields are 'Your Desired Username' and 'Your email address'. Your username is used to manage your Dreamhack and to create the URL where your Dreamhack will be located at so you can pick anything. Your email address is used to send you a welcome e-mail which contains important information as well as various alerts. You can pick any of your existing email addresses or choose to create an email account entirely devoted to your development work.
  
* Once you're done, you should get an e-mail with your login username and a password. Don't lose it. Once you've gotten this e-mail, you need to install two programs to be able to manage your Dreamhack: [[PuTTY]] and [http://winscp.net/eng/download.php WinSCP].
+
* Once you're done, you should get an e-mail with your login username and a password. Don't lose it.
 +
 
 +
 
 +
== Create an account on GitHub ==
 +
 
 +
* Go to [http://www.github.com/ http://www.github.com/], click on Sign up and Pricing and create a free account. I suggest you pick a username people are familiar with so they can recognize your. Ideally the same username you'll have on your Bugzilla account.
 +
 
  
 
== Install PuTTY ==
 
== Install PuTTY ==
 
What for? [[PuTTY]] will allow you to start and stop your Dreamhack, update it when changes are made either by you or other developers, and generate patches.
 
  
 
* Download 'Windows installer for everything except PuTTYtel' .exe file at [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] and install it.
 
* Download 'Windows installer for everything except PuTTYtel' .exe file at [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] and install it.
Line 27: Line 41:
 
* Click on Open. If you get a pop-up message about a key, click Yes.
 
* Click on Open. If you get a pop-up message about a key, click Yes.
  
* Enter the password given to you in the welcome e-mail when asked. Note that no characters are displayed and the cursor won't move. It's normal.
+
* Enter the password given to you in the Dreamhack welcome e-mail when asked. Note that no characters are displayed and the cursor won't move. It's normal.
  
 
* Change your password by typing:
 
* Change your password by typing:
 
<syntaxhighlight lang="bash">passwd</syntaxhighlight>
 
<syntaxhighlight lang="bash">passwd</syntaxhighlight>
  
* And that's it for now. :)
+
* Your default Dreamhack account is called system. Type this to set its password:
 +
 
 +
<source lang="bash">$LJHOME/bin/upgrading/make_system.pl</source>
 +
 
  
 
== Install WinSCP ==
 
== Install WinSCP ==
Line 42: Line 59:
 
* Use "hack.dreamwidth.net" for the host name. Enter your username and your new password. Click on Save then on Login.
 
* Use "hack.dreamwidth.net" for the host name. Enter your username and your new password. Click on Save then on Login.
  
== Set Up Your Dreamhack ==
 
  
This part can seem daunting but is mainly a lot of copy/pasting. Take your time and you'll be fine.
+
== Get a good text editor ==
  
=== Protect Your Config Files ===
+
While you can use Notepad, I recommend [[Editor:_Notepad_plus_plus | Notepad++]] instead. It's free, simple and will make editing much easier.
  
(From [[Dreamhack_getting_started#Back_up_your_configs|Back Up Your Configs]] and [[Dreamhack_getting_started#Protect_your_configs_from_updates|Protect your configs from updates]])
 
  
* In PuTTY, copy/paste the following lines to create the ~/config-backup directory and copy your config files into it:
+
== Create a Bugzilla account ==
  
<source lang="bash">mkdir ~/config-backup
+
* Simply [http://bugs.dwscoalition.org/createaccount.cgi click here].
cp $LJHOME/etc/config* ~/config-backup</source>
+
  
* Then copy/paste the following code to create editable copies of your config files:
+
* As <dwuser>mark</dwuser> explained [http://dw-dev.dreamwidth.org/17146.html here], go to [http://bugs.dwscoalition.org/userprefs.cgi?tab=account Name and Password] and enter your name following this format: <code>Name [:username]</code>. 'Name' can be your real name, a nickname, your username again, etc. You don't have to give your real name if you don't want to.
  
<source lang="bash">cd $LJHOME
 
mkdir cvs/local cvs/local/etc cvs/local/cvs
 
cp etc/config-local.pl cvs/local/etc
 
cp etc/config.pl cvs/local/etc
 
cp etc/config-private.pl cvs/local/etc</source>
 
  
* In WinSCP, go to <code>/dw/cvs/local/cvs/</code>.
+
= Setting Things Up ==
* In the right-sided window, right-click and select New/File. Call it <code>multicvs-private.conf</code>. Copy/paste this and save:
+
  
local .
+
== On your GitHub account ==
  
* Go back to PuTTY and copy/paste this:
+
You need to fork the Dreamwidth code onto your own account. Forking is like cloning and branching. It will copy the code and also label your copy as being a branch (a fork) of the original Dreamwidth code.
  
<source lang="bash">cp $LJHOME/cvs/local/cvs/multicvs-private.conf $LJHOME/cvs/
+
* Go to https://github.com/dreamwidth/dw-free and click on Fork on the upper right corner.
cp etc/config-private.pl cvs/local/etc</source>
+
  
Note: you've used three 'bash' commands in PuTTY: <code>cd A</code> to go to the A directory; <code>mkdir B</code> to create the B directory; <code>cp C D</code> to copy C to D.
+
* Then go to https://github.com/dreamwidth/dw-nonfree and do the same.
  
 +
== On your Dreamhack ==
  
=== Create Scripts for Routine Tasks ===
+
Now you need to 'import' both of these onto your Dreamhack.
  
(From [[Dev_Maintenance#Scripting|Scripting]])
+
* Open PuTTY and type this to stop your hack:
  
* In WinSCP, go to <code>/bin</code> and create three files called dwu, dws, dwdb (u for Update; s for Synchronize; db for DataBase).
+
<source lang="bash">killall worker-manager
 +
stop-apache</source>
  
* In each of this file, copy/paste this:
+
* Then this to move your current code to username-xx:
  
dwu:
+
<source lang="bash">mv $LJHOME $LJHOME-xx</source>
  
<source lang="bash">#!/bin/bash
+
FIXME: is this necessary for new users?
hg -R $LJHOME/cvs/dw-free qpop -a && \
+
hg -R $LJHOME/cvs/dw-nonfree qpop -a && \
+
$LJHOME/bin/cvsreport.pl -u && \
+
hg -R $LJHOME/cvs/dw-free qpush -a && \
+
hg -R $LJHOME/cvs/dw-nonfree qpush -a</source>
+
  
dws:
+
* Type this to clone your GitHub code onto your Dreamhack (replace USERNAME with your GitHub username):
  
<source lang="bash">#!/bin/bash
+
<source lang="bash">git clone https://USERNAME@github.com/USERNAME/dw-free.git $LJHOME</source>
$LJHOME/bin/cvsreport.pl -s -c && \
+
$LJHOME/bin/cvsreport.pl -s -c
+
cd $LJHOME; for i in $(bin/cvsreport.pl -n -1); do echo "Removing $i" && rm $i; done</source>
+
  
dwdb:
+
* Then this to link the repo with the original DW repo on GitHub:
  
<source lang="bash">#!/bin/bash
+
<source lang="bash">cd $LJHOME
$LJHOME/bin/upgrading/update-db.pl -r -p --innodb && \
+
git remote add dreamwidth https://github.com/dreamwidth/dw-free
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb && \
+
git fetch dreamwidth
$LJHOME/bin/upgrading/texttool.pl load</source>
+
git branch --set-upstream develop dreamwidth/develop
 +
git branch --set-upstream master dreamwidth/master</source>
  
* In PuTTY, copy/paste this to make the scripts executable:
+
* Now let's do the same thing with the non-free part of Dreamwidth:
  
<source lang="bash">
+
<source lang="bash">cd $LJHOME/ext
chmod ugo+x ~/bin/dwu
+
git clone https://USERNAME@github.com/USERNAME/dw-nonfree.git
chmod ugo+x ~/bin/dws
+
cd dw-nonfree
chmod ugo+x ~/bin/dwdb</source>
+
git remote add dreamwidth https://github.com/dreamwidth/dw-nonfree
 +
git fetch dreamwidth
 +
git branch --set-upstream develop dreamwidth/develop
 +
git branch --set-upstream master dreamwidth/master
 +
cd ..</source>
  
* For more scripts, see [http://dw-dev-training.dreamwidth.org/26408.html this entry].
+
FIXME: add last two steps.
  
* Tip: a useful script you can create is one which stops your hack, synchronize it, update the database and restart your hack.
 
  
=== Manage Your System Account ===
+
== Further steps on your Dreamhack ==
  
* Your default Dreamhack account is called system. Go to PuTTY and type this to set its password:
+
These are not mandatory but will make your life easier.
  
<source lang="bash">$LJHOME/bin/upgrading/make_system.pl</source>
+
=== Give special abilities to your system account ===
  
* Log in to your Dreamhack (http://www.yourusername.hack.dreamwidth.net/) using system and your new password.
+
* Log in to your Dreamhack (http://www.yourusername.hack.dreamwidth.net/) using system and your password.
  
 
* Go to [http://www.yourusername.hack.dreamwidth.net/admin/priv/ http://www.yourusername.hack.dreamwidth.net/admin/priv/]. Click on 'payments' type 'system' in the User field then click on 'Make Changes'. The system account now has the ability (called 'privilege' or 'priv') to give paid time to any account.
 
* Go to [http://www.yourusername.hack.dreamwidth.net/admin/priv/ http://www.yourusername.hack.dreamwidth.net/admin/priv/]. Click on 'payments' type 'system' in the User field then click on 'Make Changes'. The system account now has the ability (called 'privilege' or 'priv') to give paid time to any account.
Line 130: Line 135:
 
* Go to [http://www.yourusername.hack.dreamwidth.net/admin/pay http://www.yourusername.hack.dreamwidth.net/admin/pay]. Type 'system' in the Edit user field and click on Go. Make your account a seed one.
 
* Go to [http://www.yourusername.hack.dreamwidth.net/admin/pay http://www.yourusername.hack.dreamwidth.net/admin/pay]. Type 'system' in the Edit user field and click on Go. Make your account a seed one.
  
 
+
=== Get rid of invite codes ===
=== Get Rid of Invite Codes ===
+
  
 
* In WinSCP, go to <code>/dw/cvs/local/etc/</code>, and double-click on <code>config.pl</code>. Find <code>$USE_ACCT_CODES = 1;</code> and change 1 to <code>0</code>. Save your file.
 
* In WinSCP, go to <code>/dw/cvs/local/etc/</code>, and double-click on <code>config.pl</code>. Find <code>$USE_ACCT_CODES = 1;</code> and change 1 to <code>0</code>. Save your file.
Line 137: Line 141:
 
* In PuTTY, type this to make the changes go live on your Dreamhack:
 
* In PuTTY, type this to make the changes go live on your Dreamhack:
  
<source lang="bash">cd $LJHOME
+
FIXME
stop-apache
+
dws
+
dwdb
+
start-apache</source>
+
  
== Create a Bugzilla account ==
 
  
* Simply [http://bugs.dwscoalition.org/createaccount.cgi click here].
+
= Folders and files you work with ==
 
+
* As <dwuser>mark</dwuser> explained [http://dw-dev.dreamwidth.org/17146.html here], go to [http://bugs.dwscoalition.org/userprefs.cgi?tab=account Name and Password] and enter your name following this format: <code>Name [:username]</code>. 'Name' can be your real name, a nickname, your username again, etc. You don't have to give your real name if you don't want to.
+
 
+
 
+
== Finish Setting Up Your Dreamhack ==
+
 
+
* The final and last step is to create files and folders for patches.
+
 
+
* In PuTTY, type this to create files and folders in <code>~/dw/cvs/dw-free/.hg/</code>:
+
 
+
<source lang="bash">cd $LJHOME/cvs/dw-free
+
hg qinit -c</source>
+
 
+
* In WinSCP, open <code>~/dw/cvs/dw-free/.hg/hgrc</code> and add this:
+
 
+
<source lang="ini">[ui]
+
username = username <username@gmail.com></source>
+
 
+
* Change the second username to your Bugzilla name and the e-mail address to your Bugzilla address. Save the file.
+
 
+
* In PuTTY again, type this to create files and folders in <code>~/dw/cvs/dw-nonfree/.hg/</code>:
+
 
+
<source lang="bash">cd $LJHOME/cvs/dw-nonfree
+
hg qinit -c</source>
+
 
+
* In WinSCP, open <code>~/dw/cvs/dw-nonfree/.hg/hgrc</code> and add this:
+
 
+
<source lang="ini">[ui]
+
username = username <username@gmail.com></source>
+
 
+
* Change the second username to your Bugzilla name and the e-mail address to your Bugzilla address. Save the file.
+
 
+
= How All of This Works =
+
 
+
== PuTTY, WinSCP or Bugzilla ? ==
+
 
+
* You use PuTTY to update your Dreamhack code, make your changes go live on your Dreamhack, create patches and manage patches.
+
 
+
* You use WinSCP to edit Dreamhack files.
+
 
+
* You use Bugzilla to find bugs, file bugs, and upload patches.
+
 
+
 
+
== Folders and Files You Work With ==
+
  
 
* Your Dreamhack has two parts:
 
* Your Dreamhack has two parts:
** the live part (<code>~/dw/*</code>)
 
** the repository part (<code>~/dw/cvs/dw-free/*</code> and <code>~/dw/cvs/dw-nonfree/*</code>).
 
  
* What you see on [http://www.yourusername.hack.dreamwidth.net/ http://www.yourusername.hack.dreamwidth.net/] is the live part.
+
** the free part (<code>~/dw/*</code>)
 +
** the non-free part (<code>~/dw/ext/dw-nonfree/*</code>.
  
* But you work with in the repositories: you edit repository files and you create patches in repository folders.
+
* Both are automatically live when you start your Dreamhack.
  
 +
== Updating your code ==
  
== Updating Your Repository Code ==
+
* Code is committed by developers all the time. You must regularly update your repositories with the <code>pull</code command:
  
* Code is committed by developers all the time. You must regularly update your repositories by running the 'Update' script:
+
FIXME
<syntaxhighlight lang="bash">cd $LJHOME
+
stop-apache
+
dwu
+
start-apache</syntaxhighlight>
+
  
* Note that this won't update your Dreamhack. You need to make the changes go live with the next step:
+
== Updating your database ==
  
 
+
FIXME
== Making Changes Go Live on Your Dreamhack ==
+
 
+
* To do that, you use the 'Synchronize' and 'DataBase' scripts:
+
<syntaxhighlight lang="bash">cd $LJHOME
+
stop-apache
+
dws
+
dwdb
+
start-apache</syntaxhighlight>
+
  
  
Line 237: Line 180:
 
== Create a Patch ==
 
== Create a Patch ==
  
* Open PuTTY and update everything by running the three scripts. You need to work with the latest code.
+
FIXME
 
+
* Go to dw-free by typing this:
+
 
+
<source lang="bash">cd $LJHOME
+
tocvs f</source>
+
 
+
* If you need to go to dw-nonfree, type this instead:
+
 
+
<source lang="bash">cd $LJHOME
+
tocvs n</source>
+
 
+
* Create a new patch by typing this (change NUMBER and PATCHNAME of course):
+
 
+
<source lang="bash">hg qnew bugNUMBER_PATCHNAME.diff</source>
+
  
 
= Edit Files =
 
= Edit Files =
  
* Use WinSCP to open the file(s) you need to edit. WinSCP will open the files with your default editor, probably Windows's Notepad. While you can use Notepad to edit files, it may not be the best editor you could use. I recommend [[Editor:_Notepad_plus_plus | Notepad++]] instead.
+
* Use WinSCP to open the file(s) you need to edit.
  
 
* If you're working on site pages, you're working on .bml files. These are in <code>~dw/cvs/dw-free/htdocs/</code> or one of the subsequent folders. You'll see that their names correspond to the URLs of site pages. These files may use .pm modules/widgets which are in <code>~dw/cvs/dw-free/cgi-bin/DW/</code> or <code>~dw/cvs/dw-free/cgi-bin/LJ/</code>.
 
* If you're working on site pages, you're working on .bml files. These are in <code>~dw/cvs/dw-free/htdocs/</code> or one of the subsequent folders. You'll see that their names correspond to the URLs of site pages. These files may use .pm modules/widgets which are in <code>~dw/cvs/dw-free/cgi-bin/DW/</code> or <code>~dw/cvs/dw-free/cgi-bin/LJ/</code>.
Line 288: Line 217:
 
stop-apache</syntaxhighlight>
 
stop-apache</syntaxhighlight>
  
* Synchronize your live code and update your database:
+
* Update your database:
<syntaxhighlight lang="bash">dws
+
FIXME
dwdb</syntaxhighlight>
+
  
 
* Start your Dreamhack again:
 
* Start your Dreamhack again:
Line 302: Line 230:
 
== Update & Save Your Patch ==
 
== Update & Save Your Patch ==
  
* In PuTTY, go to dw-free or dw-nonfree (<code>tocvs f</code> or <code>tocvs n</code>)
+
FIXME
 
+
* Type this to update your patch file:
+
<syntaxhighlight lang="bash">hg qrefresh</syntaxhighlight>
+
 
+
* Go to your patch directory in WinSCP (e.g. <code>/dw/cvs/dw-free/.hg/patches</code>) and save a copy of your patch on your computer.
+
 
+
{{Warn|text=Do not manually edit your patch. This may cause errors that make your patch invalid. Edit your file again. Refresh your patch. Test again.}}
+
  
 
== Upload Your Patch to Bugzilla ==
 
== Upload Your Patch to Bugzilla ==
Line 322: Line 243:
  
 
* (optional) [[Patches|Further reading on patches]]
 
* (optional) [[Patches|Further reading on patches]]
 
= Getting Back to Default Code =
 
 
* Pop your patch out of the pile with:
 
<syntaxhighlight lang="bash">hg qpop</syntaxhighlight>
 
 
* Then delete it:
 
<syntaxhighlight lang="bash">hg qdel BUGNAME</syntaxhighlight>
 
 
: If you want to keep the patch file, use <code>hg qdel -k BUGNAME</code> instead.
 
 
: If you don't remember the name of your bug you can use <code>hg qseries -v</code>. This will list all the patches you have in your patch queue.
 
 
: You can also the use the bug number in the queue instead of its name: <code>hg qdel 0</code>
 
 
* And finally use <code>dws</code> and <code>dwdb</code> to remove changes from your Dreamhack.
 
 
 
= More: Navigating Your Patch Queue =
 
 
If you have a long list of patches and you want to make changes to a patch that is buried in your queue, you can use the <code>hg qgoto</code> command. Simply add the name or the number of your patch after it and it will pop patches until it reaches this patch. You can also use it to go back further up in the queue. It will then push patches until it reaches the one you want.
 
 
 
= More: Reordering Patches =
 
 
Sometimes, while making a patch, you realize something else needs to be fixed first and you go ahead and do that and forget all about the other patch till you realize you need to do further work on it and it's at the bottom of the stack. Of course, you can pop the other patch to be able to edit it but a simpler solution might be to reorder your patches providing they don't deal with the same code:
 
 
* Pop all your patches with <code>hg qpop -a</code>.
 
 
* Open <code>/.hg/patches/series</code> and reorder the lines.
 
 
* Push all your patches again with <code>hg qpush -a</code>.
 
 
 
= More: Merging Patches =
 
 
Sometimes it's a good idea to do things in stages by creating several patches which can be applied successively. It allows you to easily go back to a previous version if things go wrong at some point without losing all your work, or to experiment. However, once you're satisfied with your work, you may want to merge your series of patches to upload only one for review. You can do that using the <code>hg qfold</code> command:
 
 
* First unapply the patches you want to merge using <code>hg qpop</code>.
 
 
* Create a new patch using <code>hg qnew</code>.
 
 
* List the patches you want to merge after <code>hg qfold</code>. Be careful! You need to list them in the order you've created them so start with your oldest one.
 
<syntaxhighlight lang="bash">hg qfold PATCH1 PATCH2 PATCH3</syntaxhighlight>
 
 
: PATCH1 will be merged into NEW. PATCH2 will be merged into PATCH1. PATCH3 will be merged into PATCH2.
 
 
 
= More: Importing a Patch =
 
 
* Sometimes you want to unapply a patch, go back to default code and reapply it later; or you need to import someone else's patch because you want to add something to it or because it blocks your own bug as you're working on the same file.
 
 
* In PuTTY, create a new folder to store patches using the <code>mkdir</code> command:
 
<syntaxhighlight lang="bash">mkdir ~/patches</syntaxhighlight>
 
 
* If you want to save one of your own patches, simply copy/paste the patch into this folder with WinSCP.
 
 
* If you want to import a patch from Bugzilla use the <code>wget</code> command to download it:
 
<syntaxhighlight lang="bash">wget -O ~/patches/bugNUMBER_PATCHNAME.diff BUGZILLA_URL</syntaxhighlight>
 
 
: The Bugzilla URL is something like http://bugs.dwscoalition.org/attachment.cgi?id=NUMBER
 
 
* When you want to apply any of your stored patches, go to dw-free/dw-nonfree in PuTTY.
 
 
* Put the patch in your patch queue:
 
<syntaxhighlight lang="bash">hg qimport ~/patches/bugNUMBER_PATCHNAME.diff</syntaxhighlight>
 
 
* Apply the patch when you want to:
 
<syntaxhighlight lang="bash">hg qpush</syntaxhighlight>
 
  
 
= More: Troubleshooting Tips =
 
= More: Troubleshooting Tips =
 
== Issues With Update and Synchronize ==
 
 
* If your repositories won't update properly with <code>dwu</code>, you may need to go to dw-free/dw-nonfree and remove all your local changes with <code>hg update -C</code> then run <code>dwu</code> again.
 
 
* If <code>dwu</code> gets interrupted and you get an error message about one of the folders, you can try removing the folder and running update again:
 
<syntaxhighlight lang="bash">
 
cd $LJHOME/cvs
 
rm -rf FOLDERNAME
 
$LJHOME/bin/cvsreport.pl -checkout</syntaxhighlight>
 
 
* If your live code won't sync with your repository code, it may be because the files you've edited got saved using your computer time and not distant time. As the system relies on timestamps to see which files need to be updated, updates won't happen if live files seem to be more recent than repository files. Quickest trick is to change your computer time, open and save your files again so they get a later timestamp, refresh your patch and sync again. Also, make sure to check the DST options in WinSCP (Environment section).
 
 
== Issues With Patches and the Patch Queue ==
 
 
* If you've forgotten to create your patch before you edited your files, don't panic. Try <code>hg qnew -f bugNUMBER_PATCHNAME.diff</code>. This will force patch creation.
 
 
* If you get an error message saying that 'working directory is not qtip' when trying to refresh, create, or do anything else related to patches, try <code>hg update -C tip</code>. You may have lost some of your changes but your patch queue should be working again.
 
 
* If there's something wrong with your patch queue (it says the patch is not in the series or you can't delete a patch) don't forget that you can start over: delete the patches folder with WinSCP and recreate it again in PuTTY using <code>hg qinit -c</code>.
 
  
 
== Issues With Text Strings ==
 
== Issues With Text Strings ==

Revision as of 10:08, 24 August 2012

Warning: This guide is currently being rewritten to reflect the new workflow. Some things may be unclear, some things may no longer be relevant, some things may be missing. Please be patient.
Note: Feel free to correct, add, expand, anything that could make this better and clearer. ^_^


What do you need and why?

Because we're on Windows, we have to use quite a number of tools to access and manage things so this part might seem a little daunting. The good news is that 1) we're used to being flexible and resourceful, right? 2) once you've got everything set up things will be much simpler.

  1. You need a Dreamhack where you'll clone the Dreamwidth code. Think of it as an online mirror of the Dreamwidth site.
  1. You need a Github account to be able to clone the Dreamwith repository code into your Dreamhack and fetch updates. This is your code source.
  1. You need PuTTY to connect GitHub to your Dreamhack, and to access and manage your Dreamhack. PuTTY is your center of command. You can't do anything without it.
  1. You need WinSCP to visualize the files on your Dreamhack and be able to open them in a text editor.
  1. You need a text editor to edit your files. While you can use Notepad, I recommend Notepad++ instead. It's free, simple and will make editing much easier.
  1. You need a Bugzilla account to find bugs, files bugs and upload patches.


Get a Dreamhack

  • Apply for a Dreamhack by filling this form. The two important fields are 'Your Desired Username' and 'Your email address'. Your username is used to manage your Dreamhack and to create the URL where your Dreamhack will be located at so you can pick anything. Your email address is used to send you a welcome e-mail which contains important information as well as various alerts. You can pick any of your existing email addresses or choose to create an email account entirely devoted to your development work.
  • Once you're done, you should get an e-mail with your login username and a password. Don't lose it.


Create an account on GitHub

  • Go to http://www.github.com/, click on Sign up and Pricing and create a free account. I suggest you pick a username people are familiar with so they can recognize your. Ideally the same username you'll have on your Bugzilla account.


Install PuTTY

  • Download 'Windows installer for everything except PuTTYtel' .exe file at PuTTY and install it.
  • Run PuTTY. In the configuration window, enter "hack.dreamwidth.net" for the host name. Go to Connection/Data and enter the username/login given to you in the welcome e-mail. It should be something like dh-username.
  • Click on Open. If you get a pop-up message about a key, click Yes.
  • Enter the password given to you in the Dreamhack welcome e-mail when asked. Note that no characters are displayed and the cursor won't move. It's normal.
  • Change your password by typing:
passwd
  • Your default Dreamhack account is called system. Type this to set its password:
$LJHOME/bin/upgrading/make_system.pl


Install WinSCP

What for? WinSCP will allow you to browse and edit your Dreamhack files.

  • Install WinSCP. During the installation, you may be asked about the mode you prefer: Commander and Explorer. Commander works like an FTP client: a partitioned window with your computer files on one side and the Dreamhack files on the other. Explorer will only display your Dreamhack files and works like Windows's Explorer. I prefer this mode because I rarely need to access my computer files but choose what's easiest for you.
  • Use "hack.dreamwidth.net" for the host name. Enter your username and your new password. Click on Save then on Login.


Get a good text editor

While you can use Notepad, I recommend Notepad++ instead. It's free, simple and will make editing much easier.


Create a Bugzilla account

  • As [info]mark explained here, go to Name and Password and enter your name following this format: Name [:username]. 'Name' can be your real name, a nickname, your username again, etc. You don't have to give your real name if you don't want to.


Setting Things Up =

On your GitHub account

You need to fork the Dreamwidth code onto your own account. Forking is like cloning and branching. It will copy the code and also label your copy as being a branch (a fork) of the original Dreamwidth code.

On your Dreamhack

Now you need to 'import' both of these onto your Dreamhack.

  • Open PuTTY and type this to stop your hack:
killall worker-manager
stop-apache
  • Then this to move your current code to username-xx:
mv $LJHOME $LJHOME-xx

FIXME: is this necessary for new users?

  • Type this to clone your GitHub code onto your Dreamhack (replace USERNAME with your GitHub username):
git clone https://USERNAME@github.com/USERNAME/dw-free.git $LJHOME
  • Then this to link the repo with the original DW repo on GitHub:
cd $LJHOME
git remote add dreamwidth https://github.com/dreamwidth/dw-free
git fetch dreamwidth
git branch --set-upstream develop dreamwidth/develop 
git branch --set-upstream master dreamwidth/master
  • Now let's do the same thing with the non-free part of Dreamwidth:
cd $LJHOME/ext
git clone https://USERNAME@github.com/USERNAME/dw-nonfree.git
cd dw-nonfree
git remote add dreamwidth https://github.com/dreamwidth/dw-nonfree
git fetch dreamwidth
git branch --set-upstream develop dreamwidth/develop 
git branch --set-upstream master dreamwidth/master
cd ..

FIXME: add last two steps.


Further steps on your Dreamhack

These are not mandatory but will make your life easier.

Give special abilities to your system account

Get rid of invite codes

  • In WinSCP, go to /dw/cvs/local/etc/, and double-click on config.pl. Find $USE_ACCT_CODES = 1; and change 1 to 0. Save your file.
  • In PuTTY, type this to make the changes go live on your Dreamhack:

FIXME


Folders and files you work with =

  • Your Dreamhack has two parts:
    • the free part (~/dw/*)
    • the non-free part (~/dw/ext/dw-nonfree/*.
  • Both are automatically live when you start your Dreamhack.

Updating your code

  • Code is committed by developers all the time. You must regularly update your repositories with the pull</code command:

FIXME

Updating your database

FIXME


Before You Edit Anything

Find or File a Bug

Some of these bugs won't appear to require 'minor' effort to you. It's normal. Try to find small bugs among them: minor modifications to be done on one of the site pages (text to be modified; elements to be added, removed or moved; elements to be hidden from some categories of users, etc.).
  • To assign a bug to yourself, enter your Bugzilla e-mail address in Assign To and set the status to IN_PROGRESS.
To make this easier, you can also use of [info]fu's Greasemonkey scripts: Dreamwidth Bug Grabber. Click on (grab!) next to Assign To and this will edit it and Status for you. Click on Save Changes of course.

Create a Patch

FIXME

Edit Files

  • Use WinSCP to open the file(s) you need to edit.
  • If you're working on site pages, you're working on .bml files. These are in <code>~dw/cvs/dw-free/htdocs/ or one of the subsequent folders. You'll see that their names correspond to the URLs of site pages. These files may use .pm modules/widgets which are in ~dw/cvs/dw-free/cgi-bin/DW/ or ~dw/cvs/dw-free/cgi-bin/LJ/.
  • For text strings which are not in ~dw/cvs/dw-free/htdocs/xxx.bml.text files, see ~dw/cvs/dw-free/bin/upgrading/en.dat.
  • For more specific searches, you can use the grep command: grep [option(s)] pattern [file(s)]

Interesting options:

-E: match using extended regular expressions -F: match using fixed strings -r: recursive -i: case insensitive -l: filename only -n: add relative line number

Examples:

grep -ri "find this text" * | more
This will search for "find this text" in all files.
grep -rl print_entry $LJHOME/bin/upgrading/s2layers
This will search for files containing "print_entry" in the /s2layers folder.

Test Your Changes on Your Dreamhack

  • In PuTTY, stop your Dreamhack:
cd $LJHOME
stop-apache
  • Update your database:

FIXME

  • Start your Dreamhack again:
start-apache
  • Go to your Dreamhack and test. Edit the files again in WinSCP if more changes are needed. Go through these steps again to test your new changes.


Submit Your Patch

Update & Save Your Patch

FIXME

Upload Your Patch to Bugzilla

  • Click on 'Add an Attachment' to attach your patch. Add a description, check 'patch' and set Flags/Commit and Flags/Review to ?. Feel free to add a comment if you have questions or remarks. Click on Submit.
To help you with this, you can use one of [info]fu's Greasemonkey scripts: Dreamwidth Patch Upload Defaults. This will automatically check 'patch' and set the flags for you.
  • Wait for someone to review and commit your patch. You're done. :)

More: Troubleshooting Tips

Issues With Text Strings

  • As [info]denise explained here, you need to delete old text strings and create new ones when you edit .text files or en.dat instead of simply editing the text. If the change isn't critical - the string doesn't need to be renamed or the text change is minor - it's better to notify the site copy team so that text can be changed locally and the original file left alone.
  • If text you've modified doesn't appear on the site after a code push, append ?uselang=debug to the page URL to make sure it's using the right string. If it is and it still doesn't display after a while, comment on [info]dw_maintenance.

Starting Over


References