@@ -505,7 +505,13 @@ PyDoc_STRVAR(Remote_url__doc__, "Url of the remote");
505
505
PyObject *
506
506
Remote_url__get__ (Remote * self )
507
507
{
508
- return to_unicode (git_remote_url (self -> remote ), NULL , NULL );
508
+ const char * url ;
509
+
510
+ url = git_remote_url (self -> remote );
511
+ if (!url )
512
+ Py_RETURN_NONE ;
513
+
514
+ return to_unicode (url , NULL , NULL );
509
515
}
510
516
511
517
@@ -529,6 +535,42 @@ Remote_url__set__(Remote *self, PyObject* py_url)
529
535
return -1 ;
530
536
}
531
537
538
+ PyDoc_STRVAR (Remote_push_url__doc__ , "Push url of the remote" );
539
+
540
+
541
+ PyObject *
542
+ Remote_push_url__get__ (Remote * self )
543
+ {
544
+ const char * url ;
545
+
546
+ url = git_remote_pushurl (self -> remote );
547
+ if (!url )
548
+ Py_RETURN_NONE ;
549
+
550
+ return to_unicode (url , NULL , NULL );
551
+ }
552
+
553
+
554
+ int
555
+ Remote_push_url__set__ (Remote * self , PyObject * py_url )
556
+ {
557
+ int err ;
558
+ char * url = NULL ;
559
+
560
+ url = py_str_to_c_str (py_url , NULL );
561
+ if (url != NULL ) {
562
+ err = git_remote_set_pushurl (self -> remote , url );
563
+ free (url );
564
+
565
+ if (err == GIT_OK )
566
+ return 0 ;
567
+
568
+ Error_set (err );
569
+ }
570
+
571
+ return -1 ;
572
+ }
573
+
532
574
533
575
PyDoc_STRVAR (Remote_refspec_count__doc__ , "Number of refspecs." );
534
576
@@ -702,6 +744,7 @@ PyMethodDef Remote_methods[] = {
702
744
PyGetSetDef Remote_getseters [] = {
703
745
GETSET (Remote , name ),
704
746
GETSET (Remote , url ),
747
+ GETSET (Remote , push_url ),
705
748
GETTER (Remote , refspec_count ),
706
749
{NULL }
707
750
};
0 commit comments