How do I install a patch file? I was trying to google the method to install a patch file, but the results keep returning as "issues encountered while patching", which isn't what I am looking for.

I was wondering how to use drush to install a patch file?

More specifically, I'm currently encountering a Drupal for Facebook module issue, about the q variable.

One of the answers suggests installing a patch file. How do i install this patch file from the command line?
The instructions on how to apply a patch are given, for that module, on http://drupal.org/project/fb/git-instructions.

First off, git patches can be applied to a git repository you need to locally clone, which means you need to execute the following command:



git clone --recursive --branch master http://git.drupal.org/project/fb.git


Then you copy the patch in the fb directory created from the previous command, and execute the following one:

cd fb
git apply -v fb_stream.admin_.inc_.patch


Once the patch is applied, you delete it.

rm  fb_stream.admin_.inc_.patch


This assume the patch is applied to the development snapshot. If this is not the case, then somebody needs to provide a patch for the development snapshot.

Anyway, the patch doesn't apply. If you try applying it, you will get the following error:


  Checking patch Users/johnrobens/Downloads/fb/fb_stream.admin.inc...
  error: Users/johnrobens/Downloads/fb/fb_stream.admin.inc: No such file or directory


You need to change the patch to the following one, to avoid that error.

--- fb_stream.admin.inc
+++ fb_stream.admin.inc
@@ -1,5 +1,6 @@
 &lt;?php

+
 /**
  * Form callback for general settings.
  */
@@ -19,7 +20,8 @@
             '%user_name' =&gt; $from['name'],
             '%token' =&gt; $token,
           )));
-    } catch (Exception $e) {
+    }
+    catch (Exception $e) {
       fb_log_exception($e, t('Unable to query graph with fb_stream token.'));
       drupal_set_message(t('There was an error using the current access token, %token.  Consider generating a new token.', array(
             '%token' =&gt; $token,
@@ -29,7 +31,7 @@

   if (!empty($_REQUEST['code']) &amp;&amp; empty($_POST)) {
     // Send user to this URL after token is generated.
-    $redirect_uri = url(request_path(), array(
+    $redirect_uri = url($_REQUEST['q'], array(
       'absolute' =&gt; TRUE,
       'query' =&gt; array(
         'client_id' =&gt; $_REQUEST['client_id'],
@@ -59,7 +61,7 @@
   );
   foreach (fb_get_all_apps() as $fb_app) {
     // Send user to this URL after token is generated.
-    $redirect_uri = url(request_path(), array(
+    $redirect_uri = url($_REQUEST['q'], array(
       'absolute' =&gt; TRUE,
       'query' =&gt; array(
         'client_id' =&gt; $fb_app-&gt;id,
@@ -92,7 +94,7 @@
       'client_id' =&gt; $app_id,
       'client_secret' =&gt; $fb_app-&gt;secret,
       'code' =&gt; $code,
-      'redirect_uri' =&gt; $redirect_uri,
+                  'redirect_uri' =&gt;$redirect_uri,
     ),
       ));
   $http = drupal_http_request($path);


Even if you do that, you would get the error, "patch doesn't apply." I tried applying it to the development snapshot 7.x-3.x (the master branch for git).